Merge pull request #10558 from iNavFlight/MrD_Correct-comments-on-OSD-symbols
[inav.git] / src / main / drivers / serial_usb_vcp_at32f43x.h
blob13ce455fa10450a473f2bee366ca7785deda199c
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight 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.
9 * Cleanflight 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.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 typedef struct {
21 serialPort_t port;
23 // Buffer used during bulk writes.
24 uint8_t txBuf[20];
25 uint8_t txAt;
26 // Set if the port is in bulk write mode and can buffer.
27 bool buffering;
28 } vcpPort_t;
30 #define APP_TX_DATA_SIZE 2048
31 #define APP_TX_BLOCK_SIZE 512
33 volatile uint8_t UserTxBuffer[APP_TX_DATA_SIZE];/* Received Data over UART (CDC interface) are stored in this buffer */
34 uint32_t BuffLength;
35 volatile uint32_t UserTxBufPtrIn = 0;/* Increment this pointer or roll it back to
36 start address when data are received over USART */
37 volatile uint32_t UserTxBufPtrOut = 0; /* Increment this pointer or roll it back to
38 start address when data are sent over USB */
39 tmr_type * usbTxTmr= TMR20;
40 #define CDC_POLLING_INTERVAL 50
43 APP RX is the circular buffer for data that is transmitted from the APP (host)
44 to the USB device (flight controller).
46 #define APP_RX_DATA_SIZE 2048
47 static uint8_t APP_Rx_Buffer[APP_RX_DATA_SIZE]; //rx buffer,convert usb read to the usbvcpRead
48 static uint32_t APP_Rx_ptr_out = 0; //serail read out, back pointer
49 static uint32_t APP_Rx_ptr_in = 0; //usb Read in, front pointer
51 void usbVcpInitHardware(void);
52 serialPort_t *usbVcpOpen(void);
53 struct serialPort_s;
54 uint32_t usbVcpGetBaudRate(struct serialPort_s *instance);