[ion/on_boarding] Fix the backlight initialization

This commit is contained in:
Léa Saviot
2019-04-25 10:53:41 +02:00
parent 69593bd0be
commit 794ce8d892
9 changed files with 24 additions and 17 deletions

View File

@@ -44,10 +44,10 @@ bool PowerOnSelfTest::LCDDataOK() {
}
}
bool result = TestDisplayBlackWhite();
/* If EPSILON_ONBOARDING_APP == 1, the backlight is not inited in
/* If EPSILON_ONBOARDING_APP == 1, the backlight is not initialized in
* Ion::Device::Board::initPeripherals, so that the LCD test is not visible to
* the user. We thus need to init the backlight after the test. Before, we
* push a white rect on the display to hide redrawing glitches. */
* the user. We thus need to initialize the backlight after the test. Before,
* we push a white rect on the display to hide redrawing glitches. */
Ion::Display::pushRectUniform(KDRect(KDPointZero, Ion::Display::Width, Ion::Display::Height), KDColorWhite);
Ion::Timing::msleep(100);
Ion::Backlight::init();

View File

@@ -21,7 +21,7 @@ void Sleep(const char * input) {
Device::Power::enterLowPowerMode();
Device::Board::setStandardFrequency(Device::Board::Frequency::High);
Device::Board::initClocks();
Device::Board::initPeripherals();
Device::Board::initPeripherals(false);
}
}

View File

@@ -20,7 +20,7 @@ void Stop(const char * input) {
Device::Board::shutdownClocks();
Device::Power::enterLowPowerMode();
Device::Board::initClocks();
Device::Board::initPeripherals();
Device::Board::initPeripherals(false);
}
}

View File

@@ -19,7 +19,7 @@ namespace Board {
using namespace Regs;
void init() {
void init(bool initBacklight) {
initClocks();
// Ensure right location of interrupt vectors
@@ -38,7 +38,7 @@ void init() {
GPIO(g).PUPDR()->set(0x00000000); // All to "None"
}
initPeripherals();
initPeripherals(initBacklight);
}
void initClocks() {

View File

@@ -85,7 +85,7 @@ void initMPU() {
Cache::isb();
}
void init() {
void init(bool initBacklight) {
initFPU();
initMPU();
initClocks();
@@ -106,7 +106,7 @@ void init() {
GPIO(g).PUPDR()->set(0x00000000); // All to "None"
}
initPeripherals();
initPeripherals(initBacklight);
// Initiate L1 cache after initiating the external flash
Cache::enable();

View File

@@ -81,7 +81,14 @@ void start() {
}
#endif
Ion::Device::Board::init();
/* Init the board. If there is the on boarding app, do not initialize the
* backlight so that the user does not see the LCD tests. The backlight will
* be initialized after the Power-On Self-Test.*/
#if EPSILON_ONBOARDING_APP == 0
Ion::Device::Board::init(true);
#else
Ion::Device::Board::init(false);
#endif
non_inlined_ion_main();

View File

@@ -30,11 +30,11 @@ void initFPU() {
// FIXME: The pipeline should be flushed at this point
}
void initPeripherals() {
void initPeripherals(bool initBacklight) {
Display::init();
#if EPSILON_ONBOARDING_APP == 0
Backlight::init();
#endif
if (initBacklight) {
Backlight::init();
}
Keyboard::init();
LED::init();
Battery::init();

View File

@@ -5,14 +5,14 @@ namespace Ion {
namespace Device {
namespace Board {
void init();
void init(bool initBacklight = true);
void shutdown();
void initFPU();
void initClocks();
void shutdownClocks(bool keepLEDAwake = false);
void initPeripherals();
void initPeripherals(bool initBacklight);
void shutdownPeripherals(bool keepLEDAwake = false);
enum class Frequency {

View File

@@ -88,7 +88,7 @@ void suspend(bool checkIfOnOffKeyReleased) {
// Reset normal frequency
Device::Board::setStandardFrequency(Device::Board::Frequency::High);
Device::Board::initClocks();
Device::Board::initPeripherals();
Device::Board::initPeripherals(true);
// Update LED according to plug and charge state
LED::updateColorWithPlugAndCharge();
/* If the USB has been unplugged while sleeping, the USB should have been