boot: implement PmicDriver::ShutdownSystem
This commit is contained in:
@@ -353,4 +353,22 @@ Result BatteryDriver::GetBatteryPercentage(size_t *out) {
|
||||
*out = static_cast<size_t>(converted_percentage);
|
||||
}
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result BatteryDriver::SetShutdownTimer() {
|
||||
return this->Write(Max17050ShdnTimer, 0xE000);
|
||||
}
|
||||
|
||||
Result BatteryDriver::GetShutdownEnabled(bool *out) {
|
||||
u16 val = 0;
|
||||
Result rc = this->Read(Max17050Config, &val);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
*out = (val & 0x0040) != 0;
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result BatteryDriver::SetShutdownEnabled(bool enabled) {
|
||||
return this->ReadWrite(Max17050Config, 0x0040, enabled ? 0x0040 : 0x0000);
|
||||
}
|
||||
Reference in New Issue
Block a user