diff --git a/source/common/power.c b/source/common/power.c index ec6ccaa..f8064c6 100644 --- a/source/common/power.c +++ b/source/common/power.c @@ -1,6 +1,13 @@ #include "power.h" #include "i2c.h" #include "cache.h" +#include "timer.h" + +void ScreenOn() { + wait_msec(3); // wait 3ms (cause profi200 said so) + flushDCacheRange((u8*)0x23FFFE00, sizeof(u8*)*3); // this assumes CakeHax framebuffers, see ui.h + I2C_writeReg(I2C_DEV_MCU, 0x22, 0x2A); // poweron LCD +} void Reboot() { I2C_writeReg(I2C_DEV_MCU, 0x22, 1 << 0); // poweroff LCD to prevent MCU hangs diff --git a/source/common/power.h b/source/common/power.h index b37f020..6b751b8 100644 --- a/source/common/power.h +++ b/source/common/power.h @@ -2,5 +2,6 @@ #include "common.h" +void ScreenOn(); void Reboot(); void PowerOff(); diff --git a/source/main.c b/source/main.c index ba9757b..cffe3f0 100644 --- a/source/main.c +++ b/source/main.c @@ -1,6 +1,4 @@ -#include "common.h" #include "godmode.h" -#include "i2c.h" #include "power.h" void main(int argc, char** argv) @@ -8,9 +6,10 @@ void main(int argc, char** argv) (void) argc; // unused for now (void) argv; // unused for now - // Turn on backlight - I2C_writeReg(I2C_DEV_MCU, 0x22, 0x2A); + // Screen on + ScreenOn(); // Run the main program - (GodMode() == GODMODE_EXIT_REBOOT) ? Reboot() : PowerOff(); + if (GodMode() == GODMODE_EXIT_REBOOT) Reboot(); + else PowerOff(); }