PebbleOS
Loading...
Searching...
No Matches
Data Structures
Battery

Functions related to getting the battery status. More...

Data Structures

struct  BatteryChargeState
 Structure for retrieval of the battery charge state. More...
 
struct  PreciseBatteryChargeState
 Structure for retrieval of the exact battery charge state. More...
 

Detailed Description

Functions related to getting the battery status.

This module contains the functions necessary to find the current charge status.

Note
Battery charge state is a complex topic; our modelling of the charge that is exposed by these functions represents a very simplified model based mostly on empirically derived charge and discharge voltage curves. As such, you should expect that the output will not have a high degree of accuracy.

Data Structure Documentation

◆ BatteryChargeState

struct BatteryChargeState

Structure for retrieval of the battery charge state.

Data Fields
uint8_t charge_percent A percentage (0-100) of how full the battery is.
bool is_charging True if the battery is currently being charged.

False if not.

bool is_plugged True if the charger cable is connected.

False if not.

◆ PreciseBatteryChargeState

struct PreciseBatteryChargeState

Structure for retrieval of the exact battery charge state.

Data Fields
uint32_t charge_percent The battery's percentage as a ratio32.
bool is_charging WARNING: This maps to battery_charge_controller_thinks_we_are_charging() as opposed to the user-facing definition of whether we're charging (100% battery).
bool is_plugged True if the charger cable is connected.
uint8_t pct The battery percentage 0-100.