From 7e29719263e5a5ab3d8d4111e84da529c88f806d Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 17 Mar 2021 21:03:07 -0700 Subject: [PATCH] psm: Fix charger definitions --- nx/include/switch/services/psm.h | 11 ++++++----- nx/source/services/psm.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/nx/include/switch/services/psm.h b/nx/include/switch/services/psm.h index fb1c3d7f..fb379c03 100644 --- a/nx/include/switch/services/psm.h +++ b/nx/include/switch/services/psm.h @@ -10,10 +10,11 @@ #include "../kernel/event.h" typedef enum { - ChargerType_None = 0, ///< No charger - ChargerType_Charger = 1, ///< Official charger or dock - ChargerType_Usb = 2 ///< Other USB-C chargers -} ChargerType; + PsmChargerType_Unconnected = 0, ///< No charger + PsmChargerType_EnoughPower = 1, ///< Full supported power + PsmChargerType_LowPower = 2, ///< Lower power supported USB-PD mode + PsmChargerType_NotSupported = 3, ///< No common supported USB-PD modes +} PsmChargerType; typedef enum { PsmBatteryVoltageState_NeedsShutdown = 0, ///< Power state should transition to shutdown @@ -38,7 +39,7 @@ void psmExit(void); Service* psmGetServiceSession(void); Result psmGetBatteryChargePercentage(u32 *out); -Result psmGetChargerType(ChargerType *out); +Result psmGetChargerType(PsmChargerType *out); Result psmGetBatteryVoltageState(PsmBatteryVoltageState *out); Result psmGetRawBatteryChargePercentage(double *out); Result psmIsEnoughPowerSupplied(bool *out); diff --git a/nx/source/services/psm.c b/nx/source/services/psm.c index 2ba01eff..0b8c3402 100644 --- a/nx/source/services/psm.c +++ b/nx/source/services/psm.c @@ -71,7 +71,7 @@ Result psmGetBatteryChargePercentage(u32 *out) { return _psmCmdNoInOutU32(&g_psmSrv, out, 0); } -Result psmGetChargerType(ChargerType *out) { +Result psmGetChargerType(PsmChargerType *out) { return _psmCmdNoInOutU32(&g_psmSrv, out, 1); }