Loading...
Searching...
No Matches
arduino_iomap.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 TU Dresden
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
21
22#include "periph/gpio.h"
23#include "periph/adc.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
34#define ARDUINO_UART_DEV UART_UNDEF
36
41#define ARDUINO_SPI_DEV SPI_DEV(0)
43
48#define ARDUINO_I2C_DEV I2C_DEV(0)
50
55#define ARDUINO_LED (11)
57
62/* Left pins */
63#define ARDUINO_PIN_0 GPIO_PIN(0, 2)
64#define ARDUINO_PIN_1 GPIO_PIN(0, 3)
65#define ARDUINO_PIN_2 GPIO_PIN(0, 28)
66#define ARDUINO_PIN_3 GPIO_PIN(0, 29)
67#define ARDUINO_PIN_4 GPIO_PIN(0, 4)
68#define ARDUINO_PIN_5 GPIO_PIN(0, 5)
69#define ARDUINO_PIN_6 GPIO_PIN(1, 11)
70
71/* Right side */
72#define ARDUINO_PIN_7 GPIO_PIN(1, 12)
73#define ARDUINO_PIN_8 GPIO_PIN(1, 13)
74#define ARDUINO_PIN_9 GPIO_PIN(1, 14)
75#define ARDUINO_PIN_10 GPIO_PIN(1, 15)
76
77/* Internal (LEDs) */
78#define ARDUINO_PIN_11 GPIO_PIN(0, 26)
79#define ARDUINO_PIN_12 GPIO_PIN(0, 6)
80#define ARDUINO_PIN_13 GPIO_PIN(0, 30)
81
82#define ARDUINO_PIN_LAST 13
84
89#define ARDUINO_PIN_A0 ARDUINO_PIN_0
90#define ARDUINO_PIN_A1 ARDUINO_PIN_1
91#define ARDUINO_PIN_A2 ARDUINO_PIN_2
92#define ARDUINO_PIN_A3 ARDUINO_PIN_3
93#define ARDUINO_PIN_A4 ARDUINO_PIN_4
94#define ARDUINO_PIN_A5 ARDUINO_PIN_5
96
101/* The Seeed Studio XIAO nRF52840 has a fixed ADC to GPIO mapping:
102 *
103 * nRF | MCU pin | Exposed as Arduino pin
104 * -----|-----------|-----------------------
105 * AIN0 | P0.02 | A0 (D0)
106 * AIN1 | P0.03 | A1 (D1)
107 * AIN2 | P0.04 | A4 (D4)
108 * AIN3 | P0.05 | A5 (D5)
109 * AIN4 | P0.28 | A2 (D2)
110 * AIN5 | P0.29 | A3 (D3)
111 * AIN6 | P0.30 | - (D13)
112 * AIN7 | P0.31 | - (-)
113 */
114#define ARDUINO_A0 ADC_LINE(0)
115#define ARDUINO_A1 ADC_LINE(1)
116#define ARDUINO_A2 ADC_LINE(4)
117#define ARDUINO_A3 ADC_LINE(5)
118#define ARDUINO_A4 ADC_LINE(2)
119#define ARDUINO_A5 ADC_LINE(3)
120
121#define ARDUINO_ANALOG_PIN_LAST 5
123
124#ifdef __cplusplus
125}
126#endif
127
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.