1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Refactored UART pin config similarly to SPI to accomodate F765

This commit is contained in:
Andrey Mironov 2018-09-07 23:21:17 +03:00
parent 8073cb8665
commit d6861b0842
6 changed files with 117 additions and 106 deletions

View file

@ -114,6 +114,13 @@
#define UARTDEV_COUNT (UARTDEV_COUNT_1 + UARTDEV_COUNT_2 + UARTDEV_COUNT_3 + UARTDEV_COUNT_4 + UARTDEV_COUNT_5 + UARTDEV_COUNT_6 + UARTDEV_COUNT_7 + UARTDEV_COUNT_8)
typedef struct uartPinDef_s {
ioTag_t pin;
#if defined(STM32F7)
uint8_t af;
#endif
} uartPinDef_t;
typedef struct uartHardware_s {
UARTDevice_e device; // XXX Not required for full allocation
USART_TypeDef* reg;
@ -125,8 +132,8 @@ typedef struct uartHardware_s {
DMA_Stream_TypeDef *txDMAStream;
DMA_Stream_TypeDef *rxDMAStream;
#endif
ioTag_t rxPins[UARTHARDWARE_MAX_PINS];
ioTag_t txPins[UARTHARDWARE_MAX_PINS];
uartPinDef_t rxPins[UARTHARDWARE_MAX_PINS];
uartPinDef_t txPins[UARTHARDWARE_MAX_PINS];
#if defined(STM32F7)
uint32_t rcc_ahb1;
rccPeriphTag_t rcc_apb2;
@ -134,9 +141,7 @@ typedef struct uartHardware_s {
#else
rccPeriphTag_t rcc;
#endif
#if defined(STM32F7)
uint8_t afs[UARTHARDWARE_MAX_PINS];
#else
#if !defined(STM32F7)
uint8_t af;
#endif
#if defined(STM32F7)
@ -159,6 +164,10 @@ typedef struct uartDevice_s {
const uartHardware_t *hardware;
ioTag_t rx;
ioTag_t tx;
#if defined(STM32F7)
uint8_t rxAF;
uint8_t txAF;
#endif
volatile uint8_t rxBuffer[UART_RX_BUFFER_SIZE];
volatile uint8_t txBuffer[UART_TX_BUFFER_SIZE];
} uartDevice_t;