Skip to content

Commit f6dc080

Browse files
committed
Experiment: Add case for boards without ANALOG_PINS_LAST
1 parent 21e1629 commit f6dc080

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cores/arduino/gd32/pins_arduino.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,17 @@ uint32_t PinName_to_digital(PinName p);
147147

148148
/* Convert an analog pin to a digital pin */
149149
#if ANALOG_PINS_NUM > 0
150+
#ifndef ANALOG_PINS_LAST
151+
#define ANALOG_PINS_TO_DIGITAL(p) ( \
152+
((uint32_t)p < ANALOG_PINS_NUM) ? analog_pins[p] : \
153+
((uint32_t)p >= ANALOG_PINS_START) && ((uint32_t)p < DIGITAL_PINS_NUM) ? \
154+
analog_pins[p-ANALOG_PINS_START] : p)
155+
#else
150156
#define ANALOG_PINS_TO_DIGITAL(p) ( \
151157
((uint32_t)p < ANALOG_PINS_NUM) ? analog_pins[p] : \
152158
((uint32_t)p >= ANALOG_PINS_START) && ((uint32_t)p <= ANALOG_PINS_LAST) ? \
153159
analog_pins[p-ANALOG_PINS_START] : p)
160+
#endif
154161
#else
155162
/* No analog pin defined */
156163
#define ANALOG_PINS_TO_DIGITAL(p) (DIGITAL_PINS_NUM)

variants/GD32E230C_START/variant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern "C" {
7878
#define DIGITAL_PINS_NUM 39
7979
#define ANALOG_PINS_NUM 10
8080
#define ANALOG_PINS_START PA0
81-
#define ANALOG_PINS_LAST PB1
81+
//#define ANALOG_PINS_LAST PB1
8282

8383
/* LED definitions */
8484
#define LED1 PA7

0 commit comments

Comments
 (0)