mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
Remove reference to USART_TypeDef in io, refactor uartOpen and serialUART
This commit is contained in:
parent
c31fb92ad5
commit
0cf5161ec4
10 changed files with 85 additions and 186 deletions
|
@ -176,48 +176,14 @@ static void uartReconfigure(uartPort_t *uartPort)
|
|||
return;
|
||||
}
|
||||
|
||||
serialPort_t *uartOpen(USART_TypeDef *USARTx, serialReceiveCallbackPtr callback, uint32_t baudRate, portMode_t mode, portOptions_t options)
|
||||
serialPort_t *uartOpen(UARTDevice device, serialReceiveCallbackPtr callback, uint32_t baudRate, portMode_t mode, portOptions_t options)
|
||||
{
|
||||
uartPort_t *s = NULL;
|
||||
uartPort_t *s = serialUART(device, baudRate, mode, options);
|
||||
|
||||
if (false) {
|
||||
#ifdef USE_UART1
|
||||
} else if (USARTx == USART1) {
|
||||
s = serialUART1(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART2
|
||||
} else if (USARTx == USART2) {
|
||||
s = serialUART2(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART3
|
||||
} else if (USARTx == USART3) {
|
||||
s = serialUART3(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART4
|
||||
} else if (USARTx == UART4) {
|
||||
s = serialUART4(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART5
|
||||
} else if (USARTx == UART5) {
|
||||
s = serialUART5(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART6
|
||||
} else if (USARTx == USART6) {
|
||||
s = serialUART6(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART7
|
||||
} else if (USARTx == UART7) {
|
||||
s = serialUART7(baudRate, mode, options);
|
||||
#endif
|
||||
#ifdef USE_UART8
|
||||
} else if (USARTx == UART8) {
|
||||
s = serialUART8(baudRate, mode, options);
|
||||
#endif
|
||||
} else {
|
||||
if (!s) {
|
||||
return (serialPort_t *)s;
|
||||
}
|
||||
|
||||
|
||||
s->txDMAEmpty = true;
|
||||
|
||||
// common serial initialisation code should move to serialPort::init()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue