Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
arduino_iomap.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2023 Otto-von-Guericke-Universität Magdeburg
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*/
5
6
#pragma once
7
21
#include "
periph/gpio.h
"
22
#include "
periph/adc.h
"
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
32
#define ARDUINO_UART_D0D1 UART_DEV(1)
42
/* D11/D12/D13 are on P1.13, P1.14, P1.15 */
43
#define ARDUINO_SPI_D11D12D13 SPI_DEV(0)
44
/* The ISP SPI bus is also connected to P1.13, P1.14, P1.15 */
45
#define ARDUINO_SPI_ISP SPI_DEV(0)
56
#define ARDUINO_I2C_UNO I2C_DEV(0)
63
#define ARDUINO_LED (24)
70
/* P3 header on the nRF52840DK */
71
#define ARDUINO_PIN_0 GPIO_PIN(1, 1)
72
#define ARDUINO_PIN_1 GPIO_PIN(1, 2)
73
#define ARDUINO_PIN_2 GPIO_PIN(1, 3)
74
#define ARDUINO_PIN_3 GPIO_PIN(1, 4)
75
#define ARDUINO_PIN_4 GPIO_PIN(1, 5)
76
#define ARDUINO_PIN_5 GPIO_PIN(1, 6)
77
#define ARDUINO_PIN_6 GPIO_PIN(1, 7)
78
#define ARDUINO_PIN_7 GPIO_PIN(1, 8)
79
80
/* P4 header on the nRF52840DK */
81
#define ARDUINO_PIN_8 GPIO_PIN(1, 10)
82
#define ARDUINO_PIN_9 GPIO_PIN(1, 11)
83
#define ARDUINO_PIN_10 GPIO_PIN(1, 12)
84
#define ARDUINO_PIN_11 GPIO_PIN(1, 13)
85
#define ARDUINO_PIN_12 GPIO_PIN(1, 14)
86
#define ARDUINO_PIN_13 GPIO_PIN(1, 15)
87
/* SCL and SDA on this header are not available as digital pins in the
88
* Arduino world. It is P0.26 and P0.27 here, though. Also what would be
89
* AREF in the Arduino world is P0.02 here */
90
91
/* P6 header on the nRF52840DK */
92
#define ARDUINO_PIN_14 GPIO_PIN(0, 10)
93
#define ARDUINO_PIN_15 GPIO_PIN(0, 9)
94
#define ARDUINO_PIN_16 GPIO_PIN(0, 8)
95
#define ARDUINO_PIN_17 GPIO_PIN(0, 7)
96
#define ARDUINO_PIN_18 GPIO_PIN(0, 6)
97
#define ARDUINO_PIN_19 GPIO_PIN(0, 5)
98
#define ARDUINO_PIN_20 GPIO_PIN(0, 1)
99
#define ARDUINO_PIN_21 GPIO_PIN(0, 0)
100
101
/* P24 header on the nRF52840DK
102
* Note: The header is one column short on the right (missing a column of
103
* two 5V supply pins) and 8 columns on the left (missing D40 to D53
104
* and two GND on the leftmost column).
105
* Warning: Where D39 is expected a GND pin is sitting instead */
106
#define ARDUINO_PIN_22 GPIO_PIN(0, 11)
107
#define ARDUINO_PIN_23 GPIO_PIN(0, 12)
108
#define ARDUINO_PIN_24 GPIO_PIN(0, 13)
109
#define ARDUINO_PIN_25 GPIO_PIN(0, 14)
110
#define ARDUINO_PIN_26 GPIO_PIN(0, 15)
111
#define ARDUINO_PIN_27 GPIO_PIN(0, 16)
112
#define ARDUINO_PIN_28 GPIO_PIN(0, 17)
113
#define ARDUINO_PIN_29 GPIO_PIN(0, 18)
114
#define ARDUINO_PIN_30 GPIO_PIN(0, 19)
115
#define ARDUINO_PIN_31 GPIO_PIN(0, 20)
116
#define ARDUINO_PIN_32 GPIO_PIN(0, 21)
117
#define ARDUINO_PIN_33 GPIO_PIN(0, 22)
118
#define ARDUINO_PIN_34 GPIO_PIN(0, 23)
119
#define ARDUINO_PIN_35 GPIO_PIN(0, 24)
120
#define ARDUINO_PIN_36 GPIO_PIN(0, 25)
121
#define ARDUINO_PIN_37 GPIO_PIN(1, 0)
122
#define ARDUINO_PIN_38 GPIO_PIN(1, 9)
123
124
/* P2 header on the nRF52840DK
125
* Note: This header only provides A0 - A5, but it should be two pins
126
* longer for full Arduino Mega compatibility */
127
#define ARDUINO_PIN_54 GPIO_PIN(0, 3)
128
#define ARDUINO_PIN_55 GPIO_PIN(0, 4)
129
#define ARDUINO_PIN_56 GPIO_PIN(0, 28)
130
#define ARDUINO_PIN_57 GPIO_PIN(0, 29)
131
#define ARDUINO_PIN_58 GPIO_PIN(0, 30)
132
#define ARDUINO_PIN_59 GPIO_PIN(0, 31)
133
134
/* Note: There is no header for A8 - A15 present, which would be required
135
* for full Arduino Mega compatibility */
136
#define ARDUINO_PIN_LAST 59
143
#define ARDUINO_PIN_A0 ARDUINO_PIN_54
144
#define ARDUINO_PIN_A1 ARDUINO_PIN_55
145
#define ARDUINO_PIN_A2 ARDUINO_PIN_56
146
#define ARDUINO_PIN_A3 ARDUINO_PIN_57
147
#define ARDUINO_PIN_A4 ARDUINO_PIN_58
148
#define ARDUINO_PIN_A5 ARDUINO_PIN_59
155
/* The nRF52840 has a fixed ADC to GPIO mapping:
156
*
157
* nRF | MCU pin | Exposed as Arduino pin
158
* -----|-----------|-----------------------
159
* AIN0 | P0.02 | AREF
160
* AIN1 | P0.03 | A0 (D54)
161
* AIN2 | P0.04 | A1 (D55)
162
* AIN3 | P0.05 | - (D19)
163
* AIN4 | P0.28 | A2 (D56)
164
* AIN5 | P0.29 | A3 (D57)
165
* AIN6 | P0.30 | A4 (D48)
166
* AIN7 | P0.31 | A5 (D59)
167
*/
168
#define ARDUINO_A0 ADC_LINE(1)
169
#define ARDUINO_A1 ADC_LINE(2)
170
#define ARDUINO_A2 ADC_LINE(4)
171
#define ARDUINO_A3 ADC_LINE(5)
172
#define ARDUINO_A4 ADC_LINE(6)
173
#define ARDUINO_A5 ADC_LINE(7)
174
175
#define ARDUINO_ANALOG_PIN_LAST 5
178
#ifdef __cplusplus
179
}
180
#endif
181
adc.h
Low-level ADC peripheral driver interface definitions.
gpio.h
Low-level GPIO peripheral driver interface definitions.
Generated on Sat Sep 6 2025 20:14:01 by
1.9.1