boot: implement bc24193 driver, part of CheckBatteryCharge

This commit is contained in:
Michael Scire 2019-05-06 15:53:29 -07:00
parent ea90325535
commit 7c36a827da
7 changed files with 468 additions and 1 deletions

View file

@ -296,3 +296,14 @@ Result BatteryDriver::InitializeBatteryParameters() {
return ResultSuccess;
}
Result BatteryDriver::IsBatteryRemoved(bool *out) {
/* N doesn't check result, but we will. */
u16 val = 0;
Result rc = this->Read(Max17050Status, &val);
if (R_FAILED(rc)) {
return rc;
}
*out = (val & 0x0008) == 0x0008;
return ResultSuccess;
}