Merge with latest 2.3

This commit is contained in:
Bertrand Songis
2020-03-05 10:43:01 +01:00
144 changed files with 3009 additions and 1035 deletions
@@ -24,13 +24,15 @@
// not needed
#elif defined(RADIO_T16)
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, 1,1,1, -1,1, -1,1};
#elif defined(RADIO_TX16S)
const int8_t adcDirection[NUM_ANALOGS] = {-1,1,-1,1, 1,1,1, -1,1, -1,1};
#elif defined(PCBX10)
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,1, 1, -1};
#elif defined(PCBX9E)
#if defined(HORUS_STICKS)
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,-1,1, -1,1,-1, -1,-1,-1};
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1, -1,-1,-1};
#else
const int8_t adcDirection[NUM_ANALOGS] = {1,1,-1,-1, -1,-1,-1,1, -1,1,-1, -1,-1,-1};
const int8_t adcDirection[NUM_ANALOGS] = {1,1,-1,-1, -1,-1,-1,1, -1,1,1, -1,-1,-1};
#endif
const uint8_t adcMapping[NUM_ANALOGS] = { 0 /*STICK1*/, 1 /*STICK2*/, 2 /*STICK3*/, 3 /*STICK4*/,
11 /*POT1*/, 4 /*POT2*/, 5 /*POT3*/, 6 /*POT4*/,
@@ -19,6 +19,7 @@
*/
#include "opentx.h"
#include "targets/horus/board.h"
uint8_t auxSerialMode = 0;
Fifo<uint8_t, 512> auxSerialTxFifo;
@@ -44,6 +45,13 @@ void auxSerialSetup(unsigned int baudrate, bool dma)
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(AUX_SERIAL_GPIO, &GPIO_InitStructure);
#if defined(AUX_SERIAL_PWR_GPIO)
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = AUX_SERIAL_PWR_GPIO_PIN;
GPIO_Init(AUX_SERIAL_PWR_GPIO, &GPIO_InitStructure);
#endif
USART_InitStructure.USART_BaudRate = baudrate;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
@@ -154,6 +162,7 @@ void auxSerialSbusInit()
{
auxSerialSetup(SBUS_BAUDRATE, true);
AUX_SERIAL_USART->CR1 |= USART_CR1_M | USART_CR1_PCE ;
AUX_SERIAL_POWER_ON();
}
void auxSerialStop()
@@ -122,11 +122,20 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
../../../../../syscalls.c
)
if(USB_CHARGER)
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
../../../../../targets/${TARGET_DIR}/usb_charger_driver.cpp
../../../../../targets/${TARGET_DIR}/led_driver.cpp
)
endif()
if(DEBUG)
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
../../../../../${STM32LIB_DIR}/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c
../../../../../serial.cpp
../../../../../targets/common/arm/stm32/aux_serial_driver.cpp
)
endif()
else()
@@ -205,11 +205,26 @@ int main()
AUX_SERIAL_RCC_APB1Periph |
SD_RCC_APB1Periph, ENABLE);
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph | BACKLIGHT_RCC_APB2Periph | RCC_APB2Periph_SYSCFG, ENABLE);
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph | BACKLIGHT_RCC_APB2Periph | RCC_APB2Periph_SYSCFG | AUX_SERIAL_RCC_APB2Periph, ENABLE);
pwrInit();
keysInit();
// USB charger handling
#if defined(USB_CHARGER)
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE() && !pwrPressed()) {
ledInit();
usbChargerInit();
ledOff();
while (!pwrPressed()) {
if(usbChargerLed())
GPIO_SetBits(LED_GPIO, LED_GREEN_GPIO_PIN);
else
ledOff();
}
}
#endif
// wait a bit for the inputs to stabilize...
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
for (uint32_t i = 0; i < 150000; i++) {
@@ -54,9 +54,11 @@ void pwrInit()
#if defined(PCBREV_HARDCODED)
hardwareOptions.pcbrev = PCBREV_HARDCODED;
#elif defined(PCBREV_GPIO_PIN)
GPIO_ResetBits(PCBREV_GPIO, PCBREV_GPIO_PIN);
#if defined(PCBREV_GPIO_PULL_DOWN)
GPIO_ResetBits(PCBREV_GPIO, PCBREV_GPIO_PIN);
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
#endif
GPIO_InitStructure.GPIO_Pin = PCBREV_GPIO_PIN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(PCBREV_GPIO, &GPIO_InitStructure);
hardwareOptions.pcbrev = PCBREV_VALUE();
#endif
@@ -71,7 +71,7 @@ void rotaryEncoderInit()
void rotaryEncoderCheck()
{
#if defined(RADIO_T16)
#if defined(RADIO_FAMILY_T16)
static uint8_t state = 0;
uint8_t pins = ROTARY_ENCODER_POSITION();