1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Remove reference to USART_TypeDef in io, refactor uartOpen and serialUART

This commit is contained in:
jflyper 2017-05-08 13:27:27 +09:00
parent c31fb92ad5
commit 0cf5161ec4
10 changed files with 85 additions and 186 deletions

View file

@ -40,6 +40,17 @@
#define UART8_RX_BUFFER_SIZE 256
#define UART8_TX_BUFFER_SIZE 256
typedef enum UARTDevice {
UARTDEV_1 = 0,
UARTDEV_2 = 1,
UARTDEV_3 = 2,
UARTDEV_4 = 3,
UARTDEV_5 = 4,
UARTDEV_6 = 5,
UARTDEV_7 = 6,
UARTDEV_8 = 7
} UARTDevice;
typedef struct {
serialPort_t port;
@ -72,7 +83,7 @@ typedef struct {
USART_TypeDef *USARTx;
} uartPort_t;
serialPort_t *uartOpen(USART_TypeDef *USARTx, serialReceiveCallbackPtr rxCallback, uint32_t baudRate, portMode_t mode, portOptions_t options);
serialPort_t *uartOpen(UARTDevice device, serialReceiveCallbackPtr rxCallback, uint32_t baudRate, portMode_t mode, portOptions_t options);
// serialPort API
void uartWrite(serialPort_t *instance, uint8_t ch);