Skip to content

Avoid to have first analog pin value (A0) lesser than NUM_ANALOG_INPUTS #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cores/arduino/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions variants/board_template/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down