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/* P3 header on the nRF52840DK */
68#define ARDUINO_PIN_0 GPIO_PIN(1, 1)
69#define ARDUINO_PIN_1 GPIO_PIN(1, 2)
70#define ARDUINO_PIN_2 GPIO_PIN(1, 3)
71#define ARDUINO_PIN_3 GPIO_PIN(1, 4)
72#define ARDUINO_PIN_4 GPIO_PIN(1, 5)
73#define ARDUINO_PIN_5 GPIO_PIN(1, 6)
74#define ARDUINO_PIN_6 GPIO_PIN(1, 7)
75#define ARDUINO_PIN_7 GPIO_PIN(1, 8)
76
77/* P4 header on the nRF52840DK */
78#define ARDUINO_PIN_8 GPIO_PIN(1, 10)
79#define ARDUINO_PIN_9 GPIO_PIN(1, 11)
80#define ARDUINO_PIN_10 GPIO_PIN(1, 12)
81#define ARDUINO_PIN_11 GPIO_PIN(1, 13)
82#define ARDUINO_PIN_12 GPIO_PIN(1, 14)
83#define ARDUINO_PIN_13 GPIO_PIN(1, 15)
84/* SCL and SDA on this header are not available as digital pins in the
85 * Arduino world. It is P0.26 and P0.27 here, though. Also what would be
86 * AREF in the Arduino world is P0.02 here */
87
88/* P6 header on the nRF52840DK */
89#define ARDUINO_PIN_14 GPIO_PIN(0, 10)
90#define ARDUINO_PIN_15 GPIO_PIN(0, 9)
91#define ARDUINO_PIN_16 GPIO_PIN(0, 8)
92#define ARDUINO_PIN_17 GPIO_PIN(0, 7)
93#define ARDUINO_PIN_18 GPIO_PIN(0, 6)
94#define ARDUINO_PIN_19 GPIO_PIN(0, 5)
95#define ARDUINO_PIN_20 GPIO_PIN(0, 1)
96#define ARDUINO_PIN_21 GPIO_PIN(0, 0)
97
98/* P24 header on the nRF52840DK
99 * Note: The header is one column short on the right (missing a column of
100 * two 5V supply pins) and 8 columns on the left (missing D40 to D53
101 * and two GND on the leftmost column).
102 * Warning: Where D39 is expected a GND pin is sitting instead */
103#define ARDUINO_PIN_22 GPIO_PIN(0, 11)
104#define ARDUINO_PIN_23 GPIO_PIN(0, 12)
105#define ARDUINO_PIN_24 GPIO_PIN(0, 13)
106#define ARDUINO_PIN_25 GPIO_PIN(0, 14)
107#define ARDUINO_PIN_26 GPIO_PIN(0, 15)
108#define ARDUINO_PIN_27 GPIO_PIN(0, 16)
109#define ARDUINO_PIN_28 GPIO_PIN(0, 17)
110#define ARDUINO_PIN_29 GPIO_PIN(0, 18)
111#define ARDUINO_PIN_30 GPIO_PIN(0, 19)
112#define ARDUINO_PIN_31 GPIO_PIN(0, 20)
113#define ARDUINO_PIN_32 GPIO_PIN(0, 21)
114#define ARDUINO_PIN_33 GPIO_PIN(0, 22)
115#define ARDUINO_PIN_34 GPIO_PIN(0, 23)
116#define ARDUINO_PIN_35 GPIO_PIN(0, 24)
117#define ARDUINO_PIN_36 GPIO_PIN(0, 25)
118#define ARDUINO_PIN_37 GPIO_PIN(1, 0)
119#define ARDUINO_PIN_38 GPIO_PIN(1, 9)
120
121/* P2 header on the nRF52840DK
122 * Note: This header only provides A0 - A5, but it should be two pins
123 * longer for full Arduino Mega compatibility */
124#define ARDUINO_PIN_54 GPIO_PIN(0, 3)
125#define ARDUINO_PIN_55 GPIO_PIN(0, 4)
126#define ARDUINO_PIN_56 GPIO_PIN(0, 28)
127#define ARDUINO_PIN_57 GPIO_PIN(0, 29)
128#define ARDUINO_PIN_58 GPIO_PIN(0, 30)
129#define ARDUINO_PIN_59 GPIO_PIN(0, 31)
130
131/* Note: There is no header for A8 - A15 present, which would be required
132 * for full Arduino Mega compatibility */
133#define ARDUINO_PIN_LAST 59
140#define ARDUINO_PIN_A0 ARDUINO_PIN_54
141#define ARDUINO_PIN_A1 ARDUINO_PIN_55
142#define ARDUINO_PIN_A2 ARDUINO_PIN_56
143#define ARDUINO_PIN_A3 ARDUINO_PIN_57
144#define ARDUINO_PIN_A4 ARDUINO_PIN_58
145#define ARDUINO_PIN_A5 ARDUINO_PIN_59
152/* The nRF52840 has a fixed ADC to GPIO mapping:
153 *
154 * nRF | MCU pin | Exposed as Arduino pin
155 * -----|-----------|-----------------------
156 * AIN0 | P0.02 | AREF
157 * AIN1 | P0.03 | A0 (D54)
158 * AIN2 | P0.04 | A1 (D55)
159 * AIN3 | P0.05 | - (D19)
160 * AIN4 | P0.28 | A2 (D56)
161 * AIN5 | P0.29 | A3 (D57)
162 * AIN6 | P0.30 | A4 (D48)
163 * AIN7 | P0.31 | A5 (D59)
164 */
165#define ARDUINO_A0 ADC_LINE(1)
166#define ARDUINO_A1 ADC_LINE(2)
167#define ARDUINO_A2 ADC_LINE(4)
168#define ARDUINO_A3 ADC_LINE(5)
169#define ARDUINO_A4 ADC_LINE(6)
170#define ARDUINO_A5 ADC_LINE(7)
171
172#define ARDUINO_ANALOG_PIN_LAST 5
175#ifdef __cplusplus
176}
177#endif
178
179#endif /* ARDUINO_IOMAP_H */
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.