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