PMIC (Power Management IC)
The PMIC class provides direct, register-level access to the bq24195 (or bq24195L) Power Management IC used on devices with an external PMIC. It exposes every setting and status bit of the chip, including several that have no equivalent in the higher-level Power Manager API, such as OTG (boost) mode, shipping mode (BATFET disable), the I2C watchdog timer, and individual fault flags.
Warning:
You should generally use the Power Manager API, to set input voltage limit, input current limit, charge current, and charge termination voltage, rather than setting these through the PMIC class directly.
The Power Manager re-applies its SystemPowerConfiguration settings to the PMIC at boot, and again whenever System.setPowerConfiguration() is called. Any setting you change directly with the PMIC class that overlaps with a Power Manager setting (see the "See also" links on each method below) will be silently overwritten the next time the Power Manager runs, typically on the next reset. Settings made directly on the PMIC that have no Power Manager equivalent (like disableBATFET() or setWatchdog()) are not persistent and must be reapplied by your firmware after every reset.
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.