PMIC (Power Management IC)
You should generally set the PMIC settings such as input volage, input current limit, charge current, and charge termination voltage using the Power Manager API, above. If you directly set the PMIC, the settings will likely be overridden by the system.
To find out the current power source (battery, VIN, USB), see System.powerSource(). To find out if the battery is charging, discharging, disconnected, etc., see System.batteryState().
For full sample code sample code for logging power settings to USB serial debug, see the power supply guide.
Note: This is advanced IO and for experienced users. This controls the LiPo battery management system and is handled automatically by the Device OS.
Note:
Power Management is available on the Boron, B-Series SoM, Tracker SoM (Gen 3), Electron, and E-Series (Gen 2).
It is not available on the P2, Photon 2, Argon (Gen 3), Photon, or P1 (Gen 2).
Since 6.4.0:
PMIC methods can be called from PRE_STARTUP() in Device OS 6.4.0 and later, and in STARTUP() in all versions of Device OS.
If using PRE_STARTUP() the PMIC object must be local to the function, not a global, because global object constructors will not have been called yet.