mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 21:52:48 +00:00
- moved brightness control to the ARM11 - moved HID updating to the ARM11 - moved screen init from ARM9 to the ARM11, always performed unconditionally - removed unnecessary SCREENINIT and SET_BRIGHTNESS pxi commands and other stuff I probably forgot about
34 lines
699 B
C
34 lines
699 B
C
#include "arm.h"
|
|
#include "power.h"
|
|
#include "i2c.h"
|
|
#include "pxi.h"
|
|
|
|
u32 GetBatteryPercent() {
|
|
u8 battery = 0;
|
|
I2C_readRegBuf(I2C_DEV_MCU, 0x0B, &battery, 1);
|
|
return battery;
|
|
}
|
|
|
|
bool IsCharging() {
|
|
u8 flags = 0;
|
|
I2C_readRegBuf(I2C_DEV_MCU, 0x0F, &flags, 1);
|
|
return flags & (1<<4);
|
|
}
|
|
|
|
void Reboot() {
|
|
I2C_writeReg(I2C_DEV_MCU, 0x22, 1 << 0); // poweroff LCD to prevent MCU hangs
|
|
ARM_WbDC();
|
|
ARM_DSB();
|
|
I2C_writeReg(I2C_DEV_MCU, 0x20, 1 << 2);
|
|
while(true);
|
|
}
|
|
|
|
void PowerOff()
|
|
{
|
|
I2C_writeReg(I2C_DEV_MCU, 0x22, 1 << 0); // poweroff LCD to prevent MCU hangs
|
|
ARM_WbDC();
|
|
ARM_DSB();
|
|
I2C_writeReg(I2C_DEV_MCU, 0x20, 1 << 0);
|
|
while(true);
|
|
}
|