Merge pull request #11425 from OTAkeys/pr/fix_stm32_uart_flow_control

cpu/stm32_common: set RTS when uart is off
This commit is contained in:
Alexandre Abadie 2019-05-09 09:13:13 +02:00 committed by GitHub
commit 5d63e28e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -334,6 +334,16 @@ void uart_poweron(uart_t uart)
if (isr_ctx[uart].rx_cb) {
pm_block(STM32_PM_STOP);
}
#endif
#ifdef MODULE_STM32_PERIPH_UART_HW_FC
if (uart_config[uart].cts_pin != GPIO_UNDEF) {
gpio_init(uart_config[uart].rts_pin, GPIO_OUT);
#ifdef CPU_FAM_STM32F1
gpio_init_af(uart_config[uart].rts_pin, GPIO_AF_OUT_PP);
#else
gpio_init_af(uart_config[uart].rts_pin, uart_config[uart].rts_af);
#endif
}
#endif
periph_clk_en(uart_config[uart].bus, uart_config[uart].rcc_mask);
}
@ -343,6 +353,12 @@ void uart_poweroff(uart_t uart)
assert(uart < UART_NUMOF);
periph_clk_dis(uart_config[uart].bus, uart_config[uart].rcc_mask);
#ifdef MODULE_STM32_PERIPH_UART_HW_FC
if (uart_config[uart].cts_pin != GPIO_UNDEF) {
gpio_init(uart_config[uart].rts_pin, GPIO_OUT);
gpio_set(uart_config[uart].rts_pin);
}
#endif
#ifdef STM32_PM_STOP
if (isr_ctx[uart].rx_cb) {
pm_unblock(STM32_PM_STOP);