diff --git a/cores/arduino/pins_arduino.h b/cores/arduino/pins_arduino.h index d40ab89bf4..cbfc166d97 100644 --- a/cores/arduino/pins_arduino.h +++ b/cores/arduino/pins_arduino.h @@ -50,7 +50,10 @@ enum { // Arduino analog pins // Analog pins must be contiguous to be able to loop on each value #define MAX_ANALOG_INPUTS 20 -_Static_assert(NUM_ANALOG_INPUTS <= MAX_ANALOG_INPUTS, "Core NUM_ANALOG_INPUTS limited to MAX_ANALOG_INPUTS" ); +_Static_assert(NUM_ANALOG_INPUTS <= MAX_ANALOG_INPUTS, + "Core NUM_ANALOG_INPUTS limited to MAX_ANALOG_INPUTS" ); +_Static_assert(NUM_ANALOG_FIRST >= NUM_ANALOG_INPUTS, + "First analog pin value (A0) must be greater than or equal to NUM_ANALOG_INPUTS" ); // Defined for backward compatibility with Firmata which unfortunately use it #define AEND (NUM_ANALOG_FIRST+NUM_ANALOG_INPUTS) diff --git a/variants/board_template/variant.h b/variants/board_template/variant.h index 06182b2d97..f2ef9cc409 100644 --- a/variants/board_template/variant.h +++ b/variants/board_template/variant.h @@ -75,6 +75,7 @@ enum { // !!! #define NUM_ANALOG_INPUTS 0 // Define digital pin number of the first analog input (i.e. which digital pin is A0) +// First analog pin value (A0) must be greater than or equal to NUM_ANALOG_INPUTS #define NUM_ANALOG_FIRST 0 // Below ADC, DAC and PWM definitions already done in the core