Add enum for PsmBatteryVoltageState

This commit is contained in:
Michael Scire 2018-11-10 02:31:11 -08:00 committed by yellows8
parent 94dc8f75f9
commit 27936900d0
2 changed files with 15 additions and 3 deletions

View File

@ -13,12 +13,19 @@ typedef enum {
ChargerType_Usb = 2 ///< Other USB-C chargers
} ChargerType;
typedef enum {
PsmBatteryVoltageState_NeedsShutdown = 0, ///< Power state should transition to shutdown
PsmBatteryVoltageState_NeedsSleep = 1, ///< Power state should transition to sleep
PsmBatteryVoltageState_NoPerformanceBoost = 2, ///< Performance boost modes cannot be entered
PsmBatteryVoltageState_Normal = 3, ///< Everything is normal
} PsmBatteryVoltageState;
Result psmInitialize(void);
void psmExit(void);
Result psmGetBatteryChargePercentage(u32 *out);
Result psmGetChargerType(ChargerType *out);
Result psmGetBatteryVoltageState(u32 *out);
Result psmGetBatteryVoltageState(PsmBatteryVoltageState *out);
/**
* @brief Wrapper func which handles event setup.

View File

@ -95,8 +95,13 @@ Result psmGetChargerType(ChargerType *out) {
return _psmGetOutU32(1, out);
}
Result psmGetBatteryVoltageState(u32 *out) {
return _psmGetOutU32(12, out);
Result psmGetBatteryVoltageState(PsmBatteryVoltageState *out) {
u32 state;
Result rc = _psmGetOutU32(12, &state);
if (R_SUCCEEDED(rc)) {
*out = (PsmBatteryVoltageState)state;
}
return rc;
}
static Result _psmOpenSession(Service* out) {