mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
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:
parent
c38f8009b8
commit
08e40af088
9 changed files with 35 additions and 3 deletions
|
@ -71,7 +71,7 @@ OSD_Entry menuOsdActiveElemsEntries[] =
|
||||||
{"NAME", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_CRAFT_NAME], 0},
|
{"NAME", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_CRAFT_NAME], 0},
|
||||||
{"THROTTLE", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_THROTTLE_POS], 0},
|
{"THROTTLE", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_THROTTLE_POS], 0},
|
||||||
#ifdef VTX
|
#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
|
#endif // VTX
|
||||||
{"CURRENT (A)", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_CURRENT_DRAW], 0},
|
{"CURRENT (A)", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_CURRENT_DRAW], 0},
|
||||||
{"USED MAH", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_MAH_DRAWN], 0},
|
{"USED MAH", OME_VISIBLE, NULL, &osdProfile()->item_pos[OSD_MAH_DRAWN], 0},
|
||||||
|
|
|
@ -59,5 +59,6 @@ const char * const ownerNames[OWNER_TOTAL_COUNT] = {
|
||||||
"INVERTER",
|
"INVERTER",
|
||||||
"LED_STRIP",
|
"LED_STRIP",
|
||||||
"TRANSPONDER"
|
"TRANSPONDER"
|
||||||
|
"VTX",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef enum {
|
||||||
OWNER_INVERTER,
|
OWNER_INVERTER,
|
||||||
OWNER_LED_STRIP,
|
OWNER_LED_STRIP,
|
||||||
OWNER_TRANSPONDER,
|
OWNER_TRANSPONDER,
|
||||||
|
OWNER_VTX,
|
||||||
OWNER_TOTAL_COUNT
|
OWNER_TOTAL_COUNT
|
||||||
} resourceOwner_e;
|
} resourceOwner_e;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "common/maths.h"
|
#include "common/maths.h"
|
||||||
|
|
||||||
#include "vtx_rtc6705.h"
|
#include "vtx_rtc6705.h"
|
||||||
|
#include "io.h"
|
||||||
#include "bus_spi.h"
|
#include "bus_spi.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
|
@ -86,6 +87,12 @@
|
||||||
#define DISABLE_RTC6705 GPIO_SetBits(RTC6705_CS_GPIO, RTC6705_CS_PIN)
|
#define DISABLE_RTC6705 GPIO_SetBits(RTC6705_CS_GPIO, RTC6705_CS_PIN)
|
||||||
#define ENABLE_RTC6705 GPIO_ResetBits(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
|
// Define variables
|
||||||
static const uint32_t channelArray[RTC6705_BAND_MAX][RTC6705_CHANNEL_MAX] = {
|
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 },
|
{ 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
|
* Start chip if available
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool rtc6705Init(void)
|
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;
|
DISABLE_RTC6705;
|
||||||
spiSetDivisor(RTC6705_SPI_INSTANCE, SPI_CLOCK_SLOW);
|
spiSetDivisor(RTC6705_SPI_INSTANCE, SPI_CLOCK_SLOW);
|
||||||
return rtc6705IsReady();
|
return rtc6705IsReady();
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
#include "io/flashfs.h"
|
#include "io/flashfs.h"
|
||||||
#include "io/osd.h"
|
#include "io/osd.h"
|
||||||
|
|
||||||
|
#include "io/vtx.h"
|
||||||
|
|
||||||
#include "fc/config.h"
|
#include "fc/config.h"
|
||||||
#include "fc/rc_controls.h"
|
#include "fc/rc_controls.h"
|
||||||
#include "fc/runtime_config.h"
|
#include "fc/runtime_config.h"
|
||||||
|
@ -251,7 +253,7 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VTX
|
#ifdef USE_RTC6705
|
||||||
case OSD_VTX_CHANNEL:
|
case OSD_VTX_CHANNEL:
|
||||||
{
|
{
|
||||||
sprintf(buff, "CH:%d", current_vtx_channel % CHANNELS_PER_BAND + 1);
|
sprintf(buff, "CH:%d", current_vtx_channel % CHANNELS_PER_BAND + 1);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/time.h"
|
||||||
|
|
||||||
#define VISIBLE_FLAG 0x0800
|
#define VISIBLE_FLAG 0x0800
|
||||||
#define BLINK_FLAG 0x0400
|
#define BLINK_FLAG 0x0400
|
||||||
#define VISIBLE(x) (x & VISIBLE_FLAG)
|
#define VISIBLE(x) (x & VISIBLE_FLAG)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
// Own interfaces
|
// Own interfaces
|
||||||
#include "io/vtx.h"
|
#include "io/vtx.h"
|
||||||
|
#include "io/osd.h"
|
||||||
|
|
||||||
//External dependencies
|
//External dependencies
|
||||||
#include "config/config_master.h"
|
#include "config/config_master.h"
|
||||||
|
|
|
@ -95,6 +95,13 @@
|
||||||
#define SPI3_MISO_PIN PB4
|
#define SPI3_MISO_PIN PB4
|
||||||
#define SPI3_MOSI_PIN PB5
|
#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 USE_MAX7456
|
||||||
#define MAX7456_SPI_INSTANCE SPI3
|
#define MAX7456_SPI_INSTANCE SPI3
|
||||||
#define MAX7456_SPI_CS_PIN PA15
|
#define MAX7456_SPI_CS_PIN PA15
|
||||||
|
|
|
@ -15,5 +15,7 @@ TARGET_SRC = \
|
||||||
drivers/transponder_ir.c \
|
drivers/transponder_ir.c \
|
||||||
drivers/transponder_ir_stm32f30x.c \
|
drivers/transponder_ir_stm32f30x.c \
|
||||||
drivers/max7456.c \
|
drivers/max7456.c \
|
||||||
|
drivers/vtx_rtc6705.c \
|
||||||
|
io/osd.c \
|
||||||
io/transponder_ir.c \
|
io/transponder_ir.c \
|
||||||
io/osd.c
|
io/vtx.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue