CuVoodoo STM32F1 firmware template
busvoodoo_uart_generic.h
Go to the documentation of this file.
1 /* This program is free software: you can redistribute it and/or modify
2  * it under the terms of the GNU General Public License as published by
3  * the Free Software Foundation, either version 3 of the License, or
4  * (at your option) any later version.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program. If not, see <http://www.gnu.org/licenses/>.
13  *
14  */
21 #include <libopencm3/stm32/timer.h> // timer library
22 
25  uint32_t usart;
26  uint32_t usart_rcc;
27  uint32_t usart_rst;
28  bool multidrive;
29  uint32_t tx_port;
30  uint32_t tx_pin;
31  uint32_t tx_rcc;
32  void (*tx_pre)(void);
33  void (*tx_post)(void);
34  uint32_t rx_port;
35  uint32_t rx_pin;
36  uint32_t rx_rcc;
37  void (*rx_pre)(void);
38  void (*rx_post)(void);
39  /* hardware flow control configuration */
40  bool hwflowctl;
41  uint32_t rts_port;
42  uint32_t rts_pin;
43  uint32_t rts_rcc;
44  uint32_t cts_port;
45  uint32_t cts_pin;
46  uint32_t cts_rcc;
47  /* timer input channel capture to measure Rx edge timing */
48  uint32_t timer;
49  uint32_t timer_rcc;
50  uint32_t timer_port;
51  uint32_t timer_port_rcc;
52  uint32_t timer_pin;
53  enum tim_ic_id timer_ic;
54  enum tim_ic_input timer_ic_in_ti;
55  uint32_t timer_sr_ccif;
56  uint32_t timer_sr_ccof;
57  volatile uint32_t* timer_ccr;
58  uint32_t timer_dier_ccie;
59  uint32_t timer_nvic_irq;
60 };
61 
73 bool busvoodoo_uart_generic_setup(char** prefix, const char* line);
79 #define busvoodoo_uart_generic_commands_nb 6
80 
uint32_t timer_pin
pin of timer capture channel
command menu entry
Definition: menu.h:32
void(* tx_post)(void)
method to be called after transmitting data
enum tim_ic_id timer_ic
timer input capture channel
bool busvoodoo_uart_generic_setup(char **prefix, const char *line)
setup generic UART mode
bool busvoodoo_uart_generic_configure(const struct busvoodoo_uart_generic_specific_t *conf)
provide the generic USART with mode specific information
uint32_t rx_pin
GPIO pin address of receive pin.
uint32_t timer_port
port of timer capture channel
uint32_t timer_dier_ccie
timer channel capture interrupt enable
uint32_t timer_port_rcc
port RCC of timer capture channel
uint32_t rts_port
GPIO port address of request to send pin.
volatile uint32_t * timer_ccr
timer channel capture register
void(* rx_pre)(void)
method to be called before receiving data
uint32_t usart
USART peripheral base address.
uint32_t rx_rcc
GPIO RCC address of receive pin.
bool multidrive
if multiple drive modes are supported (push-pull, open-drain with internal resistors, open-drain with external resistors), or just push-pull
uint32_t rx_port
GPIO port address of receive pin.
uint32_t timer_rcc
timer RCC address
uint32_t tx_pin
GPIO pin address of transmit pin.
void(* rx_post)(void)
method to be called after receiving data
uint32_t tx_rcc
GPIO RCC address of transmit pin.
UART specific methods that will be called by the generic methods.
uint32_t timer_sr_ccif
timer channel capture interrupt flag
void(* tx_pre)(void)
method to be called before transmitting data
uint32_t rts_rcc
GPIO RCC address of request to send pin.
uint32_t cts_port
GPIO port address of clear to send pin.
#define busvoodoo_uart_generic_commands_nb
number of commands supported by the generic UART mode
uint32_t usart_rst
USART RST address.
uint32_t rts_pin
GPIO pin address of request to send pin.
uint32_t usart_rcc
USART RCC address.
uint32_t timer_sr_ccof
timer channel capture overrun flag
uint32_t cts_rcc
GPIO RCC address of clear to send pin.
void busvoodoo_uart_generic_exit(void)
exit genetic UART mode
bool hwflowctl
if RTC/CTS hardware flow control is supported
uint32_t tx_port
GPIO port address of transmit pin.
uint32_t cts_pin
GPIO pin address of clear to send pin.
const struct menu_command_t busvoodoo_uart_generic_commands[busvoodoo_uart_generic_commands_nb]
commands supported by the generic UART mode
enum tim_ic_input timer_ic_in_ti
timer input capture channel TIn