Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
battery.h File Reference
#include <stdint.h>
#include <errno.h>
#include <zephyr/devicetree.h>
#include <zephyr/math/interpolation.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Macros

#define BATTERY_OCV_TABLE_LEN   11
 
#define BATTERY_CHEMISTRY_DT_GET(node_id)
 Get the battery chemistry enum value.
 
#define BATTERY_OCV_TABLE_DT_GET(node_id, table)
 Get the OCV curve for a given table.
 

Enumerations

enum  battery_chemistry {
  BATTERY_CHEMISTRY_UNKNOWN = 0 , BATTERY_CHEMISTRY_NICKEL_CADMIUM , BATTERY_CHEMISTRY_NICKEL_METAL_HYDRIDE , BATTERY_CHEMISTRY_LITHIUM_ION ,
  BATTERY_CHEMISTRY_LITHIUM_ION_POLYMER , BATTERY_CHEMISTRY_LITHIUM_ION_IRON_PHOSPHATE , BATTERY_CHEMISTRY_LITHIUM_ION_MANGANESE_OXIDE
}
 

Functions

static int32_t battery_soc_lookup (const int32_t ocv_table[11], uint32_t voltage_uv)
 Convert an OCV table and battery voltage to a charge percentage.