NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
serial_uart_impl.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Ninjaflight is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 // device specific uart implementation is defined here
21 
22 typedef struct {
24 
27 
28  uint32_t rxDMAIrq;
29  uint32_t txDMAIrq;
30 
31  uint32_t rxDMAPos;
32  bool txDMAEmpty;
33 
36 
38 } uartPort_t;
39 
40 
41 
42 void uartStartTxDMA(uartPort_t *s);
43 
44 uartPort_t *serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t options);
45 uartPort_t *serialUART2(uint32_t baudRate, portMode_t mode, portOptions_t options);
46 uartPort_t *serialUART3(uint32_t baudRate, portMode_t mode, portOptions_t options);
47 uartPort_t *serialUART4(uint32_t baudRate, portMode_t mode, portOptions_t options);
48 uartPort_t *serialUART5(uint32_t baudRate, portMode_t mode, portOptions_t options);
49 
struct USART_Struct USART_TypeDef
Definition: platform.h:63
uartPort_t * serialUART2(uint32_t baudRate, portMode_t mode, portOptions_t options)
uartPort_t * serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t options)
uint32_t rxDMAIrq
Definition: serial_uart_impl.h:28
USART_TypeDef * USARTx
Definition: serial_uart_impl.h:37
uint32_t txDMAIrq
Definition: serial_uart_impl.h:29
uint8_t mode
Definition: gimbal.h:49
Definition: serial_uart_impl.h:22
uartPort_t * serialUART5(uint32_t baudRate, portMode_t mode, portOptions_t options)
bool txDMAEmpty
Definition: serial_uart_impl.h:32
portMode_t
Definition: serial.h:24
uint32_t txDMAPeripheralBaseAddr
Definition: serial_uart_impl.h:34
uartPort_t * serialUART4(uint32_t baudRate, portMode_t mode, portOptions_t options)
portOptions_t
Definition: serial.h:30
DMA_Channel_TypeDef * rxDMAChannel
Definition: serial_uart_impl.h:25
uint32_t rxDMAPos
Definition: serial_uart_impl.h:31
uint32_t rxDMAPeripheralBaseAddr
Definition: serial_uart_impl.h:35
void uartStartTxDMA(uartPort_t *s)
Definition: serial_uart.c:120
serialPort_t port
Definition: serial_uart_impl.h:23
Definition: platform.h:58
uartPort_t * serialUART3(uint32_t baudRate, portMode_t mode, portOptions_t options)
DMA_Channel_TypeDef * txDMAChannel
Definition: serial_uart_impl.h:26
Definition: serial.h:43