Loading...
Searching...
No Matches
arduino_iomap.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
20
21#include "periph/adc.h"
22#include "periph/gpio.h"
23#include "periph/i2c.h"
24#include "periph/pwm.h"
25#include "periph/spi.h"
26#include "periph/uart.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36#define ARDUINO_UART_D0D1 UART_DEV(1)
38
46#define ARDUINO_SPI_ISP SPI_DEV(0)
48
56#define ARDUINO_I2C_UNO I2C_DEV(0)
58
63
64/* The WeMos Zero / HW-819 has D2 and D4 swapped compared to official Arduino
65 * Zero, so we have to handle D2 and D4 differently depending on board */
66#ifdef BOARD_WEMOS_ZERO
67# define ARDUINO_PIN_2 GPIO_PIN(PA, 8)
68# define ARDUINO_PIN_4 GPIO_PIN(PA, 14)
69#else /* Official Arduino Zero or fully compatible: */
70# define ARDUINO_PIN_2 GPIO_PIN(PA, 14)
71# define ARDUINO_PIN_4 GPIO_PIN(PA, 8)
72#endif
73
74/* all other pins are identical for all currently supported Arduino Zero
75 * compatible boards */
76#define ARDUINO_PIN_0 GPIO_PIN(PA, 11)
77#define ARDUINO_PIN_1 GPIO_PIN(PA, 10)
78#define ARDUINO_PIN_3 GPIO_PIN(PA, 9)
79#define ARDUINO_PIN_5 GPIO_PIN(PA, 15)
80#define ARDUINO_PIN_6 GPIO_PIN(PA, 20)
81#define ARDUINO_PIN_7 GPIO_PIN(PA, 21)
82
83#define ARDUINO_PIN_8 GPIO_PIN(PA, 6)
84#define ARDUINO_PIN_9 GPIO_PIN(PA, 7)
85#define ARDUINO_PIN_10 GPIO_PIN(PA, 18)
86#define ARDUINO_PIN_11 GPIO_PIN(PA, 16)
87#define ARDUINO_PIN_12 GPIO_PIN(PA, 19)
88#define ARDUINO_PIN_13 GPIO_PIN(PA, 17) /* on-board LED */
89
90/* analog pins as digital pin: */
91#define ARDUINO_PIN_14 GPIO_PIN(PA, 2)
92#define ARDUINO_PIN_15 GPIO_PIN(PB, 8)
93#define ARDUINO_PIN_16 GPIO_PIN(PB, 9)
94#define ARDUINO_PIN_17 GPIO_PIN(PA, 4)
95#define ARDUINO_PIN_18 GPIO_PIN(PA, 5)
96#define ARDUINO_PIN_19 GPIO_PIN(PB, 2)
97
98#define ARDUINO_PIN_LAST 19
100
105#define ARDUINO_PIN_A0 ARDUINO_PIN_14
106#define ARDUINO_PIN_A1 ARDUINO_PIN_15
107#define ARDUINO_PIN_A2 ARDUINO_PIN_16
108#define ARDUINO_PIN_A3 ARDUINO_PIN_17
109#define ARDUINO_PIN_A4 ARDUINO_PIN_18
110#define ARDUINO_PIN_A5 ARDUINO_PIN_19
112
117#define ARDUINO_A0 ADC_LINE(0)
118#define ARDUINO_A1 ADC_LINE(1)
119#define ARDUINO_A2 ADC_LINE(2)
120#define ARDUINO_A3 ADC_LINE(3)
121#define ARDUINO_A4 ADC_LINE(4)
122#define ARDUINO_A5 ADC_LINE(5)
123
124#define ARDUINO_ANALOG_PIN_LAST 5
126
134#define ARDUINO_PWM_FREQU (732U)
135
136#define ARDUINO_PIN_3_PWM_DEV PWM_DEV(0)
137#define ARDUINO_PIN_3_PWM_CHAN 1
138
139#define ARDUINO_PIN_4_PWM_DEV PWM_DEV(0)
140#define ARDUINO_PIN_4_PWM_CHAN 0
141
142#define ARDUINO_PIN_8_PWM_DEV PWM_DEV(1)
143#define ARDUINO_PIN_8_PWM_CHAN 0
144
145#define ARDUINO_PIN_9_PWM_DEV PWM_DEV(1)
146#define ARDUINO_PIN_9_PWM_CHAN 1
148
156#define ARDUINO_SPI_ISP SPI_DEV(0)
160#define ARDUINO_SPI_D11D12D13 SPI_DEV(1)
162
163#ifdef __cplusplus
164}
165#endif
166
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.
Low-level I2C peripheral driver interface definition.
Low-level PWM peripheral driver interface definitions.
Low-level SPI peripheral driver interface definition.
Low-level UART peripheral driver interface definition.