boot: implement PmicDriver::ShutdownSystem

This commit is contained in:
Michael Scire
2019-05-09 02:45:31 -07:00
parent 7581306109
commit 1456246f60
6 changed files with 85 additions and 4 deletions

View File

@@ -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);
}