1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

sys/arduino: add possibility to customize Arduino serial port at compile time

This commit is contained in:
Federico Pellegrin 2018-10-11 21:33:50 +02:00
parent 94adf875c0
commit a89e43ae31
2 changed files with 15 additions and 2 deletions

View File

@ -112,6 +112,12 @@
* @endcode
* This links to the third entry in the `arduino_pinmap` array.
*
* - a define `ARDUINO_UART_DEV` that defines the UART to use as the Arduino
* primary serial port (default UART_DEV(0)):
* @code{c}
* #define ARDUINO_UART_DEV (UART_DEV(3))
* @endcode
*
* In addition, you have to add the 'arduino' feature to the board. For this,
* just add `FEATURES_PROVIDED += arduino` to the 'other features' section in
* your board's `Makefile.features'.

View File

@ -45,10 +45,17 @@ enum {
HIGH = 1 /**< pin is set */
};
#ifndef ARDUINO_UART_DEV
/**
* @brief Primary serial port (mapped to UART_DEV(0))
* @brief UART device to use for Arduino serial
*/
static SerialPort Serial(UART_DEV(0));
#define ARDUINO_UART_DEV UART_DEV(0)
#endif
/**
* @brief Primary serial port (mapped to ARDUINO_UART_DEV)
*/
static SerialPort Serial(ARDUINO_UART_DEV);
/**
* @brief Configure a pin as either input or output