BV RS232: add timer for baud rate detection
This commit is contained in:
parent
847e7d189c
commit
6b8255c5d9
|
@ -24,6 +24,7 @@
|
|||
#include <string.h> // string utilities
|
||||
|
||||
/* STM32 (including CM3) libraries */
|
||||
#include <libopencm3/cm3/nvic.h> // interrupt utilities
|
||||
#include <libopencm3/stm32/gpio.h> // general purpose input output library
|
||||
#include <libopencm3/stm32/rcc.h> // real-time control clock library
|
||||
#include <libopencm3/stm32/usart.h> // USART utilities
|
||||
|
@ -43,6 +44,9 @@
|
|||
#define BUSVOODOO_RS232_USART 2 /**< USART peripheral */
|
||||
/** @} */
|
||||
|
||||
#define BUSVOODOO_RS232_RX_TIMER 2 /**< timer ID to capture RX edges */
|
||||
#define BUSVOODOO_RS232_RX_CHANNEL 4 /**< channel ID used as input capture to capture RX edges */
|
||||
|
||||
/** RS-232 specific methods that will be called by the generic methods */
|
||||
static const struct busvoodoo_uart_generic_specific_t busvoodoo_uart_generic_rs232 = {
|
||||
.usart = USART(BUSVOODOO_RS232_USART),
|
||||
|
@ -66,6 +70,18 @@ static const struct busvoodoo_uart_generic_specific_t busvoodoo_uart_generic_rs2
|
|||
.cts_port = USART_CTS_PORT(BUSVOODOO_RS232_USART),
|
||||
.cts_pin = USART_CTS_PIN(BUSVOODOO_RS232_USART),
|
||||
.cts_rcc = RCC_USART_PORT(BUSVOODOO_RS232_USART),
|
||||
.timer = TIM(BUSVOODOO_RS232_RX_TIMER),
|
||||
.timer_rcc = RCC_TIM(BUSVOODOO_RS232_RX_TIMER),
|
||||
.timer_port = TIM_CH_PORT(BUSVOODOO_RS232_RX_TIMER, BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_port_rcc = RCC_TIM_CH(BUSVOODOO_RS232_RX_TIMER, BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_pin = TIM_CH_PIN(BUSVOODOO_RS232_RX_TIMER, BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_ic = TIM_IC(BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_ic_in_ti = TIM_IC_IN_TI(BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_sr_ccif = TIM_SR_CCIF(BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_sr_ccof = TIM_SR_CCOF(BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_ccr = &TIM_CCR(BUSVOODOO_RS232_RX_TIMER, BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_dier_ccie = TIM_DIER_CCIE(BUSVOODOO_RS232_RX_CHANNEL),
|
||||
.timer_nvic_irq = NVIC_TIM_IRQ(BUSVOODOO_RS232_RX_TIMER),
|
||||
};
|
||||
|
||||
/** setup RS-232 mode
|
||||
|
|
Loading…
Reference in New Issue