arduino_iomap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Inria
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 #include "periph_conf.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 #define ARDUINO_UART_D0D1 UART_DEV(0)
44 #if !defined(ARDUINO_SPI_D11D12D13) && defined(SPI_NUMOF)
51 #define ARDUINO_SPI_D11D12D13 SPI_DEV(0)
52 #endif
62 #define ARDUINO_I2C_UNO I2C_DEV(0)
69 #define ARDUINO_PIN_0 GPIO_PIN(PORT_A, 3)
70 #define ARDUINO_PIN_1 GPIO_PIN(PORT_A, 2)
71 #define ARDUINO_PIN_2 GPIO_PIN(PORT_A, 10)
72 #define ARDUINO_PIN_3 GPIO_PIN(PORT_B, 3)
73 #define ARDUINO_PIN_4 GPIO_PIN(PORT_B, 5)
74 #define ARDUINO_PIN_5 GPIO_PIN(PORT_B, 4)
75 #define ARDUINO_PIN_6 GPIO_PIN(PORT_B, 10)
76 #define ARDUINO_PIN_7 GPIO_PIN(PORT_A, 8)
77 
78 #define ARDUINO_PIN_8 GPIO_PIN(PORT_A, 9)
79 #define ARDUINO_PIN_9 GPIO_PIN(PORT_C, 7)
80 #define ARDUINO_PIN_10 GPIO_PIN(PORT_B, 6)
81 #ifdef CPU_MODEL_STM32F302R8
82 #define ARDUINO_PIN_11 GPIO_PIN(PORT_B, 15)
83 #define ARDUINO_PIN_12 GPIO_PIN(PORT_B, 14)
84 #define ARDUINO_PIN_13 GPIO_PIN(PORT_B, 13) /* on-board LED */
85 #else
86 #define ARDUINO_PIN_11 GPIO_PIN(PORT_A, 7)
87 #define ARDUINO_PIN_12 GPIO_PIN(PORT_A, 6)
88 #define ARDUINO_PIN_13 GPIO_PIN(PORT_A, 5) /* on-board LED */
89 #endif
90 #define ARDUINO_PIN_14 GPIO_PIN(PORT_B, 9)
91 #define ARDUINO_PIN_15 GPIO_PIN(PORT_B, 8)
92 
93 /* analog pins as digital pins: */
94 #define ARDUINO_PIN_16 GPIO_PIN(PORT_A, 0)
95 #define ARDUINO_PIN_17 GPIO_PIN(PORT_A, 1)
96 #define ARDUINO_PIN_18 GPIO_PIN(PORT_A, 4)
97 #define ARDUINO_PIN_19 GPIO_PIN(PORT_B, 0)
98 #define ARDUINO_PIN_20 GPIO_PIN(PORT_C, 1)
99 #define ARDUINO_PIN_21 GPIO_PIN(PORT_C, 0)
100 
101 #define ARDUINO_PIN_LAST 21
108 #define ARDUINO_PIN_A0 ARDUINO_PIN_16
109 #define ARDUINO_PIN_A1 ARDUINO_PIN_17
110 #define ARDUINO_PIN_A2 ARDUINO_PIN_18
111 #define ARDUINO_PIN_A3 ARDUINO_PIN_19
112 #define ARDUINO_PIN_A4 ARDUINO_PIN_20
113 #define ARDUINO_PIN_A5 ARDUINO_PIN_21
120 #define ARDUINO_A0 ADC_LINE(0)
121 #define ARDUINO_A1 ADC_LINE(1)
122 #define ARDUINO_A2 ADC_LINE(2)
123 #define ARDUINO_A3 ADC_LINE(3)
124 #define ARDUINO_A4 ADC_LINE(4)
125 #define ARDUINO_A5 ADC_LINE(5)
126 
127 #define ARDUINO_ANALOG_PIN_LAST 5
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* ARDUINO_IOMAP_H */
Low-level ADC peripheral driver interface definitions.
Low-level GPIO peripheral driver interface definitions.