1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

VTX cleanups from Cleanflight. Also some transitions to use new IO

system for VTX CS pin.  Fix missing VTX CS GPIO pin initialisation.
Ensure VTX CS is set correctly when enabling the VTX module.
Configure VTX module boot delay - 50ms in old code was too slow on some
cold boots.
VTX SPI divisor is now set each time an SPI transfer occurs so that the
VTX module can co-exist on the same SPI bus as other devices - NEO uses
MAX7456 and RTC6705 VTX on the same SPI bus.
This commit is contained in:
Hydra 2016-12-28 18:33:16 +00:00 committed by Michael Keller
parent 31030dd29d
commit aae589cab8
5 changed files with 81 additions and 40 deletions

View file

@ -61,7 +61,7 @@ void vtxInit(void)
}
}
static void setChannelSaveAndNotify(uint8_t *bandOrChannel, uint8_t step, int32_t min, int32_t max)
static void setChannelSaveAndNotify(uint8_t *bandOrChannel, uint8_t step, int32_t max)
{
if (ARMING_FLAG(ARMED)) {
locked = 1;
@ -69,7 +69,7 @@ static void setChannelSaveAndNotify(uint8_t *bandOrChannel, uint8_t step, int32_
if (vtxConfig()->vtx_mode == 0 && !locked) {
uint8_t temp = (*bandOrChannel) + step;
temp = constrain(temp, min, max);
temp = constrain(temp, 0, max);
*bandOrChannel = temp;
rtc6705SetChannel(vtxConfig()->vtx_band, vtxConfig()->vtx_channel);
@ -81,22 +81,22 @@ static void setChannelSaveAndNotify(uint8_t *bandOrChannel, uint8_t step, int32_
void vtxIncrementBand(void)
{
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_band), 1, RTC6705_BAND_MIN, RTC6705_BAND_MAX);
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_band), 1, RTC6705_BAND_COUNT - 1);
}
void vtxDecrementBand(void)
{
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_band), -1, RTC6705_BAND_MIN, RTC6705_BAND_MAX);
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_band), -1, RTC6705_BAND_COUNT - 1);
}
void vtxIncrementChannel(void)
{
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_channel), 1, RTC6705_CHANNEL_MIN, RTC6705_CHANNEL_MAX);
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_channel), 1, RTC6705_CHANNEL_COUNT - 1);
}
void vtxDecrementChannel(void)
{
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_channel), -1, RTC6705_CHANNEL_MIN, RTC6705_CHANNEL_MAX);
setChannelSaveAndNotify(&(vtxConfigMutable()->vtx_channel), -1, RTC6705_CHANNEL_COUNT - 1);
}
void vtxUpdateActivatedChannel(void)