mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Rebased on to master (with merged CMS)
This commit is contained in:
commit
61a87480b3
341 changed files with 8778 additions and 8563 deletions
|
@ -121,7 +121,7 @@ void serialUARTInit(IO_t tx, IO_t rx, portMode_t mode, portOptions_t options, ui
|
|||
((options & SERIAL_INVERTED) || (options & SERIAL_BIDIR_PP)) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP
|
||||
);
|
||||
|
||||
IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TXRX, index);
|
||||
IOInit(tx, OWNER_SERIAL_TX, index);
|
||||
IOConfigGPIOAF(tx, ioCfg, af);
|
||||
|
||||
if (!(options & SERIAL_INVERTED))
|
||||
|
@ -129,12 +129,12 @@ void serialUARTInit(IO_t tx, IO_t rx, portMode_t mode, portOptions_t options, ui
|
|||
} else {
|
||||
ioConfig_t ioCfg = IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, (options & SERIAL_INVERTED) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP);
|
||||
if (mode & MODE_TX) {
|
||||
IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TX, index);
|
||||
IOInit(tx, OWNER_SERIAL_TX, index);
|
||||
IOConfigGPIOAF(tx, ioCfg, af);
|
||||
}
|
||||
|
||||
if (mode & MODE_RX) {
|
||||
IOInit(rx, OWNER_SERIAL, RESOURCE_UART_RX, index);
|
||||
IOInit(rx, OWNER_SERIAL_RX, index);
|
||||
IOConfigGPIOAF(rx, ioCfg, af);
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,7 @@ uartPort_t *serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t option
|
|||
s->USARTx = USART1;
|
||||
|
||||
#ifdef USE_UART1_RX_DMA
|
||||
dmaInit(DMA1_CH5_HANDLER, OWNER_SERIAL, 1);
|
||||
s->rxDMAChannel = DMA1_Channel5;
|
||||
s->rxDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->RDR;
|
||||
#endif
|
||||
|
@ -177,6 +178,7 @@ uartPort_t *serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t option
|
|||
serialUARTInit(IOGetByTag(IO_TAG(UART1_TX_PIN)), IOGetByTag(IO_TAG(UART1_RX_PIN)), mode, options, GPIO_AF_7, 1);
|
||||
|
||||
#ifdef USE_UART1_TX_DMA
|
||||
dmaInit(DMA1_CH4_HANDLER, OWNER_SERIAL, 1);
|
||||
dmaSetHandler(DMA1_CH4_HANDLER, handleUsartTxDma, NVIC_PRIO_SERIALUART1_TXDMA, (uint32_t)&uartPort1);
|
||||
#endif
|
||||
|
||||
|
@ -214,10 +216,12 @@ uartPort_t *serialUART2(uint32_t baudRate, portMode_t mode, portOptions_t option
|
|||
s->USARTx = USART2;
|
||||
|
||||
#ifdef USE_UART2_RX_DMA
|
||||
dmaInit(DMA1_CH6_HANDLER, OWNER_SERIAL, 2);
|
||||
s->rxDMAChannel = DMA1_Channel6;
|
||||
s->rxDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->RDR;
|
||||
#endif
|
||||
#ifdef USE_UART2_TX_DMA
|
||||
dmaInit(DMA1_CH7_HANDLER, OWNER_SERIAL, 2);
|
||||
s->txDMAChannel = DMA1_Channel7;
|
||||
s->txDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->TDR;
|
||||
#endif
|
||||
|
@ -269,10 +273,12 @@ uartPort_t *serialUART3(uint32_t baudRate, portMode_t mode, portOptions_t option
|
|||
s->USARTx = USART3;
|
||||
|
||||
#ifdef USE_UART3_RX_DMA
|
||||
dmaInit(DMA1_CH3_HANDLER, OWNER_SERIAL, 3);
|
||||
s->rxDMAChannel = DMA1_Channel3;
|
||||
s->rxDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->RDR;
|
||||
#endif
|
||||
#ifdef USE_UART3_TX_DMA
|
||||
dmaInit(DMA1_CH2_HANDLER, OWNER_SERIAL, 3);
|
||||
s->txDMAChannel = DMA1_Channel2;
|
||||
s->txDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->TDR;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue