arduino_board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Freie Universität Berlin
3  * 2016 Inria
4  * 2020 Gunar Schorcht
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
23 #ifndef ARDUINO_BOARD_H
24 #define ARDUINO_BOARD_H
25 
26 #include "arduino_pinmap.h"
27 #include "periph/pwm.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #define ARDUINO_LED (20)
37 
41 static const gpio_t arduino_pinmap[] = {
42  ARDUINO_PIN_0,
43  ARDUINO_PIN_1,
44  ARDUINO_PIN_2,
45  ARDUINO_PIN_3,
46  ARDUINO_PIN_4,
47  ARDUINO_PIN_5,
48  ARDUINO_PIN_6,
49  ARDUINO_PIN_7,
50  ARDUINO_PIN_8,
51  ARDUINO_PIN_9,
52  ARDUINO_PIN_10,
53  ARDUINO_PIN_11,
54  ARDUINO_PIN_12,
55  ARDUINO_PIN_13,
56  ARDUINO_PIN_A0,
57  ARDUINO_PIN_A1,
58  ARDUINO_PIN_A2,
59  ARDUINO_PIN_A3,
60  ARDUINO_PIN_A4,
61  ARDUINO_PIN_A5,
62  ARDUINO_PIN_20,
63  ARDUINO_PIN_21,
64  ARDUINO_PIN_22,
65  ARDUINO_PIN_23
66 };
67 
71 static const adc_t arduino_analog_map[] = {
72  ARDUINO_A0,
73  ARDUINO_A1,
74  ARDUINO_A2,
75  ARDUINO_A3,
76  ARDUINO_A4,
77  ARDUINO_A5,
78 };
79 
83 #define ARDUINO_PWM_FREQU (15625U)
84 
88 static const arduino_pwm_t arduino_pwm_list[] = {
89  { .pin = 3, .dev = PWM_DEV(0), .chan = 0 },
90  { .pin = 5, .dev = PWM_DEV(0), .chan = 1 },
91  { .pin = 6, .dev = PWM_DEV(0), .chan = 2 },
92  { .pin = 9, .dev = PWM_DEV(0), .chan = 3 },
93  { .pin = 20, .dev = PWM_DEV(1), .chan = 0 },
94  { .pin = 21, .dev = PWM_DEV(1), .chan = 1 },
95  { .pin = 22, .dev = PWM_DEV(1), .chan = 2 },
96  { .pin = 23, .dev = PWM_DEV(1), .chan = 3 },
97 };
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* ARDUINO_BOARD_H */
#define ARDUINO_A1
ADC 1.
#define ARDUINO_A2
ADC 2.
#define ARDUINO_A3
ADC 3.
#define ARDUINO_A4
ADC 4.
#define ARDUINO_A5
ADC 5.
uint_fast8_t adc_t
Define default ADC type identifier.
Definition: adc.h:72
#define PWM_DEV(x)
Default PWM access macro.
Definition: pwm.h:78
Low-level PWM peripheral driver interface definitions.
static const arduino_pwm_t arduino_pwm_list[]
List of PWM GPIO mappings.
Definition: arduino_board.h:88
static const adc_t arduino_analog_map[]
Look-up table for the Arduino's analog pins.
Definition: arduino_board.h:71
static const gpio_t arduino_pinmap[]
Look-up table for the Arduino's digital pins.
Definition: arduino_board.h:41
Mapping from MCU pins to Arduino pins.