arduino_iomap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 TU Dresden
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef ARDUINO_IOMAP_H
23 #define ARDUINO_IOMAP_H
24 
25 #include "periph/gpio.h"
26 #include "periph/adc.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 #define ARDUINO_UART_DEV UART_UNDEF
44 #define ARDUINO_SPI_DEV SPI_DEV(0)
51 #define ARDUINO_I2C_DEV I2C_DEV(0)
58 #define ARDUINO_LED (11)
65 /* Left pins */
66 #define ARDUINO_PIN_0 GPIO_PIN(0, 2)
67 #define ARDUINO_PIN_1 GPIO_PIN(0, 3)
68 #define ARDUINO_PIN_2 GPIO_PIN(0, 28)
69 #define ARDUINO_PIN_3 GPIO_PIN(0, 29)
70 #define ARDUINO_PIN_4 GPIO_PIN(0, 4)
71 #define ARDUINO_PIN_5 GPIO_PIN(0, 5)
72 #define ARDUINO_PIN_6 GPIO_PIN(1, 11)
73 
74 /* Right side */
75 #define ARDUINO_PIN_7 GPIO_PIN(1, 12)
76 #define ARDUINO_PIN_8 GPIO_PIN(1, 13)
77 #define ARDUINO_PIN_9 GPIO_PIN(1, 14)
78 #define ARDUINO_PIN_10 GPIO_PIN(1, 15)
79 
80 /* Internal (LEDs) */
81 #define ARDUINO_PIN_11 GPIO_PIN(0, 26)
82 #define ARDUINO_PIN_12 GPIO_PIN(0, 6)
83 #define ARDUINO_PIN_13 GPIO_PIN(0, 30)
84 
85 #define ARDUINO_PIN_LAST 13
92 #define ARDUINO_PIN_A0 ARDUINO_PIN_0
93 #define ARDUINO_PIN_A1 ARDUINO_PIN_1
94 #define ARDUINO_PIN_A2 ARDUINO_PIN_2
95 #define ARDUINO_PIN_A3 ARDUINO_PIN_3
96 #define ARDUINO_PIN_A4 ARDUINO_PIN_4
97 #define ARDUINO_PIN_A5 ARDUINO_PIN_5
104 /* The Seeed Studio XIAO nRF52840 has a fixed ADC to GPIO mapping:
105  *
106  * nRF | MCU pin | Exposed as Arduino pin
107  * -----|-----------|-----------------------
108  * AIN0 | P0.02 | A0 (D0)
109  * AIN1 | P0.03 | A1 (D1)
110  * AIN2 | P0.04 | A4 (D4)
111  * AIN3 | P0.05 | A5 (D5)
112  * AIN4 | P0.28 | A2 (D2)
113  * AIN5 | P0.29 | A3 (D3)
114  * AIN6 | P0.30 | - (D13)
115  * AIN7 | P0.31 | - (-)
116  */
117 #define ARDUINO_A0 ADC_LINE(0)
118 #define ARDUINO_A1 ADC_LINE(1)
119 #define ARDUINO_A2 ADC_LINE(4)
120 #define ARDUINO_A3 ADC_LINE(5)
121 #define ARDUINO_A4 ADC_LINE(2)
122 #define ARDUINO_A5 ADC_LINE(3)
123 
124 #define ARDUINO_ANALOG_PIN_LAST 5
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* ARDUINO_IOMAP_H */
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.