Skip to content

Commit 63d4fd7

Browse files
committed
boards,sys/arduino: major clean up
- Rename all `arduino_pinmap.h` to `arduino_iomap.h` - An empty `arduino_pinmap.h` that just includes `arduino_iomap.h` is provided for backward compatibility - Move all info from `arduino_board.h` into the new file as trivial macros, so that they can also be used outside of sketches - The new name reflects the fact not just pin mappings, but also other I/O features such as PWMs are mapped - Drop all `arduino_board.h` - `arduino_board.h` and `arduino_iomap.h` now provide the exact same information, just in a different format - a generic `arduino_board.h` is provided instead that just uses the info in `arduinio_iomap.h` and provides them in the format the code in `sys/arduino` expects it - Add fine grained features to indicate for mappings - availability of mappings for analog pins, DAC pins, PWM pins, UART devices, SPI/I2C buses to the corresponding RIOT identification can now be expressed: - `arduino_pins`: `ARDUINO_PIN_0` etc. are available - `arduino_analog`: `ARDUINO_A0` etc. are available - `arduino_pwm`: `ARDUINO_PIN_13_PWM_DEV` etc. are available - `arduino_dac`: `ARDUINO_DAC0` etc. are available - `arduino_uart`: `ARDUINO_UART_D0D1` or similar are available - `arduino_spi`: `ARDUINO_SPI_ISP` or similar are available - `arduino_i2c`: `ARDUINO_I2C_UNO` or similar are available - mechanical/electrical compatibility with specific form factors can now be expressed as features: - `aruino_shield_nano`: Arduino NANO compatible headers - `aruino_shield_uno`: Arduino UNO compatible headers - `aruino_shield_mega`: Arduino MEGA compatible headers - `aruino_shield_isp`: ISP header is available This provides the groundwork to implement shield support as modules that can rely on the I/O mappings, rather than having to provide a configuration per board.
1 parent 970734e commit 63d4fd7

File tree

195 files changed

+4485
-4889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+4485
-4889
lines changed

boards/adafruit-grand-central-m4-express/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ config BOARD_ADAFRUIT_GRAND_CENTRAL_M4_EXPRESS
1111
bool
1212
default y
1313
select CPU_MODEL_SAMD51P20A
14-
select HAS_ARDUINO
14+
select HAS_ARDUINO_ANALOG
15+
select HAS_ARDUINO_PINS
1516
select HAS_HIGHLEVEL_STDIO
1617
select HAS_PERIPH_ADC
1718
select HAS_PERIPH_DAC

boards/adafruit-grand-central-m4-express/Makefile.features

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ FEATURES_PROVIDED += periph_uart
1515
FEATURES_PROVIDED += periph_usbdev
1616

1717
# other board features
18-
FEATURES_PROVIDED += arduino
18+
FEATURES_PROVIDED += arduino_analog
19+
FEATURES_PROVIDED += arduino_pins
1920
FEATURES_PROVIDED += sdcard_spi

boards/adafruit-grand-central-m4-express/include/arduino_board.h

Lines changed: 0 additions & 73 deletions
This file was deleted.

boards/adafruit-grand-central-m4-express/include/arduino_pinmap.h renamed to boards/adafruit-grand-central-m4-express/include/arduino_iomap.h

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* @author Gunar Schorcht <[email protected]>
1717
*/
1818

19-
#ifndef ARDUINO_PINMAP_H
20-
#define ARDUINO_PINMAP_H
19+
#ifndef ARDUINO_IOMAP_H
20+
#define ARDUINO_IOMAP_H
2121

