1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Fixed init order of MAX7456 DisplayPort

This commit is contained in:
Andrey Mironov 2018-07-23 23:31:42 +03:00
parent 805b2f4b1e
commit 0115ff15b2
3 changed files with 13 additions and 7 deletions

View file

@ -415,18 +415,18 @@ void max7456ReInit(void)
// Here we init only CS and try to init MAX for first time.
// Also detect device type (MAX v.s. AT)
void max7456Init(const max7456Config_t *max7456Config, const vcdProfile_t *pVcdProfile, bool cpuOverclock)
bool max7456Init(const max7456Config_t *max7456Config, const vcdProfile_t *pVcdProfile, bool cpuOverclock)
{
max7456HardwareReset();
if (!max7456Config->csTag) {
return;
return false;
}
busdev->busdev_u.spi.csnPin = IOGetByTag(max7456Config->csTag);
if (!IOIsFreeOrPreinit(busdev->busdev_u.spi.csnPin)) {
return;
return false;
}
IOInit(busdev->busdev_u.spi.csnPin, OWNER_OSD_CS, 0);
@ -489,6 +489,7 @@ void max7456Init(const max7456Config_t *max7456Config, const vcdProfile_t *pVcdP
#endif
// Real init will be made later when driver detect idle.
return true;
}
/**

View file

@ -31,7 +31,7 @@ extern uint16_t maxScreenSize;
struct vcdProfile_s;
void max7456HardwareReset(void);
struct max7456Config_s;
void max7456Init(const struct max7456Config_s *max7456Config, const struct vcdProfile_s *vcdProfile, bool cpuOverclock);
bool max7456Init(const struct max7456Config_s *max7456Config, const struct vcdProfile_s *vcdProfile, bool cpuOverclock);
void max7456Invert(bool invert);
void max7456Brightness(uint8_t black, uint8_t white);
void max7456DrawScreen(void);

View file

@ -166,12 +166,17 @@ static const displayPortVTable_t max7456VTable = {
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile)
{
displayInit(&max7456DisplayPort, &max7456VTable);
#ifdef USE_OSD_SLAVE
max7456Init(max7456Config(), vcdProfile, false);
if (!max7456Init(max7456Config(), vcdProfile, false))
#else
max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock);
if (!max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock))
#endif
{
return NULL;
}
displayInit(&max7456DisplayPort, &max7456VTable);
resync(&max7456DisplayPort);
return &max7456DisplayPort;
}