SPRACINGF3NEO - VTX Support.

Note: Likely there will be a clash with DMA driven OSD and the VTX.

There is no support in the code to disable OSD updates prior to changing
VTX channel.
This commit is contained in:
Hydra 2016-10-24 21:38:21 +02:00 committed by Dominic Clifton
parent c38f8009b8
commit 08e40af088
9 changed files with 35 additions and 3 deletions

View File

@ -71,7 +71,7 @@ OSD_Entry menuOsdActiveElemsEntries[] =
{"NAME", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_CRAFT_NAME], 0},
{"THROTTLE", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_THROTTLE_POS], 0},
#ifdef VTX
{"VTX CHAN", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_VTX_CHANNEL]},
{"VTX CHAN", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_VTX_CHANNEL], 0},
#endif // VTX
{"CURRENT (A)", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_CURRENT_DRAW], 0},
{"USED MAH", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_MAH_DRAWN], 0},

View File

@ -59,5 +59,6 @@ const char * const ownerNames[OWNER_TOTAL_COUNT] = {
"INVERTER",
"LED_STRIP",
"TRANSPONDER"
"VTX",
};

View File

@ -59,6 +59,7 @@ typedef enum {
OWNER_INVERTER,
OWNER_LED_STRIP,
OWNER_TRANSPONDER,
OWNER_VTX,
OWNER_TOTAL_COUNT
} resourceOwner_e;

View File

@ -32,6 +32,7 @@
#include "common/maths.h"
#include "vtx_rtc6705.h"
#include "io.h"
#include "bus_spi.h"
#include "system.h"
@ -86,6 +87,12 @@
#define DISABLE_RTC6705 GPIO_SetBits(RTC6705_CS_GPIO, RTC6705_CS_PIN)
#define ENABLE_RTC6705 GPIO_ResetBits(RTC6705_CS_GPIO, RTC6705_CS_PIN)
static IO_t vtxPowerPin = IO_NONE;
#define ENABLE_VTX_POWER IOLo(vtxPowerPin)
#define DISABLE_VTX_POWER IOHi(vtxPowerPin)
// Define variables
static const uint32_t channelArray[RTC6705_BAND_MAX][RTC6705_CHANNEL_MAX] = {
{ RTC6705_SET_A1, RTC6705_SET_A2, RTC6705_SET_A3, RTC6705_SET_A4, RTC6705_SET_A5, RTC6705_SET_A6, RTC6705_SET_A7, RTC6705_SET_A8 },
@ -129,8 +136,17 @@ static uint32_t reverse32(uint32_t in)
/**
* Start chip if available
*/
bool rtc6705Init(void)
{
#ifdef RTC6705_POWER_PIN
vtxPowerPin = IOGetByTag(IO_TAG(RTC6705_POWER_PIN));
IOInit(vtxPowerPin, OWNER_VTX, 0);
IOConfigGPIO(vtxPowerPin, IOCFG_OUT_PP);
ENABLE_VTX_POWER;
#endif
DISABLE_RTC6705;
spiSetDivisor(RTC6705_SPI_INSTANCE, SPI_CLOCK_SLOW);
return rtc6705IsReady();

View File

@ -48,6 +48,8 @@
#include "io/flashfs.h"
#include "io/osd.h"
#include "io/vtx.h"
#include "fc/config.h"
#include "fc/rc_controls.h"
#include "fc/runtime_config.h"
@ -251,7 +253,7 @@ static void osdDrawSingleElement(uint8_t item)
break;
}
#ifdef VTX
#ifdef USE_RTC6705
case OSD_VTX_CHANNEL:
{
sprintf(buff, "CH:%d", current_vtx_channel % CHANNELS_PER_BAND + 1);

View File

@ -17,6 +17,8 @@
#pragma once
#include "common/time.h"
#define VISIBLE_FLAG 0x0800
#define BLINK_FLAG 0x0400
#define VISIBLE(x) (x & VISIBLE_FLAG)

View File

@ -23,6 +23,7 @@
// Own interfaces
#include "io/vtx.h"
#include "io/osd.h"
//External dependencies
#include "config/config_master.h"

View File

@ -95,6 +95,13 @@
#define SPI3_MISO_PIN PB4
#define SPI3_MOSI_PIN PB5
#define VTX
#define RTC6705_CS_GPIO GPIOF
#define RTC6705_CS_PIN GPIO_Pin_4
#define RTC6705_SPI_INSTANCE SPI3
#define RTC6705_POWER_PIN PC3
#define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI3
#define MAX7456_SPI_CS_PIN PA15

View File

@ -15,5 +15,7 @@ TARGET_SRC = \
drivers/transponder_ir.c \
drivers/transponder_ir_stm32f30x.c \
drivers/max7456.c \
drivers/vtx_rtc6705.c \
io/osd.c \
io/transponder_ir.c \
io/osd.c
io/vtx.c