diff --git a/apps/on_boarding/power_on_self_test.cpp b/apps/on_boarding/power_on_self_test.cpp index 7cf611b4b..03091e387 100644 --- a/apps/on_boarding/power_on_self_test.cpp +++ b/apps/on_boarding/power_on_self_test.cpp @@ -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(); diff --git a/ion/src/device/bench/command/sleep.cpp b/ion/src/device/bench/command/sleep.cpp index 44e467a8c..825d6e4d6 100644 --- a/ion/src/device/bench/command/sleep.cpp +++ b/ion/src/device/bench/command/sleep.cpp @@ -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); } } diff --git a/ion/src/device/bench/command/stop.cpp b/ion/src/device/bench/command/stop.cpp index 651e3bd7c..71067dc43 100644 --- a/ion/src/device/bench/command/stop.cpp +++ b/ion/src/device/bench/command/stop.cpp @@ -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); } } diff --git a/ion/src/device/n0100/drivers/board.cpp b/ion/src/device/n0100/drivers/board.cpp index b6374d10e..88f3b4c6c 100644 --- a/ion/src/device/n0100/drivers/board.cpp +++ b/ion/src/device/n0100/drivers/board.cpp @@ -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() { diff --git a/ion/src/device/n0200/drivers/board.cpp b/ion/src/device/n0200/drivers/board.cpp index eb1f02853..6d698027c 100644 --- a/ion/src/device/n0200/drivers/board.cpp +++ b/ion/src/device/n0200/drivers/board.cpp @@ -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(); diff --git a/ion/src/device/shared/boot/rt0.cpp b/ion/src/device/shared/boot/rt0.cpp index 448fea2ae..e1edac7d8 100644 --- a/ion/src/device/shared/boot/rt0.cpp +++ b/ion/src/device/shared/boot/rt0.cpp @@ -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(); diff --git a/ion/src/device/shared/drivers/board.cpp b/ion/src/device/shared/drivers/board.cpp index 20f8e4290..e8300d69b 100644 --- a/ion/src/device/shared/drivers/board.cpp +++ b/ion/src/device/shared/drivers/board.cpp @@ -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(); diff --git a/ion/src/device/shared/drivers/board.h b/ion/src/device/shared/drivers/board.h index 96fb6eef5..31acc0941 100644 --- a/ion/src/device/shared/drivers/board.h +++ b/ion/src/device/shared/drivers/board.h @@ -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 { diff --git a/ion/src/device/shared/drivers/power.cpp b/ion/src/device/shared/drivers/power.cpp index 4d5d11122..c568acc09 100644 --- a/ion/src/device/shared/drivers/power.cpp +++ b/ion/src/device/shared/drivers/power.cpp @@ -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