Merge branch 'next' into kilrah/extratrims
This commit is contained in:
@@ -178,6 +178,7 @@ void adcRead()
|
||||
ADC_CS_HIGH();
|
||||
delay_01us(1);
|
||||
|
||||
DEBUG_TIMER_START(debugTimerAdcLoop);
|
||||
for (uint32_t adcIndex=0; adcIndex<MOUSE1; adcIndex++) {
|
||||
// MUX is changed to the channel that was sent in the previous command
|
||||
// but the data is from the old MUX position
|
||||
@@ -211,12 +212,15 @@ void adcRead()
|
||||
ADC_CS_HIGH();
|
||||
delay_01us(1);
|
||||
}
|
||||
DEBUG_TIMER_STOP(debugTimerAdcLoop);
|
||||
|
||||
DEBUG_TIMER_START(debugTimerAdcWait);
|
||||
for (uint32_t i=0; i<20000; i++) {
|
||||
if (DMA2->LISR & DMA_LISR_TCIF1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUG_TIMER_STOP(debugTimerAdcWait);
|
||||
|
||||
// On chip ADC read should have finished
|
||||
}
|
||||
|
||||
@@ -396,15 +396,15 @@ void audioConsumeCurrentBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
bool audioPushBuffer(AudioBuffer * buffer)
|
||||
void audioPushBuffer(AudioBuffer * buffer)
|
||||
{
|
||||
if (!currentBuffer) {
|
||||
buffer->state = AUDIO_BUFFER_PLAYING;
|
||||
audioSetCurrentBuffer(buffer);
|
||||
audioConsumeCurrentBuffer();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
buffer->state = AUDIO_BUFFER_FILLED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,274 +1,274 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
}
|
||||
#endif
|
||||
|
||||
void watchdogInit(unsigned int duration)
|
||||
{
|
||||
IWDG->KR = 0x5555 ; // Unlock registers
|
||||
IWDG->PR = 3 ; // Divide by 32 => 1kHz clock
|
||||
IWDG->KR = 0x5555 ; // Unlock registers
|
||||
IWDG->RLR = duration ; // 1.5 seconds nominal
|
||||
IWDG->KR = 0xAAAA ; // reload
|
||||
IWDG->KR = 0xCCCC ; // start
|
||||
}
|
||||
|
||||
void getCPUUniqueID(char * s)
|
||||
{
|
||||
uint32_t * cpu_uid = (uint32_t *)0x1FFF7A10;
|
||||
char * tmp = strAppendUnsigned(s, cpu_uid[0], 8, 16);
|
||||
*tmp = ' ';
|
||||
tmp = strAppendUnsigned(tmp+1, cpu_uid[1], 8, 16);
|
||||
*tmp = ' ';
|
||||
strAppendUnsigned(tmp+1, cpu_uid[2], 8, 16);
|
||||
}
|
||||
|
||||
// Start TIMER7 at 2000000Hz
|
||||
void init2MhzTimer()
|
||||
{
|
||||
TIMER_2MHz_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5 uS, 2 MHz
|
||||
TIMER_2MHz_TIMER->ARR = 65535;
|
||||
TIMER_2MHz_TIMER->CR2 = 0;
|
||||
TIMER_2MHz_TIMER->CR1 = TIM_CR1_CEN;
|
||||
}
|
||||
|
||||
// Starts TIMER at 200Hz, 5mS period
|
||||
void init5msTimer()
|
||||
{
|
||||
INTERRUPT_5MS_TIMER->ARR = 999 ; // 1mS
|
||||
INTERRUPT_5MS_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 1000000 - 1 ; // 1uS from 30MHz
|
||||
INTERRUPT_5MS_TIMER->CCER = 0 ;
|
||||
INTERRUPT_5MS_TIMER->CCMR1 = 0 ;
|
||||
INTERRUPT_5MS_TIMER->EGR = 0 ;
|
||||
INTERRUPT_5MS_TIMER->CR1 = 5 ;
|
||||
INTERRUPT_5MS_TIMER->DIER |= 1 ;
|
||||
NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn) ;
|
||||
NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, 7);
|
||||
}
|
||||
|
||||
void stop5msTimer( void )
|
||||
{
|
||||
TIM14->CR1 = 0 ; // stop timer
|
||||
NVIC_DisableIRQ(TIM8_TRG_COM_TIM14_IRQn) ;
|
||||
RCC->APB1ENR &= ~RCC_APB1ENR_TIM14EN ; // Disable clock
|
||||
}
|
||||
|
||||
// TODO use the same than board_sky9x.cpp
|
||||
void interrupt5ms()
|
||||
{
|
||||
static uint32_t pre_scale ; // Used to get 10 Hz counter
|
||||
|
||||
++pre_scale;
|
||||
|
||||
if (pre_scale == 5 || pre_scale == 10) {
|
||||
|
||||
#if defined(HAPTIC)
|
||||
HAPTIC_HEARTBEAT();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if ( pre_scale == 10 ) {
|
||||
pre_scale = 0 ;
|
||||
per10ms();
|
||||
}
|
||||
|
||||
checkRotaryEncoder();
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
||||
{
|
||||
TIM14->SR &= ~TIM_SR_UIF ;
|
||||
interrupt5ms() ;
|
||||
}
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph |
|
||||
LED_RCC_AHB1Periph |
|
||||
LCD_RCC_AHB1Periph |
|
||||
AUDIO_RCC_AHB1Periph |
|
||||
KEYS_RCC_AHB1Periph_GPIO |
|
||||
ADC_RCC_AHB1Periph |
|
||||
SERIAL_RCC_AHB1Periph |
|
||||
TELEMETRY_RCC_AHB1Periph |
|
||||
AUDIO_RCC_AHB1Periph |
|
||||
HAPTIC_RCC_AHB1Periph |
|
||||
INTMODULE_RCC_AHB1Periph |
|
||||
EXTMODULE_RCC_AHB1Periph,
|
||||
ENABLE);
|
||||
RCC_APB1PeriphClockCmd(INTERRUPT_5MS_APB1Periph |
|
||||
TIMER_2MHz_APB1Periph |
|
||||
AUDIO_RCC_APB1Periph |
|
||||
SERIAL_RCC_APB1Periph |
|
||||
TELEMETRY_RCC_APB1Periph |
|
||||
AUDIO_RCC_APB1Periph |
|
||||
EXTMODULE_RCC_APB1Periph,
|
||||
ENABLE);
|
||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph |
|
||||
ADC_RCC_APB2Periph |
|
||||
HAPTIC_RCC_APB2Periph |
|
||||
INTMODULE_RCC_APB2Periph |
|
||||
EXTMODULE_RCC_APB2Periph, ENABLE);
|
||||
|
||||
pwrInit();
|
||||
delaysInit();
|
||||
|
||||
// FrSky removed the volume chip in latest board, that's why it doesn't answer!
|
||||
// i2cInit();
|
||||
|
||||
serial2Init(0, 0); // default serial mode (None if DEBUG not defined)
|
||||
|
||||
__enable_irq();
|
||||
|
||||
TRACE("Horus started :)");
|
||||
|
||||
keysInit();
|
||||
adcInit();
|
||||
lcdInit();
|
||||
audioInit();
|
||||
init2MhzTimer();
|
||||
init5msTimer();
|
||||
usbInit();
|
||||
hapticInit();
|
||||
|
||||
// bt_open();
|
||||
|
||||
#if defined(DEBUG)
|
||||
DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP|DBGMCU_TIM1_STOP|DBGMCU_TIM2_STOP|DBGMCU_TIM3_STOP|DBGMCU_TIM4_STOP|DBGMCU_TIM5_STOP|DBGMCU_TIM6_STOP|DBGMCU_TIM7_STOP|DBGMCU_TIM8_STOP|DBGMCU_TIM9_STOP|DBGMCU_TIM10_STOP|DBGMCU_TIM11_STOP|DBGMCU_TIM12_STOP|DBGMCU_TIM13_STOP|DBGMCU_TIM14_STOP, ENABLE);
|
||||
#endif
|
||||
|
||||
ledBlue();
|
||||
}
|
||||
|
||||
void boardOff()
|
||||
{
|
||||
BACKLIGHT_OFF();
|
||||
|
||||
while (pwrPressed()) {
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
SysTick->CTRL = 0; // turn off systick
|
||||
pwrOff();
|
||||
}
|
||||
|
||||
#endif // #if !defined(SIMU)
|
||||
|
||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
|
||||
/*
|
||||
Prepare and send new USB data packet
|
||||
|
||||
The format of HID_Buffer is defined by
|
||||
USB endpoint description can be found in
|
||||
file usb_hid_joystick.c, variable HID_JOYSTICK_ReportDesc
|
||||
*/
|
||||
void usbJoystickUpdate(void)
|
||||
{
|
||||
static uint8_t HID_Buffer[HID_IN_PACKET];
|
||||
|
||||
//buttons
|
||||
HID_Buffer[0] = 0; //buttons
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if ( channelOutputs[i+8] > 0 ) {
|
||||
HID_Buffer[0] |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
//analog values
|
||||
//uint8_t * p = HID_Buffer + 1;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
int16_t value = channelOutputs[i] / 8;
|
||||
if ( value > 127 ) value = 127;
|
||||
else if ( value < -127 ) value = -127;
|
||||
HID_Buffer[i+1] = static_cast<int8_t>(value);
|
||||
}
|
||||
|
||||
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
|
||||
}
|
||||
|
||||
#endif //#if defined(USB_JOYSTICK) && defined(PCBTARANIS) && !defined(SIMU)
|
||||
|
||||
|
||||
uint8_t currentTrainerMode = 0xff;
|
||||
|
||||
void checkTrainerSettings()
|
||||
{
|
||||
uint8_t requiredTrainerMode = g_model.trainerMode;
|
||||
if (requiredTrainerMode != currentTrainerMode) {
|
||||
switch (currentTrainerMode) {
|
||||
case TRAINER_MODE_MASTER_TRAINER_JACK:
|
||||
stop_trainer_capture();
|
||||
break;
|
||||
case TRAINER_MODE_SLAVE:
|
||||
stop_trainer_ppm();
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE:
|
||||
stop_cppm_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
|
||||
stop_sbus_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
||||
serial2Stop();
|
||||
}
|
||||
|
||||
currentTrainerMode = requiredTrainerMode;
|
||||
switch (requiredTrainerMode) {
|
||||
case TRAINER_MODE_SLAVE:
|
||||
init_trainer_ppm();
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE:
|
||||
init_cppm_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
|
||||
init_sbus_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
||||
if (g_eeGeneral.serial2Mode == UART_MODE_SBUS_TRAINER) {
|
||||
serial2SbusInit();
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
default:
|
||||
// master is default
|
||||
init_trainer_capture();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t getBatteryVoltage()
|
||||
{
|
||||
int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose
|
||||
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration) ) / 1629);
|
||||
}
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
}
|
||||
#endif
|
||||
|
||||
void watchdogInit(unsigned int duration)
|
||||
{
|
||||
IWDG->KR = 0x5555 ; // Unlock registers
|
||||
IWDG->PR = 3 ; // Divide by 32 => 1kHz clock
|
||||
IWDG->KR = 0x5555 ; // Unlock registers
|
||||
IWDG->RLR = duration ; // 1.5 seconds nominal
|
||||
IWDG->KR = 0xAAAA ; // reload
|
||||
IWDG->KR = 0xCCCC ; // start
|
||||
}
|
||||
|
||||
void getCPUUniqueID(char * s)
|
||||
{
|
||||
uint32_t * cpu_uid = (uint32_t *)0x1FFF7A10;
|
||||
char * tmp = strAppendUnsigned(s, cpu_uid[0], 8, 16);
|
||||
*tmp = ' ';
|
||||
tmp = strAppendUnsigned(tmp+1, cpu_uid[1], 8, 16);
|
||||
*tmp = ' ';
|
||||
strAppendUnsigned(tmp+1, cpu_uid[2], 8, 16);
|
||||
}
|
||||
|
||||
// Start TIMER7 at 2000000Hz
|
||||
void init2MhzTimer()
|
||||
{
|
||||
TIMER_2MHz_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5 uS, 2 MHz
|
||||
TIMER_2MHz_TIMER->ARR = 65535;
|
||||
TIMER_2MHz_TIMER->CR2 = 0;
|
||||
TIMER_2MHz_TIMER->CR1 = TIM_CR1_CEN;
|
||||
}
|
||||
|
||||
// Starts TIMER at 1000Hz
|
||||
void init1msTimer()
|
||||
{
|
||||
INTERRUPT_5MS_TIMER->ARR = 999 ; // 1mS
|
||||
INTERRUPT_5MS_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 1000000 - 1 ; // 1uS from 30MHz
|
||||
INTERRUPT_5MS_TIMER->CCER = 0 ;
|
||||
INTERRUPT_5MS_TIMER->CCMR1 = 0 ;
|
||||
INTERRUPT_5MS_TIMER->EGR = 0 ;
|
||||
INTERRUPT_5MS_TIMER->CR1 = 5 ;
|
||||
INTERRUPT_5MS_TIMER->DIER |= 1 ;
|
||||
NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn) ;
|
||||
NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, 7);
|
||||
}
|
||||
|
||||
// TODO use the same than board_sky9x.cpp
|
||||
void interrupt1ms()
|
||||
{
|
||||
static uint32_t pre_scale ; // Used to get 10 Hz counter
|
||||
|
||||
++pre_scale;
|
||||
|
||||
if (pre_scale == 5 || pre_scale == 10) {
|
||||
|
||||
#if defined(HAPTIC)
|
||||
DEBUG_TIMER_START(debugTimerHaptic);
|
||||
HAPTIC_HEARTBEAT();
|
||||
DEBUG_TIMER_STOP(debugTimerHaptic);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if ( pre_scale == 10 ) {
|
||||
pre_scale = 0 ;
|
||||
DEBUG_TIMER_START(debugTimerPer10ms);
|
||||
per10ms();
|
||||
DEBUG_TIMER_STOP(debugTimerPer10ms);
|
||||
}
|
||||
|
||||
DEBUG_TIMER_START(debugTimerRotEnc);
|
||||
checkRotaryEncoder();
|
||||
DEBUG_TIMER_STOP(debugTimerRotEnc);
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
||||
{
|
||||
TIM14->SR &= ~TIM_SR_UIF ;
|
||||
interrupt1ms() ;
|
||||
DEBUG_INTERRUPT(INT_1MS);
|
||||
}
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph |
|
||||
LED_RCC_AHB1Periph |
|
||||
LCD_RCC_AHB1Periph |
|
||||
AUDIO_RCC_AHB1Periph |
|
||||
KEYS_RCC_AHB1Periph_GPIO |
|
||||
ADC_RCC_AHB1Periph |
|
||||
SERIAL_RCC_AHB1Periph |
|
||||
TELEMETRY_RCC_AHB1Periph |
|
||||
AUDIO_RCC_AHB1Periph |
|
||||
HAPTIC_RCC_AHB1Periph |
|
||||
INTMODULE_RCC_AHB1Periph |
|
||||
EXTMODULE_RCC_AHB1Periph,
|
||||
ENABLE);
|
||||
RCC_APB1PeriphClockCmd(INTERRUPT_5MS_APB1Periph |
|
||||
TIMER_2MHz_APB1Periph |
|
||||
AUDIO_RCC_APB1Periph |
|
||||
SERIAL_RCC_APB1Periph |
|
||||
TELEMETRY_RCC_APB1Periph |
|
||||
AUDIO_RCC_APB1Periph |
|
||||
EXTMODULE_RCC_APB1Periph,
|
||||
ENABLE);
|
||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph |
|
||||
ADC_RCC_APB2Periph |
|
||||
HAPTIC_RCC_APB2Periph |
|
||||
INTMODULE_RCC_APB2Periph |
|
||||
EXTMODULE_RCC_APB2Periph, ENABLE);
|
||||
|
||||
pwrInit();
|
||||
delaysInit();
|
||||
|
||||
// FrSky removed the volume chip in latest board, that's why it doesn't answer!
|
||||
// i2cInit();
|
||||
|
||||
serial2Init(0, 0); // default serial mode (None if DEBUG not defined)
|
||||
|
||||
__enable_irq();
|
||||
|
||||
TRACE("Horus started :)");
|
||||
|
||||
keysInit();
|
||||
adcInit();
|
||||
lcdInit();
|
||||
audioInit();
|
||||
init2MhzTimer();
|
||||
init1msTimer();
|
||||
usbInit();
|
||||
hapticInit();
|
||||
|
||||
// bt_open();
|
||||
|
||||
#if defined(DEBUG)
|
||||
DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP|DBGMCU_TIM1_STOP|DBGMCU_TIM2_STOP|DBGMCU_TIM3_STOP|DBGMCU_TIM4_STOP|DBGMCU_TIM5_STOP|DBGMCU_TIM6_STOP|DBGMCU_TIM7_STOP|DBGMCU_TIM8_STOP|DBGMCU_TIM9_STOP|DBGMCU_TIM10_STOP|DBGMCU_TIM11_STOP|DBGMCU_TIM12_STOP|DBGMCU_TIM13_STOP|DBGMCU_TIM14_STOP, ENABLE);
|
||||
#endif
|
||||
|
||||
ledBlue();
|
||||
}
|
||||
|
||||
void boardOff()
|
||||
{
|
||||
BACKLIGHT_OFF();
|
||||
|
||||
while (pwrPressed()) {
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
SysTick->CTRL = 0; // turn off systick
|
||||
pwrOff();
|
||||
}
|
||||
|
||||
#endif // #if !defined(SIMU)
|
||||
|
||||
#if defined(USB_JOYSTICK) && !defined(SIMU)
|
||||
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
|
||||
/*
|
||||
Prepare and send new USB data packet
|
||||
|
||||
The format of HID_Buffer is defined by
|
||||
USB endpoint description can be found in
|
||||
file usb_hid_joystick.c, variable HID_JOYSTICK_ReportDesc
|
||||
*/
|
||||
void usbJoystickUpdate(void)
|
||||
{
|
||||
static uint8_t HID_Buffer[HID_IN_PACKET];
|
||||
|
||||
//buttons
|
||||
HID_Buffer[0] = 0; //buttons
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if ( channelOutputs[i+8] > 0 ) {
|
||||
HID_Buffer[0] |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
//analog values
|
||||
//uint8_t * p = HID_Buffer + 1;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
int16_t value = channelOutputs[i] / 8;
|
||||
if ( value > 127 ) value = 127;
|
||||
else if ( value < -127 ) value = -127;
|
||||
HID_Buffer[i+1] = static_cast<int8_t>(value);
|
||||
}
|
||||
|
||||
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
|
||||
}
|
||||
|
||||
#endif //#if defined(USB_JOYSTICK) && defined(PCBTARANIS) && !defined(SIMU)
|
||||
|
||||
|
||||
uint8_t currentTrainerMode = 0xff;
|
||||
|
||||
void checkTrainerSettings()
|
||||
{
|
||||
uint8_t requiredTrainerMode = g_model.trainerMode;
|
||||
if (requiredTrainerMode != currentTrainerMode) {
|
||||
switch (currentTrainerMode) {
|
||||
case TRAINER_MODE_MASTER_TRAINER_JACK:
|
||||
stop_trainer_capture();
|
||||
break;
|
||||
case TRAINER_MODE_SLAVE:
|
||||
stop_trainer_ppm();
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE:
|
||||
stop_cppm_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
|
||||
stop_sbus_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
||||
serial2Stop();
|
||||
}
|
||||
|
||||
currentTrainerMode = requiredTrainerMode;
|
||||
switch (requiredTrainerMode) {
|
||||
case TRAINER_MODE_SLAVE:
|
||||
init_trainer_ppm();
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE:
|
||||
init_cppm_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE:
|
||||
init_sbus_on_heartbeat_capture() ;
|
||||
break;
|
||||
case TRAINER_MODE_MASTER_BATTERY_COMPARTMENT:
|
||||
if (g_eeGeneral.serial2Mode == UART_MODE_SBUS_TRAINER) {
|
||||
serial2SbusInit();
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
default:
|
||||
// master is default
|
||||
init_trainer_capture();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t getBatteryVoltage()
|
||||
{
|
||||
int32_t instant_vbat = anaIn(TX_VOLTAGE); // using filtered ADC value on purpose
|
||||
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration) ) / 1629);
|
||||
}
|
||||
|
||||
@@ -272,11 +272,12 @@ void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t x, uint16_t y,
|
||||
void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format);
|
||||
void lcdStoreBackupBuffer(void);
|
||||
int lcdRestoreBackupBuffer(void);
|
||||
void LCD_ControlLight(uint16_t dutyCycle);
|
||||
|
||||
// Backlight driver
|
||||
#define setBacklight(xx)
|
||||
#define backlightEnable()
|
||||
#define backlightDisable()
|
||||
#define setBacklight(xx) LCD_ControlLight(xx)
|
||||
#define backlightEnable() setBacklight(UNEXPECTED_SHUTDOWN() ? 100 : 100-g_eeGeneral.backlightBright)
|
||||
#define backlightDisable() setBacklight(g_eeGeneral.blOffBright)
|
||||
#define isBacklightEnable() true
|
||||
|
||||
// USB driver
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../horus/board_horus.h"
|
||||
#include "board_horus.h"
|
||||
|
||||
void delaysInit(void)
|
||||
{
|
||||
|
||||
@@ -320,32 +320,33 @@ void LCD_LayerInit()
|
||||
|
||||
void LCD_ControlLight(uint16_t dutyCycle)
|
||||
{
|
||||
static uint16_t existingDutyCycle;
|
||||
|
||||
if (dutyCycle == existingDutyCycle || dutyCycle < 5) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
existingDutyCycle = dutyCycle;
|
||||
}
|
||||
|
||||
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
|
||||
TIM_OCInitTypeDef TIM_OCInitStructure;
|
||||
|
||||
uint16_t freq = LCD_BKLIGHT_PWM_FREQ;
|
||||
|
||||
uint32_t temp = 0;
|
||||
temp = 1000000 / freq - 1;
|
||||
|
||||
TIM_TimeBaseStructure.TIM_Prescaler = SystemCoreClock / 1000000 - 1 ;
|
||||
TIM_TimeBaseStructure.TIM_Prescaler = SystemCoreClock / 10000 - 1 ;//1KhZ
|
||||
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
TIM_TimeBaseStructure.TIM_Period = temp;
|
||||
TIM_TimeBaseStructure.TIM_Period = 100;
|
||||
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
|
||||
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
|
||||
|
||||
TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure);
|
||||
|
||||
unsigned long tempValue;
|
||||
tempValue = (unsigned long)divRoundClosest((temp+1)*(100-dutyCycle), dutyCycle);
|
||||
|
||||
TIM_Cmd(TIM8, DISABLE);
|
||||
|
||||
/* Channel 1 Configuration in PWM mode */
|
||||
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
|
||||
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
||||
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
|
||||
TIM_OCInitStructure.TIM_Pulse = (uint32_t)tempValue;
|
||||
TIM_OCInitStructure.TIM_Pulse = (100-dutyCycle);
|
||||
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
|
||||
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
|
||||
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
|
||||
|
||||
@@ -165,6 +165,7 @@ static void intmoduleNoneStop()
|
||||
#if !defined(SIMU)
|
||||
extern "C" void DMA2_Stream7_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_DMA2S7);
|
||||
if(DMA_GetITStatus(INTMODULE_DMA_STREAM, DMA_IT_TCIF7)) {
|
||||
// TODO we could send the 8 next channels here (when needed)
|
||||
DMA_ClearITPendingBit(INTMODULE_DMA_STREAM, DMA_IT_TCIF7);
|
||||
@@ -173,6 +174,9 @@ extern "C" void DMA2_Stream7_IRQHandler(void)
|
||||
|
||||
extern "C" void TIM1_CC_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TIM1CC);
|
||||
DEBUG_TIMER_SAMPLE(debugTimerIntPulses);
|
||||
DEBUG_TIMER_START(debugTimerIntPulsesDuration);
|
||||
INTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // stop this interrupt
|
||||
INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // clear flag
|
||||
|
||||
@@ -204,6 +208,7 @@ extern "C" void TIM1_CC_IRQHandler()
|
||||
}
|
||||
|
||||
INTMODULE_TIMER->DIER |= TIM_DIER_CC2IE;
|
||||
DEBUG_TIMER_STOP(debugTimerIntPulsesDuration);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -551,6 +556,7 @@ static void extmodulePpmStop()
|
||||
|
||||
extern "C" void TIM2_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TIM2);
|
||||
//determine if its CC or UP interrupt
|
||||
uint16_t sr = EXTMODULE_TIMER->SR;
|
||||
uint16_t dier = EXTMODULE_TIMER->DIER;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../horus/sdio_sd.h"
|
||||
|
||||
@@ -2776,11 +2776,13 @@ OPTIMIZE("O0") uint8_t convert_from_bytes_to_power_of_two(uint16_t NumberOfBytes
|
||||
|
||||
void SDIO_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_SDIO);
|
||||
SD_ProcessIRQ();
|
||||
}
|
||||
|
||||
void SD_SDIO_DMA_IRQHANDLER(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_SDIO_DMA);
|
||||
SD_ProcessDMAIRQ();
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,7 @@ uint8_t serial2TracesEnabled()
|
||||
#if !defined(SIMU)
|
||||
extern "C" void SERIAL_USART_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_SER2);
|
||||
// Send
|
||||
if (USART_GetITStatus(SERIAL_USART, USART_IT_TXE) != RESET) {
|
||||
uint8_t txchar;
|
||||
|
||||
@@ -136,6 +136,7 @@ void sportSendBuffer(uint8_t * buffer, uint32_t count)
|
||||
|
||||
extern "C" void TELEMETRY_DMA_TX_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TELEM_DMA);
|
||||
if (DMA_GetITStatus(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC)) {
|
||||
DMA_ClearITPendingBit(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC);
|
||||
telemetryPortSetDirectionInput();
|
||||
|
||||
@@ -103,6 +103,7 @@ void stop_trainer_capture()
|
||||
#if !defined(SIMU)
|
||||
extern "C" void TIM3_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TIM3);
|
||||
uint16_t capture = 0;
|
||||
bool doCapture = false;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "board_horus.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
|
||||
#include "debug.h"
|
||||
|
||||
int usbPlugged(void)
|
||||
{
|
||||
@@ -46,6 +47,7 @@ USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
|
||||
void OTG_FS_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_OTG_FS);
|
||||
USBD_OTG_ISR_Handler(&USB_OTG_dev);
|
||||
}
|
||||
|
||||
|
||||
@@ -416,9 +416,9 @@ struct SimulatorAudio {
|
||||
pthread_t threadPid;
|
||||
} simuAudio;
|
||||
|
||||
bool audioPushBuffer(AudioBuffer * buffer)
|
||||
void audioPushBuffer(AudioBuffer * buffer)
|
||||
{
|
||||
return false;
|
||||
buffer->state = AUDIO_BUFFER_FILLED;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -533,6 +533,8 @@ void * audioThread(void *)
|
||||
}
|
||||
SDL_PauseAudio(0);
|
||||
|
||||
referenceSystemAudioFiles();
|
||||
|
||||
while (simuAudio.threadRunning) {
|
||||
audioQueue.wakeup();
|
||||
sleep(1);
|
||||
@@ -1335,6 +1337,10 @@ uint8_t i2cReadBQ24195(uint8_t) { return 0; }
|
||||
void i2cWriteBQ24195(uint8_t, uint8_t) { }
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
void LCD_ControlLight(uint16_t dutyCycle) { }
|
||||
#endif
|
||||
|
||||
void serialPrintf(const char * format, ...) { }
|
||||
void serialCrlf() { }
|
||||
void serialPutc(char c) { }
|
||||
|
||||
@@ -93,10 +93,10 @@ void dacInit()
|
||||
NVIC_EnableIRQ(DACC_IRQn) ;
|
||||
}
|
||||
|
||||
bool audioPushBuffer(AudioBuffer *buffer)
|
||||
void audioPushBuffer(AudioBuffer *buffer)
|
||||
{
|
||||
buffer->state = AUDIO_BUFFER_FILLED;
|
||||
dacStart();
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" void DAC_IRQHandler()
|
||||
|
||||
@@ -71,10 +71,11 @@ void dacInit()
|
||||
NVIC_SetPriority(AUDIO_DMA_Stream_IRQn, 7);
|
||||
}
|
||||
|
||||
bool audioPushBuffer(AudioBuffer * buffer)
|
||||
void audioPushBuffer(AudioBuffer * buffer)
|
||||
{
|
||||
if (dacIdle) {
|
||||
dacIdle = false;
|
||||
buffer->state = AUDIO_BUFFER_PLAYING;
|
||||
AUDIO_DMA_Stream->CR &= ~DMA_SxCR_EN ; // Disable DMA channel
|
||||
AUDIO_DMA->HIFCR = DMA_HIFCR_CTCIF5 | DMA_HIFCR_CHTIF5 | DMA_HIFCR_CTEIF5 | DMA_HIFCR_CDMEIF5 | DMA_HIFCR_CFEIF5 ; // Write ones to clear bits
|
||||
AUDIO_DMA_Stream->M0AR = CONVERT_PTR_UINT(buffer->data);
|
||||
@@ -82,10 +83,9 @@ bool audioPushBuffer(AudioBuffer * buffer)
|
||||
AUDIO_DMA_Stream->CR |= DMA_SxCR_EN | DMA_SxCR_TCIE ; // Enable DMA channel and interrupt
|
||||
DAC->SR = DAC_SR_DMAUDR1 ; // Write 1 to clear flag
|
||||
DAC->CR |= DAC_CR_EN1 | DAC_CR_DMAEN1 ; // Enable DAC
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
buffer->state = AUDIO_BUFFER_FILLED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ void audioEnd()
|
||||
|
||||
extern "C" void AUDIO_TIM_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_AUDIO);
|
||||
DAC->CR &= ~DAC_CR_DMAEN1 ; // Stop DMA requests
|
||||
#if !defined(REV9E)
|
||||
DAC->CR &= ~DAC_CR_DMAUDRIE1 ; // Stop underrun interrupt
|
||||
|
||||
@@ -104,6 +104,7 @@ void bluetoothDone()
|
||||
|
||||
extern "C" void USART6_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_BLUETOOTH);
|
||||
if (USART_GetITStatus(BT_USART, USART_IT_RXNE) != RESET) {
|
||||
USART_ClearITPendingBit(BT_USART, USART_IT_RXNE);
|
||||
uint8_t byte = USART_ReceiveData(BT_USART);
|
||||
|
||||
@@ -108,6 +108,7 @@ extern "C" void INTERRUPT_5MS_IRQHandler()
|
||||
{
|
||||
INTERRUPT_5MS_TIMER->SR &= ~TIM_SR_UIF ;
|
||||
interrupt5ms() ;
|
||||
DEBUG_INTERRUPT(INT_5MS);
|
||||
}
|
||||
|
||||
#if defined(REV9E)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define WriteData(x) AspiData(x)
|
||||
@@ -199,6 +199,7 @@ void lcdRefresh(bool wait)
|
||||
|
||||
extern "C" void DMA1_Stream7_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_LCD);
|
||||
//clear interrupt flag
|
||||
DMA1_Stream7->CR &= ~DMA_SxCR_TCIE ; // Stop interrupt
|
||||
DMA1->HIFCR |= DMA_HIFCR_CTCIF7; // Clear interrupt flag
|
||||
|
||||
@@ -375,6 +375,7 @@ static void intmodulePpmStop()
|
||||
#if !defined(SIMU)
|
||||
extern "C" void TIM1_CC_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TIM1CC);
|
||||
INTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // stop this interrupt
|
||||
INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF; // clear flag
|
||||
DMA2_Stream6->CR &= ~DMA_SxCR_EN; // disable DMA, it will have the whole of the execution time of setupPulses() to actually stop
|
||||
@@ -402,6 +403,7 @@ extern "C" void TIM1_CC_IRQHandler()
|
||||
|
||||
extern "C" void TIM1_UP_TIM10_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TIM1);
|
||||
INTMODULE_TIMER->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
|
||||
INTMODULE_TIMER->ARR = *modulePulsesData[INTERNAL_MODULE].ppm.ptr++ ;
|
||||
@@ -612,6 +614,7 @@ extern "C" void TIM8_CC_IRQHandler()
|
||||
|
||||
extern "C" void TIM8_UP_TIM13_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TIM8);
|
||||
EXTMODULE_TIMER->SR &= ~TIM_SR_UIF ; // Clear flag
|
||||
|
||||
EXTMODULE_TIMER->ARR = *modulePulsesData[EXTERNAL_MODULE].ppm.ptr++ ;
|
||||
|
||||
@@ -138,6 +138,7 @@ uint8_t serial2TracesEnabled()
|
||||
#if !defined(SIMU)
|
||||
extern "C" void SERIAL_USART_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_SER2);
|
||||
// Send
|
||||
if (USART_GetITStatus(SERIAL_USART, USART_IT_TXE) != RESET) {
|
||||
uint8_t txchar;
|
||||
|
||||
@@ -114,6 +114,7 @@ void sportSendBuffer(uint8_t * buffer, uint32_t count)
|
||||
|
||||
extern "C" void TELEMETRY_DMA_TX_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TELEM_DMA);
|
||||
if (DMA_GetITStatus(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC)) {
|
||||
DMA_ClearITPendingBit(TELEMETRY_DMA_Stream_TX, TELEMETRY_DMA_TX_FLAG_TC);
|
||||
telemetryPortSetDirectionInput();
|
||||
@@ -123,6 +124,7 @@ extern "C" void TELEMETRY_DMA_TX_IRQHandler(void)
|
||||
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
|
||||
extern "C" void TELEMETRY_USART_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TELEM_USART);
|
||||
uint32_t status = TELEMETRY_USART->SR;
|
||||
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
|
||||
uint8_t data = TELEMETRY_USART->DR;
|
||||
|
||||
@@ -103,6 +103,7 @@ void stop_trainer_capture()
|
||||
#if !defined(SIMU)
|
||||
extern "C" void TIM3_IRQHandler()
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_TRAINER);
|
||||
uint16_t capture = 0;
|
||||
bool doCapture = false;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "board_taranis.h"
|
||||
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
|
||||
#include "debug.h"
|
||||
|
||||
int usbPlugged(void)
|
||||
{
|
||||
@@ -46,6 +47,7 @@ USB_OTG_CORE_HANDLE USB_OTG_dev;
|
||||
|
||||
void OTG_FS_IRQHandler(void)
|
||||
{
|
||||
DEBUG_INTERRUPT(INT_OTG_FS);
|
||||
USBD_OTG_ISR_Handler(&USB_OTG_dev);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user