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

Add OSD displayPort device configurability

This commit is contained in:
jflyper 2019-09-28 04:03:06 +09:00
parent e821fec341
commit 8494d6e634
5 changed files with 52 additions and 8 deletions

View file

@ -753,16 +753,43 @@ void init(void)
//The OSD need to be initialised after GYRO to avoid GYRO initialisation failure on some targets
if (featureIsEnabled(FEATURE_OSD)) {
osdDisplayPortDevice_e device = osdConfig()->displayPortDevice;
switch(device) {
case OSD_DISPLAYPORT_DEVICE_AUTO:
FALLTHROUGH;
#if defined(USE_MAX7456)
// If there is a max7456 chip for the OSD then use it
osdDisplayPort = max7456DisplayPortInit(vcdProfile());
#elif defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT) && defined(USE_OSD_OVER_MSP_DISPLAYPORT) // OSD over MSP; not supported (yet)
osdDisplayPort = displayPortMspInit();
case OSD_DISPLAYPORT_DEVICE_MAX7456:
// If there is a max7456 chip for the OSD configured and detectd then use it.
osdDisplayPort = max7456DisplayPortInit(vcdProfile());
if (osdDisplayPort || device == OSD_DISPLAYPORT_DEVICE_MAX7456) {
break;
}
FALLTHROUGH;
#endif
// osdInit will register with CMS by itself.
#if defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT) && defined(USE_OSD_OVER_MSP_DISPLAYPORT)
case OSD_DISPLAYPORT_DEVICE_MSP:
osdDisplayPort = displayPortMspInit();
if (osdDisplayPort || device == OSD_DISPLAYPORT_DEVICE_MSP) {
break;
}
FALLTHROUGH;
#endif
// Other device cases can be added here
case OSD_DISPLAYPORT_DEVICE_NONE:
default:
break;
}
// osdInit will register with CMS by itself.
osdInit(osdDisplayPort);
}
#endif
#endif // USE_OSD
#if defined(USE_CMS) && defined(USE_MSP_DISPLAYPORT)
// If BFOSD is not active, then register MSP_DISPLAYPORT as a CMS device.