PebbleOS
Loading...
Searching...
No Matches
Enumerations | Functions
battery_curve.h File Reference
#include <stdbool.h>
#include <stdint.h>

Enumerations

enum  BatteryCurveVoltageCompensationKey { BATTERY_CURVE_COMPENSATE_STATUS_LED , BATTERY_CURVE_COMPENSATE_COUNT }
 Source of a voltage compensation. More...
 

Functions

void battery_curve_set_compensation (BatteryCurveVoltageCompensationKey key, int mv)
 Set a compensation added to the measured voltage when computing the charge.
 
void battery_curve_set_full_voltage (uint16_t voltage)
 Move the 100 % point of the discharge curve.
 
uint32_t battery_curve_sample_ratio32_charge_percent (uint32_t battery_mv, bool is_charging)
 Get the charge for a voltage, applying the compensations.
 
int32_t battery_curve_lookup_percent_with_scaling_factor (int battery_mv, bool is_charging, uint32_t scaling_factor)
 Get the charge for a voltage, scaled by a factor, without compensations.
 
uint32_t battery_curve_get_hours_remaining (uint32_t percent_remaining)
 Get the hours of use left before low power mode.
 
uint32_t battery_curve_get_percent_remaining (uint32_t hours)
 Get the charge needed for some hours of use before low power mode.
 
uint32_t battery_curve_lookup_voltage_by_percent (uint32_t percent, bool is_charging)
 Get the voltage for a charge percentage.