Add iFlight Commando8
Add iFlight Commando8 ELRS radio
This commit is contained in:
@@ -44,6 +44,34 @@ void dacTimerInit()
|
||||
AUDIO_TIMER->CR1 = TIM_CR1_CEN ;
|
||||
}
|
||||
|
||||
#if defined(AUDIO_MUTE_GPIO_PIN)
|
||||
static inline void setMutePin(bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
#if defined(INVERTED_MUTE_PIN)
|
||||
GPIO_ResetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
#else
|
||||
GPIO_SetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
#endif
|
||||
} else {
|
||||
#if defined(INVERTED_MUTE_PIN)
|
||||
GPIO_SetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
#else
|
||||
GPIO_ResetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool getMutePin(void)
|
||||
{
|
||||
#if defined(INVERTED_MUTE_PIN)
|
||||
return !GPIO_ReadOutputDataBit(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
#else
|
||||
return GPIO_ReadOutputDataBit(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// Configure DAC0
|
||||
// Not sure why PB14 has not be allocated to the DAC, although it is an EXTRA function
|
||||
// So maybe it is automatically done
|
||||
@@ -60,7 +88,7 @@ void dacInit()
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(AUDIO_MUTE_GPIO, &GPIO_InitStructure);
|
||||
GPIO_SetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
setMutePin(true);
|
||||
#endif
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = AUDIO_OUTPUT_GPIO_PIN;
|
||||
@@ -100,11 +128,11 @@ void audioMute()
|
||||
}
|
||||
else if (now - audioQueue.lastAudioPlayTime > AUDIO_MUTE_DELAY / 10) {
|
||||
// delay expired, we may mute
|
||||
GPIO_SetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
setMutePin(true);
|
||||
}
|
||||
#else
|
||||
// mute
|
||||
GPIO_SetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
setMutePin(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -112,15 +140,15 @@ void audioUnmute()
|
||||
{
|
||||
#if defined(AUDIO_UNMUTE_DELAY)
|
||||
// if muted
|
||||
if (GPIO_ReadOutputDataBit(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN)) {
|
||||
if (getMutePin()) {
|
||||
// ..un-mute
|
||||
GPIO_ResetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
setMutePin(false);
|
||||
RTOS_WAIT_MS(AUDIO_UNMUTE_DELAY);
|
||||
}
|
||||
// reset the mute delay
|
||||
audioQueue.lastAudioPlayTime = 0;
|
||||
#else
|
||||
GPIO_ResetBits(AUDIO_MUTE_GPIO, AUDIO_MUTE_GPIO_PIN);
|
||||
setMutePin(false);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -146,7 +146,7 @@ static inline uint32_t ticksNow()
|
||||
#define ROTENC_HIGHSPEED 50
|
||||
#define ROTENC_DELAY_MIDSPEED 32
|
||||
#define ROTENC_DELAY_HIGHSPEED 16
|
||||
#elif defined(RADIO_T8) && defined(__cplusplus)
|
||||
#elif (defined(RADIO_T8) || defined(RADIO_COMMANDO8)) && defined(__cplusplus)
|
||||
constexpr uint8_t rotencSpeed = 1;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ void bootloaderInitApp()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(RADIO_T8) && !defined(RADIOMASTER_RELEASE)
|
||||
#if (defined(RADIO_T8) || defined(RADIO_COMMANDO8)) && !defined(RADIOMASTER_RELEASE)
|
||||
// Bind button not pressed
|
||||
if ((~KEYS_GPIO_REG_BIND & KEYS_GPIO_PIN_BIND) == false) {
|
||||
#else
|
||||
@@ -551,16 +551,12 @@ int bootloaderMain()
|
||||
}
|
||||
|
||||
if (state == ST_REBOOT) {
|
||||
lcdClear();
|
||||
lcdRefresh();
|
||||
lcdRefreshWait();
|
||||
|
||||
#if !defined(SIMU)
|
||||
#if defined(RTC_BACKUP_RAM)
|
||||
rtcInit();
|
||||
RTC->BKP0R = SOFTRESET_REQUEST;
|
||||
#endif
|
||||
|
||||
blExit();
|
||||
NVIC_SystemReset();
|
||||
#else
|
||||
exit(1);
|
||||
|
||||
@@ -92,4 +92,6 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str = nullptr
|
||||
// Once for each file in a filename list on screen
|
||||
void bootloaderDrawFilename(const char* str, uint8_t line, bool selected);
|
||||
|
||||
void blExit();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -118,6 +118,15 @@ extern "C" void PWM_IRQHandler(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(STICK_CHANNEL_CHANGE)
|
||||
void sticksPwmRead(uint16_t * values)
|
||||
{
|
||||
values[0] = timer_capture_values[STICK_PWM_CHANNEL_0];
|
||||
values[1] = timer_capture_values[STICK_PWM_CHANNEL_1];
|
||||
values[2] = timer_capture_values[STICK_PWM_CHANNEL_2];
|
||||
values[3] = timer_capture_values[STICK_PWM_CHANNEL_3];
|
||||
}
|
||||
#else
|
||||
void sticksPwmRead(uint16_t * values)
|
||||
{
|
||||
values[0] = timer_capture_values[0];
|
||||
@@ -125,3 +134,4 @@ void sticksPwmRead(uint16_t * values)
|
||||
values[2] = timer_capture_values[3];
|
||||
values[3] = timer_capture_values[2];
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,7 @@ stm32_hal_adc_channel ADC_MAIN_channels[] = {
|
||||
{ ADC_CHANNEL_SLIDER2, ADC_SAMPTIME },
|
||||
{ ADC_CHANNEL_BATT, ADC_SAMPTIME }
|
||||
#else
|
||||
#if defined(RADIO_T8) || defined(RADIO_TLITE)
|
||||
#if defined(RADIO_T8) || defined(RADIO_TLITE) || defined(RADIO_COMMANDO8)
|
||||
// fake channels to fill unsused POT1/POT2
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
|
||||
Reference in New Issue
Block a user