Skip to content

Commit 663454a

Browse files
Add support for SPRESENSE board
1 parent bdc2892 commit 663454a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Boards.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,23 @@ writePort(port, value, bitmask): Write an 8 bit port.
888888
#define PIN_TO_PWM(p) (p)
889889
#define PIN_TO_SERVO(p) (p)
890890

891+
// SPRESENSE
892+
#elif defined(ARDUINO_ARCH_SPRESENSE)
893+
#define TOTAL_ANALOG_PINS NUM_ANALOG_INPUTS
894+
#define TOTAL_PINS NUM_DIGITAL_PINS + 4 + NUM_ANALOG_INPUTS // + 4 built-in led
895+
#define VERSION_BLINK_PIN LED_BUILTIN
896+
#define IS_PIN_DIGITAL(p) ((p) >= 0 && (p) < (NUM_DIGITAL_PINS + 4))
897+
#define IS_PIN_ANALOG(p) ((p) >= (TOTAL_PINS - NUM_ANALOG_INPUTS) && (p) < TOTAL_PINS)
898+
#define IS_PIN_PWM(p) ((p) == 6 || (p) == 5 || (p) == 9 || (p) == 3)
899+
#define IS_PIN_SERVO(p) ((p) < NUM_DIGITAL_PINS)
900+
#define IS_PIN_I2C(p) ((p) == SDA || (p) == SCL)
901+
#define IS_PIN_SPI(p) ((p) == 10 || (p) == 11 || (p) == 12 || (p) == 13)
902+
#define PIN_TO_DIGITAL(p) (((p) < NUM_DIGITAL_PINS) ? (p) : (_LED_PIN((p) - NUM_DIGITAL_PINS)))
903+
#define PIN_TO_ANALOG(p) ((p) - (TOTAL_PINS - NUM_ANALOG_INPUTS))
904+
#define PIN_TO_PWM(p) (p)
905+
#define PIN_TO_SERVO(p) (p)
906+
#define analogRead(p) analogRead(_ANALOG_PIN(p)) // wrap function for analogRead()
907+
891908
// anything else
892909
#else
893910
#error "Please edit Boards.h with a hardware abstraction for this board"

0 commit comments

Comments
 (0)