28 #ifndef MCU_PERIPH_UART_H
29 #define MCU_PERIPH_UART_H
31 #include "mcu_periph/uart_arch.h"
32 #include "pprzlink/pprzlink_device.h"
35 #ifndef UART_RX_BUFFER_SIZE
36 #ifdef STM32F4 //the F4 has enough memory
37 #define UART_RX_BUFFER_SIZE 256
39 #define UART_RX_BUFFER_SIZE 128
43 #ifndef UART_TX_BUFFER_SIZE
44 #ifdef STM32F4 //the F4 has enough memory, and the PX4 bootloader needs more then 128
45 #define UART_TX_BUFFER_SIZE 256
47 #define UART_TX_BUFFER_SIZE 128
51 #define UART_DEV_NAME_SIZE 16
65 #define UPARITY_EVEN 2
117 extern void uart0_init(
void);
122 extern void uart1_init(
void);
127 extern void uart2_init(
void);
132 extern void uart3_init(
void);
137 extern void uart4_init(
void);
142 extern void uart5_init(
void);
147 extern void uart6_init(
void);
152 extern void uart7_init(
void);
157 extern void uart8_init(
void);
uint8_t tx_buf[UART_TX_BUFFER_SIZE]
Transmit buffer.
#define UART_DEV_NAME_SIZE
void uart_periph_set_bits_stop_parity(struct uart_periph *p, uint8_t bits, uint8_t stop, uint8_t parity)
Set parity and stop bits.
uint8_t rx_buf[UART_RX_BUFFER_SIZE]
Receive buffer.
volatile uint8_t tx_running
void * init_struct
User init struct.
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
struct link_device device
Generic device interface.
uint16_t uart_char_available(struct uart_periph *p)
Check UART for available chars in receive buffer.
bool uart_check_free_space(struct uart_periph *p, long *fd, uint16_t len)
void * reg_addr
UART Register.
void uart_put_buffer(struct uart_periph *p, long fd, const uint8_t *data, uint16_t len)
Uart transmit buffer implementation.
#define UART_TX_BUFFER_SIZE
void uart_periph_set_mode(struct uart_periph *p, bool tx_enabled, bool rx_enabled, bool hw_flow_control)
Set mode (not necessary, or can be set by SerialConfig)
volatile uint16_t ne_err
noise error counter
volatile uint16_t fe_err
framing error counter
uint8_t uart_getch(struct uart_periph *p)
void uart_send_message(struct uart_periph *p, long fd)
void uart_put_byte(struct uart_periph *p, long fd, uint8_t data)
Uart transmit implementation.
char dev[UART_DEV_NAME_SIZE]
UART Dev (linux)
void uart_periph_init(struct uart_periph *p)
int baudrate
UART Baudrate.
void uart_arch_init(void)
volatile uint16_t ore
overrun error counter
#define UART_RX_BUFFER_SIZE