nrfxlib API 3.3.99
Loading...
Searching...
No Matches
nrf_fuel_gauge.h File Reference

nRF Fuel Gauge library API. More...

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  battery_model
 Secondary cell (rechargeable) battery model parameters. More...
 
struct  battery_model_primary
 Primary cell (non-rechargeable) battery model parameters. More...
 
struct  nrf_fuel_gauge_state_info
 Library state information. Useful for debugging. More...
 
struct  nrf_fuel_gauge_config_parameters
 Configuration parameters. More...
 
struct  nrf_fuel_gauge_init_parameters
 Library init parameter struct. More...
 
union  nrf_fuel_gauge_ext_state_info_data
 State info data type used for additional information. More...
 

Macros

#define NRF_FUEL_GAUGE_DEFAULT_INIT_PARAMETERS_PRIMARY(_v0, _i0, _t0, _battery_model)
 Helper macro to get basic initialization parameters for primary cell variant.
 
#define NRF_FUEL_GAUGE_DEFAULT_INIT_PARAMETERS_SECONDARY(_v0, _i0, _t0, _battery_model)
 Helper macro to get basic initialization parameters for secondary cell variant.
 

Enumerations

enum  nrf_fuel_gauge_variant_type { NRF_FUEL_GAUGE_VARIANT_PRIMARY , NRF_FUEL_GAUGE_VARIANT_SECONDARY }
 
enum  nrf_fuel_gauge_charge_state {
  NRF_FUEL_GAUGE_CHARGE_STATE_IDLE , NRF_FUEL_GAUGE_CHARGE_STATE_TRICKLE , NRF_FUEL_GAUGE_CHARGE_STATE_CC , NRF_FUEL_GAUGE_CHARGE_STATE_CC_LIMITED ,
  NRF_FUEL_GAUGE_CHARGE_STATE_CV , NRF_FUEL_GAUGE_CHARGE_STATE_COMPLETE
}
 Charger state enum. More...
 
enum  nrf_fuel_gauge_ext_state_info_type {
  NRF_FUEL_GAUGE_EXT_STATE_INFO_VBUS_CONNECTED , NRF_FUEL_GAUGE_EXT_STATE_INFO_VBUS_DISCONNECTED , NRF_FUEL_GAUGE_EXT_STATE_INFO_CHARGE_STATE_CHANGE , NRF_FUEL_GAUGE_EXT_STATE_INFO_CHARGE_CURRENT_CORRECTION ,
  NRF_FUEL_GAUGE_EXT_STATE_INFO_DISCHARGE_CURRENT_CORRECTION , NRF_FUEL_GAUGE_EXT_STATE_INFO_CHARGE_CURRENT_LIMIT , NRF_FUEL_GAUGE_EXT_STATE_INFO_TERM_CURRENT , NRF_FUEL_GAUGE_EXT_STATE_INFO_BATTERY_REPLACED
}
 State info type used for informing the library of external factors and events. More...
 

Functions

int nrf_fuel_gauge_config_params_default_get (struct nrf_fuel_gauge_config_parameters *params)
 Initialize configuration parameter structure to default values.
 
int nrf_fuel_gauge_config_params_current_get (struct nrf_fuel_gauge_config_parameters *params)
 Initialize configuration parameter structure to the currently used values.
 
int nrf_fuel_gauge_state_compatible_check (const void *state, size_t state_size)
 Check if the provided state is compatible with the current library version.
 
int nrf_fuel_gauge_init (const struct nrf_fuel_gauge_init_parameters *parameters, float *v0)
 Initialize the nRF Fuel Gauge library.
 
int nrf_fuel_gauge_process (float v, float i, float T, float t_delta, float *soc, struct nrf_fuel_gauge_state_info *state)
 Process battery measurement values.
 
int nrf_fuel_gauge_soc_get (float *soc)
 Get predicted state-of-charge value.
 
int nrf_fuel_gauge_tte_get (float *tte)
 Get predicted "time-to-empty" discharge duration.
 
int nrf_fuel_gauge_ttf_get (float *ttf)
 Get predicted "time-to-full" charging duration.
 
int nrf_fuel_gauge_soh_get (float *soh)
 Get predicted battery state-of-health (SOH) as a percentage of modeled battery capacity.
 
int nrf_fuel_gauge_idle_set (float v, float T, float i_avg)
 Put library into the idle state.
 
int nrf_fuel_gauge_state_get (void *state, size_t size)
 Retrieve library state data.
 
int nrf_fuel_gauge_ext_state_update (enum nrf_fuel_gauge_ext_state_info_type type, union nrf_fuel_gauge_ext_state_info_data *data)
 Optional function to inform library of external events and factors.
 
int nrf_fuel_gauge_config_params_adjust (const struct nrf_fuel_gauge_config_parameters *params)
 Update configuraton parameters.
 

Variables

const char * nrf_fuel_gauge_version
 Version number of nRF Fuel Gauge library in format "x.y.z".
 
const char * nrf_fuel_gauge_build_date
 Build date of nRF Fuel Gauge library.
 
enum nrf_fuel_gauge_variant_type nrf_fuel_gauge_variant
 Build variant of nRF Fuel Gauge library.
 
const size_t nrf_fuel_gauge_state_size
 Size of the internal state memory used by nRF Fuel Gauge library.
 

Detailed Description

nRF Fuel Gauge library API.