1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 21:35:44 +03:00

CF/BF - SPRACINGF3OSD initial target support inc support for OSD SLAVE via MSP_DISPLAYPORT.

OSD is tested and working on an SPRACINGF3EVO stacked with an SPRACINGF3OSD.
This commit is contained in:
Hydra 2017-04-08 15:01:55 +01:00 committed by Dominic Clifton
parent 73e46e9050
commit ca5bafeab9
23 changed files with 638 additions and 12 deletions

View file

@ -91,6 +91,7 @@
#include "io/asyncfatfs/asyncfatfs.h"
#include "io/transponder_ir.h"
#include "io/osd.h"
#include "io/osd_slave.h"
#include "io/displayport_msp.h"
#include "io/vtx.h"
#include "io/vtx_smartaudio.h"
@ -155,6 +156,21 @@ void processLoopback(void)
#endif
}
#ifdef BUS_SWITCH_PIN
void busSwitchInit(void)
{
static IO_t busSwitchResetPin = IO_NONE;
busSwitchResetPin = IOGetByTag(IO_TAG(BUS_SWITCH_PIN));
IOInit(busSwitchResetPin, OWNER_SYSTEM, 0);
IOConfigGPIO(busSwitchResetPin, IOCFG_OUT_PP);
// ENABLE
IOLo(busSwitchResetPin);
}
#endif
void init(void)
{
#ifdef USE_HAL_DRIVER
@ -255,6 +271,10 @@ void init(void)
timerInit(); // timer must be initialized before any channel is allocated
#ifdef BUS_SWITCH_PIN
busSwitchInit();
#endif
#if defined(AVOID_UART1_FOR_PWM_PPM)
serialInit(feature(FEATURE_SOFTSERIAL),
feature(FEATURE_RX_PPM) || feature(FEATURE_RX_PARALLEL_PWM) ? SERIAL_PORT_USART1 : SERIAL_PORT_NONE);
@ -440,11 +460,11 @@ void init(void)
cmsInit();
#endif
#if ( defined(OSD) || (defined(USE_MSP_DISPLAYPORT) && defined(CMS)) )
#if (defined(OSD) || (defined(USE_MSP_DISPLAYPORT) && defined(CMS)) || defined(USE_OSD_SLAVE))
displayPort_t *osdDisplayPort = NULL;
#endif
#ifdef OSD
#if defined(OSD) && !defined(USE_OSD_SLAVE)
//The OSD need to be initialised after GYRO to avoid GYRO initialisation failure on some targets
if (feature(FEATURE_OSD)) {
@ -459,6 +479,15 @@ void init(void)
}
#endif
#if defined(USE_OSD_SLAVE) && !defined(OSD)
#if defined(USE_MAX7456)
// If there is a max7456 chip for the OSD then use it
osdDisplayPort = max7456DisplayPortInit(vcdProfile());
// osdInit will register with CMS by itself.
osdSlaveInit(osdDisplayPort);
#endif
#endif
#if defined(CMS) && defined(USE_MSP_DISPLAYPORT)
// If BFOSD is not active, then register MSP_DISPLAYPORT as a CMS device.
if (!osdDisplayPort)
@ -588,6 +617,10 @@ void init(void)
latchActiveFeatures();
motorControlEnable = true;
#ifdef USE_OSD_SLAVE
osdSlaveTasksInit();
#else
fcTasksInit();
#endif
systemState |= SYSTEM_STATE_READY;
}