PebbleOS v4.47.0-505-g4bbc630fa
Loading...
Searching...
No Matches
battery_charger.h File Reference
#include <stdbool.h>

Functions

void battery_charger_init (void)
 Start reporting external power changes as battery connection events.
 
bool battery_is_usb_connected (void)
 Check whether USB power is connected.
 
bool battery_charge_controller_thinks_we_are_charging (void)
 Check whether the charger reports charging.
 
void battery_force_charge_enable (bool is_charging)
 Force charging on or off.
 

Function Documentation

◆ battery_charge_controller_thinks_we_are_charging()

bool battery_charge_controller_thinks_we_are_charging ( void  )

Check whether the charger reports charging.

This is the raw charger status, not the notion of charging used by the rest of the system, which comes from the battery state service. Always false while charging is forced off with battery_force_charge_enable().

Returns
True if the charger is charging.

◆ battery_charger_init()

void battery_charger_init ( void  )

Start reporting external power changes as battery connection events.

◆ battery_force_charge_enable()

void battery_force_charge_enable ( bool  is_charging)

Force charging on or off.

While forced off, battery_is_usb_connected() and battery_charge_controller_thinks_we_are_charging() report false.

Parameters
is_chargingTrue to allow charging, false to force it off.

◆ battery_is_usb_connected()

bool battery_is_usb_connected ( void  )

Check whether USB power is connected.

Always false while charging is forced off with battery_force_charge_enable().

Returns
True if USB power is present.