mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
CC3D - Adding USB Virtual COM port suport.
You can now connect the configurator via the USB port.
This commit is contained in:
parent
3916e5f2b5
commit
5760519a03
5 changed files with 54 additions and 21 deletions
|
@ -106,12 +106,18 @@ const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
|
|||
|
||||
#ifdef CC3D
|
||||
static serialPortFunction_t serialPortFunctions[SERIAL_PORT_COUNT] = {
|
||||
#ifdef USE_VCP
|
||||
{SERIAL_PORT_USB_VCP, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||
#endif
|
||||
{SERIAL_PORT_USART1, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||
{SERIAL_PORT_USART3, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||
{SERIAL_PORT_SOFTSERIAL1, NULL, SCENARIO_UNUSED, FUNCTION_NONE}
|
||||
};
|
||||
|
||||
const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
|
||||
#ifdef USE_VCP
|
||||
{SERIAL_PORT_USB_VCP, 9600, 115200, SPF_NONE },
|
||||
#endif
|
||||
{SERIAL_PORT_USART1, 9600, 115200, SPF_NONE | SPF_SUPPORTS_SBUS_MODE | SPF_SUPPORTS_BIDIR_MODE},
|
||||
{SERIAL_PORT_USART3, 9600, 115200, SPF_SUPPORTS_CALLBACK | SPF_SUPPORTS_SBUS_MODE | SPF_SUPPORTS_BIDIR_MODE},
|
||||
{SERIAL_PORT_SOFTSERIAL1, 9600, 19200, SPF_SUPPORTS_CALLBACK | SPF_IS_SOFTWARE_INVERTABLE}
|
||||
|
|
|
@ -60,10 +60,11 @@
|
|||
#define BEEPER
|
||||
#define DISPLAY
|
||||
|
||||
#define USE_VCP
|
||||
#define USE_USART1
|
||||
#define USE_USART3
|
||||
#define USE_SOFTSERIAL1
|
||||
#define SERIAL_PORT_COUNT 3
|
||||
#define SERIAL_PORT_COUNT 4
|
||||
|
||||
#define SOFTSERIAL_1_TIMER TIM3
|
||||
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 1 // PWM 2
|
||||
|
|
|
@ -92,11 +92,11 @@ void Set_System(void)
|
|||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; // HJI
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // HJI
|
||||
#else
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); // HJI
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); // HJI
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;// HJI
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;// HJI
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;// HJI
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;// HJI
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;// HJI
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;// HJI
|
||||
#endif
|
||||
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure); // HJI
|
||||
|
@ -123,6 +123,13 @@ void Set_System(void)
|
|||
GPIO_PinAFConfig(GPIOA, GPIO_PinSource12, GPIO_AF_14);
|
||||
|
||||
#endif /* STM32F37X && STM32F303xC)*/
|
||||
#if defined(STM32F10X)
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
/* Configure the EXTI line 18 connected internally to the USB IP */
|
||||
EXTI_ClearITPendingBit(EXTI_Line18);
|
||||
|
|
|
@ -32,7 +32,13 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
//#include "platform_config.h"
|
||||
#include "usb_type.h"
|
||||
#ifdef STM32F303
|
||||
#include "stm32f30x.h"
|
||||
#endif
|
||||
|
||||
#ifdef STM32F10X
|
||||
#include "stm32f10x.h"
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue