How to detect a Portenta in a library?

I'm writing some code to be included in a library that will use Portenta specific variations when compiling for the Portenta.

Currently, I'm using the following to detect if I'm running on a Portenta (just the M4 core at the moment). I guess I can expand that to include the M7 core too. But it seems a bit too broad in that it could pickup other boards too.

#if defined(CORE_CM4)

Is there a better define I can use to detect the Portenta?

https://arduino.github.io/arduino-cli/latest/platform-specification/#boardstxt
envie_m4.build.board=PORTENTA_H7_M4

1 Like

As you might have guessed already from Juraj's reply, there is an equivalent board identification macro for the Arduino Portenta H7 M7 board: ARDUINO_PORTENTA_H7_M7

1 Like

Great, thanks both. Totally answered

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.