Skip to content

Commit

Permalink
cpu/esp32: add new uart_mode API function
Browse files Browse the repository at this point in the history
The internal _uart_set_mode function is exposed if module periph_uart_modecfg is enabled.
  • Loading branch information
gschorcht committed Mar 26, 2019
1 parent de28bb4 commit fc72ca3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions boards/common/esp32/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include $(RIOTCPU)/esp32/Makefile.features
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_gpio_irq
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_uart_modecfg

# other features provided by all boards
FEATURES_PROVIDED += esp_spiffs
Expand Down
8 changes: 8 additions & 0 deletions cpu/esp32/periph/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
return UART_OK;
}

#if MODULE_PERIPH_UART_MODECFG
int uart_mode(uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity,
uart_stop_bits_t stop_bits)
{
return _uart_set_mode(uart, data_bits, parity, stop_bits);
}
#endif

void uart_write(uart_t uart, const uint8_t *data, size_t len)
{
CHECK_PARAM (uart < UART_NUMOF);
Expand Down

0 comments on commit fc72ca3

Please sign in to comment.