Skip to content

Commit be986a7

Browse files
committed
Fix warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 77b053e commit be986a7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/arduino/pins_arduino.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ extern "C" {
3535
#define NOT_AN_INTERRUPT NC // -1
3636
#define DEND PEND
3737
#define NUM_DIGITAL_PINS ((uint32_t)DEND)
38-
#define NUM_ANALOG_INPUTS (AEND-A0)
38+
#define NUM_ANALOG_INPUTS ((uint32_t)(AEND-A0))
3939

4040
// Convert a digital pin number Dxx to a PinName PX_n
4141
// Note: Analog pin is also a digital pin.
42-
#define digitalPinToPinName(p) ((p < NUM_DIGITAL_PINS) ? digitalPin[p] : NC)
42+
#define digitalPinToPinName(p) (((uint32_t)p < NUM_DIGITAL_PINS) ? digitalPin[p] : NC)
4343
// Convert a PinName PX_n to a digital pin number
4444
uint32_t pinNametoDigitalPin(PinName p);
4545

4646
// Convert an analog pin number to a digital pin number
4747
// Used by analogRead api to have A0 == 0
48-
#define analogInputToDigitalPin(p) ((p < NUM_ANALOG_INPUTS) ? (p+A0) : p)
48+
#define analogInputToDigitalPin(p) (((uint32_t)p < NUM_ANALOG_INPUTS) ? (p+A0) : p)
4949
// Convert an analog pin number Axx to a PinName PX_n
5050
#define analogInputToPinName(p) (digitalPinToPinName(analogInputToDigitalPin(p)))
5151
// All pins could manage EXTI

0 commit comments

Comments
 (0)