The documentation says that this is only available for "Due, Zero and MKR Family boards".
So, I'm developing a library that requires precise ADC, and my question is the following: What #ifdef I need to use to figure out that target board belongs to these boards with higher ADC resolution?
No. I don't feel like searching for that for you. You are just as capable of doing so as am I.
You should also be as capable of writing a test program to verify it but since I already have one written I will give you that:
#ifdef SAM
#error A board with SAM architecture is selected
#else
#error A board with non-SAM architecture is selected
#endif
void setup() {}
void loop() {}
Juraj:
SAM is for Due. SAMD is for m0 boards Zero, M0, MKR
This is incorrect. Did you test it?
In this case there was no need to differentiate between the Arduino SAM Boards and Arduino SAMD boards so the SAM macro seemed like the most correct answer. You could use the Arduino defined macros ARDUINO_ARCH_SAMD and ARDUINO_ARCH_SAM but the ARDUINO_ARCH_xxx macros are determined only by a folder name and so are much more fragile than the SAM macro, which is defined at a lower level (in CMSIS). Arduino also defines board-specific macros but those aren't going to be very useful for this application since new boards will always be coming out and you'd also need to track 3rd party boards. There are also more specific low level macros: