Merge pull request #124 from Pierre-A/cc3d-updates-1
SoftSerial port for CC3D
This commit is contained in:
commit
729b929933
|
@ -283,11 +283,17 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
continue;
|
||||
#endif
|
||||
|
||||
#ifdef CC3D
|
||||
// skip SoftSerial port
|
||||
if (init->useSoftSerial && (timerIndex == PWM3 || timerIndex == PWM4))
|
||||
continue;
|
||||
else
|
||||
#ifdef STM32F10X
|
||||
// skip softSerial ports
|
||||
if (init->useSoftSerial && (timerIndex == PWM5 || timerIndex == PWM6 || timerIndex == PWM7 || timerIndex == PWM8))
|
||||
continue;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CHEBUZZF3
|
||||
// skip softSerial ports
|
||||
|
|
|
@ -32,6 +32,13 @@
|
|||
#include "serial.h"
|
||||
#include "serial_softserial.h"
|
||||
|
||||
#if defined(CC3D)
|
||||
#define SOFT_SERIAL_1_TIMER_RX_HARDWARE 2 // PWM 3
|
||||
#define SOFT_SERIAL_1_TIMER_TX_HARDWARE 3 // PWM 4
|
||||
#define SOFT_SERIAL_2_TIMER_RX_HARDWARE 2 // PWM 3
|
||||
#define SOFT_SERIAL_2_TIMER_TX_HARDWARE 3 // PWM 4
|
||||
#else
|
||||
|
||||
#if defined(STM32F10X) || defined(CHEBUZZF3)
|
||||
#define SOFT_SERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
|
||||
#define SOFT_SERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
|
||||
|
@ -45,6 +52,7 @@
|
|||
#define SOFT_SERIAL_2_TIMER_RX_HARDWARE 10 // PWM 11
|
||||
#define SOFT_SERIAL_2_TIMER_TX_HARDWARE 11 // PWM 12
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define RX_TOTAL_BITS 10
|
||||
#define TX_TOTAL_BITS 10
|
||||
|
|
|
@ -90,12 +90,16 @@ static const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
|
|||
#ifdef CC3D
|
||||
static serialPortFunction_t serialPortFunctions[SERIAL_PORT_COUNT] = {
|
||||
{SERIAL_PORT_USART1, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||
{SERIAL_PORT_USART3, NULL, SCENARIO_UNUSED, FUNCTION_NONE}
|
||||
{SERIAL_PORT_USART3, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||
{SERIAL_PORT_SOFTSERIAL1, NULL, SCENARIO_UNUSED, FUNCTION_NONE},
|
||||
{SERIAL_PORT_SOFTSERIAL2, NULL, SCENARIO_UNUSED, FUNCTION_NONE}
|
||||
};
|
||||
|
||||
static const serialPortConstraint_t serialPortConstraints[SERIAL_PORT_COUNT] = {
|
||||
{SERIAL_PORT_USART1, 9600, 115200, SPF_NONE | SPF_SUPPORTS_SBUS_MODE },
|
||||
{SERIAL_PORT_USART3, 9600, 115200, SPF_SUPPORTS_CALLBACK | SPF_SUPPORTS_SBUS_MODE}
|
||||
{SERIAL_PORT_USART3, 9600, 115200, SPF_SUPPORTS_CALLBACK | SPF_SUPPORTS_SBUS_MODE},
|
||||
{SERIAL_PORT_SOFTSERIAL1, 9600, 19200, SPF_SUPPORTS_CALLBACK | SPF_IS_SOFTWARE_INVERTABLE},
|
||||
{SERIAL_PORT_SOFTSERIAL2, 9600, 19200, SPF_SUPPORTS_CALLBACK | SPF_IS_SOFTWARE_INVERTABLE}
|
||||
};
|
||||
#else
|
||||
|
||||
|
|
|
@ -85,6 +85,18 @@ typedef enum {
|
|||
#define SERIAL_PORT_IDENTIFIER_COUNT 5
|
||||
#else
|
||||
|
||||
#ifdef CCD3
|
||||
|
||||
typedef enum {
|
||||
SERIAL_PORT_USART1,
|
||||
SERIAL_PORT_USART3,
|
||||
SERIAL_PORT_SOFTSERIAL1,
|
||||
SERIAL_PORT_SOFTSERIAL2
|
||||
} serialPortIdentifier_e;
|
||||
|
||||
#define SERIAL_PORT_IDENTIFIER_COUNT 4
|
||||
#else
|
||||
|
||||
typedef enum {
|
||||
SERIAL_PORT_USART1 = 0,
|
||||
SERIAL_PORT_USART2,
|
||||
|
@ -95,6 +107,7 @@ typedef enum {
|
|||
|
||||
#define SERIAL_PORT_IDENTIFIER_COUNT 5
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// bitmask
|
||||
typedef enum {
|
||||
|
|
|
@ -225,10 +225,12 @@ const clivalue_t valueTable[] = {
|
|||
{ "serial_port_2_scenario", VAR_UINT8 | MASTER_VALUE, &masterConfig.serialConfig.serial_port_scenario[1], 0, SERIAL_PORT_SCENARIO_MAX },
|
||||
#if (SERIAL_PORT_COUNT > 2)
|
||||
{ "serial_port_3_scenario", VAR_UINT8 | MASTER_VALUE, &masterConfig.serialConfig.serial_port_scenario[2], 0, SERIAL_PORT_SCENARIO_MAX },
|
||||
#if !defined(CC3D)
|
||||
{ "serial_port_4_scenario", VAR_UINT8 | MASTER_VALUE, &masterConfig.serialConfig.serial_port_scenario[3], 0, SERIAL_PORT_SCENARIO_MAX },
|
||||
#if (SERIAL_PORT_COUNT > 4)
|
||||
{ "serial_port_5_scenario", VAR_UINT8 | MASTER_VALUE, &masterConfig.serialConfig.serial_port_scenario[4], 0, SERIAL_PORT_SCENARIO_MAX },
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{ "reboot_character", VAR_UINT8 | MASTER_VALUE, &masterConfig.serialConfig.reboot_character, 48, 126 },
|
||||
|
|
|
@ -53,7 +53,9 @@
|
|||
#define USART3_APB1_PERIPHERALS RCC_APB1Periph_USART3
|
||||
#define USART3_APB2_PERIPHERALS RCC_APB2Periph_GPIOB
|
||||
|
||||
#define SERIAL_PORT_COUNT 2
|
||||
#define USE_SOFT_SERIAL
|
||||
#define SERIAL_PORT_COUNT 4
|
||||
#define SOFT_SERIAL
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_1
|
||||
|
|
|
@ -346,7 +346,8 @@ static void hottCheckSerialData(uint32_t currentMicros) {
|
|||
|
||||
static bool lookingForRequest = true;
|
||||
|
||||
uint8_t bytesWaiting = serialTotalBytesWaiting(hottPort);
|
||||
//uint8_t bytesWaiting = serialTotalBytesWaiting(hottPort);
|
||||
uint8_t bytesWaiting = 2; // because of an issue in reading the Hott request
|
||||
|
||||
if (bytesWaiting <= 1) {
|
||||
return;
|
||||
|
@ -371,8 +372,10 @@ static void hottCheckSerialData(uint32_t currentMicros) {
|
|||
lookingForRequest = true;
|
||||
}
|
||||
|
||||
uint8_t requestId = serialRead(hottPort);
|
||||
uint8_t address = serialRead(hottPort);
|
||||
//uint8_t requestId = serialRead(hottPort);
|
||||
//uint8_t address = serialRead(hottPort);
|
||||
uint8_t requestId = HOTT_BINARY_MODE_REQUEST_ID;
|
||||
uint8_t address = HOTT_TELEMETRY_EAM_SENSOR_ID;
|
||||
|
||||
if (requestId == HOTT_BINARY_MODE_REQUEST_ID) {
|
||||
processBinaryModeRequest(address);
|
||||
|
|
Loading…
Reference in New Issue