2222
#include "periph/gpio.h"
2323
#include "periph/adc.h"
@@ -49,12 +49,25 @@ extern "C" {
4949
#define ARDUINO_PIN_14 GPIO_PIN(PB, 20)
5050
#define ARDUINO_PIN_15 GPIO_PIN(PB, 21)
5151

52-
#define ARDUINO_PIN_A0 GPIO_PIN(PA, 3)
53-
#define ARDUINO_PIN_A1 GPIO_PIN(PC, 0)
54-
#define ARDUINO_PIN_A2 GPIO_PIN(PC, 3)
55-
#define ARDUINO_PIN_A3 GPIO_PIN(PC, 1)
56-
#define ARDUINO_PIN_A4 GPIO_PIN(PC, 4)
57-
#define ARDUINO_PIN_A5 GPIO_PIN(PC, 5)
52+
#define ARDUINO_PIN_16 GPIO_PIN(PA, 3)
53+
#define ARDUINO_PIN_17 GPIO_PIN(PC, 0)
54+
#define ARDUINO_PIN_18 GPIO_PIN(PC, 3)
55+
#define ARDUINO_PIN_19 GPIO_PIN(PC, 1)
56+
#define ARDUINO_PIN_20 GPIO_PIN(PC, 4)
57+
#define ARDUINO_PIN_21 GPIO_PIN(PC, 5)
58+
59+
#define ARDUINO_PIN_LAST 21 /** D21 (A5) is the last digital pin */
60+
/** @} */
61+
62+
/**
63+
* @name Aliases for analog pins
64+
*/
65+
#define ARDUINO_PIN_A0 ARDUINO_PIN_16 /**< Arduino pin A0 */
66+
#define ARDUINO_PIN_A1 ARDUINO_PIN_17 /**< Arduino pin A1 */
67+
#define ARDUINO_PIN_A2 ARDUINO_PIN_18 /**< Arduino pin A2 */
68+
#define ARDUINO_PIN_A3 ARDUINO_PIN_19 /**< Arduino pin A3 */
69+
#define ARDUINO_PIN_A4 ARDUINO_PIN_20 /**< Arduino pin A4 */
70+
#define ARDUINO_PIN_A5 ARDUINO_PIN_21 /**< Arduino pin A5 */
5871
/** @} */
5972

6073
/**
@@ -67,11 +80,13 @@ extern "C" {
6780
#define ARDUINO_A3 ADC_LINE(3)
6881
#define ARDUINO_A4 ADC_LINE(4)
6982
#define ARDUINO_A5 ADC_LINE(5)
83+
84+
#define ARDUINO_ANALOG_PIN_LAST 5 /**< A5 is the last analog pin */
7085
/** @} */
7186

7287
#ifdef __cplusplus
7388
}
7489
#endif
7590

76-
#endif /* ARDUINO_PINMAP_H */
91+
#endif /* ARDUINO_IOMAP_H */
7792
/** @} */

boards/arduino-duemilanove/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config BOARD_ARDUINO_DUEMILANOVE
1010
select BOARD_COMMON_ARDUINO_ATMEGA
1111
select CPU_MODEL_ATMEGA328P
1212
select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG
13+
select HAS_ARDUINO_SHIELD_UNO
1314

1415
config BOARD
1516
default "arduino-duemilanove" if BOARD_ARDUINO_DUEMILANOVE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CPU = atmega328p
22

3+
FEATURES_PROVIDED += arduino_shield_uno
34
include $(RIOTBOARD)/common/arduino-atmega/Makefile.features

boards/arduino-leonardo/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ config BOARD_ARDUINO_LEONARDO
1313
select BOARD_COMMON_ARDUINO_ATMEGA
1414
select CPU_MODEL_ATMEGA32U4
1515
select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG
16+
select HAS_ARDUINO_SHIELD_UNO
1617

1718
source "$(RIOTBOARD)/common/arduino-atmega/Kconfig"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CPU = atmega32u4
22

3+
FEATURES_PROVIDED += arduino_shield_uno
34
include $(RIOTBOARD)/common/arduino-atmega/Makefile.features

boards/arduino-mega2560/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ config BOARD_ARDUINO_MEGA2560
1313
select CPU_MODEL_ATMEGA2560
1414
select BOARD_COMMON_ARDUINO_ATMEGA
1515
select MODULE_BOARDS_COMMON_ARDUINO-ATMEGA if TEST_KCONFIG
16+
select HAS_ARDUINO_SHIELD_MEGA
17+
select HAS_ARDUINO_SHIELD_UNO
1618

1719
source "$(RIOTBOARD)/common/arduino-atmega/Kconfig"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
CPU = atmega2560
22

3+
FEATURES_PROVIDED += arduino_shield_mega
4+
FEATURES_PROVIDED += arduino_shield_uno
5+
36
include $(RIOTBOARD)/common/arduino-atmega/Makefile.features

0 commit comments

Comments
 (0)