mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
Prevent race condition in main
This commit is contained in:
parent
e121e72f1c
commit
45fef040ff
@ -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
|
||||
|
@ -2,5 +2,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
void ScreenOn();
|
||||
void Reboot();
|
||||
void PowerOff();
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user