Skip to content

Commit

Permalink
boards/esp32: UART configuration approach changed
Browse files Browse the repository at this point in the history
UART devices are now configured using static array in header files instead of static variables in implementation to be able to define UART_NUMOF using the size of the array instead of a variable.
  • Loading branch information
gschorcht committed May 2, 2019
1 parent ad4fbd0 commit 949eb6d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions boards/common/esp32/include/periph_conf_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,35 @@ extern "C" {
* @name UART configuration
*/

#ifndef UART0_TXD
#define UART0_TXD (GPIO1) /**< TxD of UART_DEV(0) used on all ESP32 boards */
#endif
#ifndef UART0_RXD
#define UART0_RXD (GPIO3) /**< RxD of UART_DEV(0) used on all ESP32 boards */
#endif

/**
* @brief Static array with configuration for declared I2C devices
*/
static const uart_conf_t uart_config[] = {
{
.txd = UART0_TXD,
.rxd = UART0_RXD,
},
#if defined(UART1_TXD) && defined(UART1_RXD)
{
.txd = UART1_TXD,
.rxd = UART1_RXD,
},
#endif
#if defined(UART2_TXD) && defined(UART2_RXD)
{
.txd = UART2_TXD,
.rxd = UART2_RXD,
},
#endif
};

/**
* @brief Number of UART interfaces
*
Expand Down

0 comments on commit 949eb6d

Please sign in to comment.