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:
parent
805b2f4b1e
commit
0115ff15b2
3 changed files with 13 additions and 7 deletions
|
@ -415,18 +415,18 @@ void max7456ReInit(void)
|
||||||
// Here we init only CS and try to init MAX for first time.
|
// Here we init only CS and try to init MAX for first time.
|
||||||
// Also detect device type (MAX v.s. AT)
|
// 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();
|
max7456HardwareReset();
|
||||||
|
|
||||||
if (!max7456Config->csTag) {
|
if (!max7456Config->csTag) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
busdev->busdev_u.spi.csnPin = IOGetByTag(max7456Config->csTag);
|
busdev->busdev_u.spi.csnPin = IOGetByTag(max7456Config->csTag);
|
||||||
|
|
||||||
if (!IOIsFreeOrPreinit(busdev->busdev_u.spi.csnPin)) {
|
if (!IOIsFreeOrPreinit(busdev->busdev_u.spi.csnPin)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOInit(busdev->busdev_u.spi.csnPin, OWNER_OSD_CS, 0);
|
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
|
#endif
|
||||||
|
|
||||||
// Real init will be made later when driver detect idle.
|
// Real init will be made later when driver detect idle.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,7 @@ extern uint16_t maxScreenSize;
|
||||||
struct vcdProfile_s;
|
struct vcdProfile_s;
|
||||||
void max7456HardwareReset(void);
|
void max7456HardwareReset(void);
|
||||||
struct max7456Config_s;
|
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 max7456Invert(bool invert);
|
||||||
void max7456Brightness(uint8_t black, uint8_t white);
|
void max7456Brightness(uint8_t black, uint8_t white);
|
||||||
void max7456DrawScreen(void);
|
void max7456DrawScreen(void);
|
||||||
|
|
|
@ -166,12 +166,17 @@ static const displayPortVTable_t max7456VTable = {
|
||||||
|
|
||||||
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile)
|
displayPort_t *max7456DisplayPortInit(const vcdProfile_t *vcdProfile)
|
||||||
{
|
{
|
||||||
displayInit(&max7456DisplayPort, &max7456VTable);
|
|
||||||
#ifdef USE_OSD_SLAVE
|
#ifdef USE_OSD_SLAVE
|
||||||
max7456Init(max7456Config(), vcdProfile, false);
|
if (!max7456Init(max7456Config(), vcdProfile, false))
|
||||||
#else
|
#else
|
||||||
max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock);
|
if (!max7456Init(max7456Config(), vcdProfile, systemConfig()->cpu_overclock))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayInit(&max7456DisplayPort, &max7456VTable);
|
||||||
|
|
||||||
resync(&max7456DisplayPort);
|
resync(&max7456DisplayPort);
|
||||||
return &max7456DisplayPort;
|
return &max7456DisplayPort;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue