Skip to content

Commit

Permalink
cpu/stm32_common: use pseudomodule for UART HW FC
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Dupont committed Oct 10, 2017
1 parent a295b0e commit be588c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpu/stm32_common/include/periph_cpu_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ typedef struct {
uint8_t dma_stream; /**< DMA stream used for TX */
uint8_t dma_chan; /**< DMA channel used for TX */
#endif
#ifdef UART_USE_HW_FC
#ifdef MODULE_STM32_PERIPH_UART_HW_FC
gpio_t cts_pin; /**< CTS pin - set to GPIO_UNDEF when not using HW flow control */
gpio_t rts_pin; /**< RTS pin */
#ifndef CPU_FAM_STM32F1
Expand Down
4 changes: 2 additions & 2 deletions cpu/stm32_common/periph/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
gpio_init_af(uart_config[uart].rx_pin, uart_config[uart].rx_af);
#endif
}
#ifdef UART_USE_HW_FC
#ifdef MODULE_STM32_PERIPH_UART_HW_FC
if (uart_config[uart].cts_pin != GPIO_UNDEF) {
gpio_init(uart_config[uart].cts_pin, GPIO_IN);
gpio_init(uart_config[uart].rts_pin, GPIO_OUT);
Expand Down Expand Up @@ -109,7 +109,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg)
dev(uart)->CR1 = (USART_CR1_UE | USART_CR1_TE);
}

#ifdef UART_USE_HW_FC
#ifdef MODULE_STM32_PERIPH_UART_HW_FC
if (uart_config[uart].cts_pin != GPIO_UNDEF) {
/* configure hardware flow control */
dev(uart)->CR3 = (USART_CR3_RTSE | USART_CR3_CTSE);
Expand Down
3 changes: 3 additions & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ PSEUDOMODULES += sx1276

# add all pseudo random number generator variants as pseudomodules
PSEUDOMODULES += prng_%

# STM32 periph pseudomodules
PSEUDOMODULES += stm32_periph_%

0 comments on commit be588c2

Please sign in to comment.