diff --git a/sys/arduino/doc.txt b/sys/arduino/doc.txt index 5966b7d21ff30ba6e21b6229b4bb89021a5ed11d..253c4651cbb50b804ef8704aa32fcc365b17e2f2 100644 --- a/sys/arduino/doc.txt +++ b/sys/arduino/doc.txt @@ -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'. diff --git a/sys/arduino/include/arduino.hpp b/sys/arduino/include/arduino.hpp index b94f17519f9759993dc1f13689004f5e385fc923..d14e346f889f32a469ea6bada49b40d3dbbe71a8 100644 --- a/sys/arduino/include/arduino.hpp +++ b/sys/arduino/include/arduino.hpp @@ -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