@@ -51,12 +51,9 @@ enum {
51
51
};
52
52
53
53
// Arduino analog pins
54
- #ifndef NUM_ANALOG_INPUTS
55
- #define NUM_ANALOG_INPUTS 0
56
- #endif
57
- #ifndef NUM_ANALOG_FIRST
58
- #define NUM_ANALOG_FIRST NUM_DIGITAL_PINS
59
- #endif
54
+ // If NUM_ANALOG_INPUTS is not defined there is no analog pins defined.
55
+ // Anyway ADC internal channels are always avaialable.
56
+ #if defined(NUM_ANALOG_INPUTS ) && (NUM_ANALOG_INPUTS > 0 )
60
57
61
58
// Analog pins must be contiguous to be able to loop on each value
62
59
#define MAX_ANALOG_INPUTS 24
@@ -161,6 +158,11 @@ static const uint8_t A22 = PIN_A22;
161
158
#define PIN_A23 (PIN_A22 + 1)
162
159
static const uint8_t A23 = PIN_A23 ;
163
160
#endif
161
+ #else
162
+ #ifndef NUM_ANALOG_INPUTS
163
+ #define NUM_ANALOG_INPUTS 0
164
+ #endif
165
+ #endif /* NUM_ANALOG_INPUTS */
164
166
165
167
// Default for Arduino connector compatibility
166
168
// SPI Definitions
@@ -238,6 +240,7 @@ uint32_t pinNametoDigitalPin(PinName p);
238
240
// Used by analogRead api to have A0 == 0
239
241
#define analogInputToDigitalPin (p ) (((uint32_t)p < NUM_ANALOG_INPUTS) ? (p+A0) : p)
240
242
#else
243
+ // No analog pin defined
241
244
#define analogInputToDigitalPin (p ) (NUM_DIGITAL_PINS)
242
245
#endif
243
246
// Convert an analog pin number Axx to a PinName PX_n
0 commit comments