Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
charger.h File Reference

Charger APIs. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/syscalls/charger.h>

Go to the source code of this file.

Data Structures

struct  charger_current_notifier
 The input current thresholds for the charger to notify the system. More...
 
union  charger_propval
 container for a charger_property value More...
 
struct  charger_driver_api
 Charging device API. More...
 

Typedefs

typedef uint16_t charger_prop_t
 A charger property's identifier.
 
typedef void(* charger_status_notifier_t) (enum charger_status status)
 The charger status change callback to notify the system.
 
typedef void(* charger_online_notifier_t) (enum charger_online online)
 The charger online change callback to notify the system.
 
typedef int(* charger_get_property_t) (const struct device *dev, const charger_prop_t prop, union charger_propval *val)
 Callback API for getting a charger property.
 
typedef int(* charger_set_property_t) (const struct device *dev, const charger_prop_t prop, const union charger_propval *val)
 Callback API for setting a charger property.
 
typedef int(* charger_charge_enable_t) (const struct device *dev, const bool enable)
 Callback API enabling or disabling a charge cycle.
 

Enumerations

enum  charger_property {
  CHARGER_PROP_ONLINE = 0 , CHARGER_PROP_PRESENT , CHARGER_PROP_STATUS , CHARGER_PROP_CHARGE_TYPE ,
  CHARGER_PROP_HEALTH , CHARGER_PROP_CONSTANT_CHARGE_CURRENT_UA , CHARGER_PROP_PRECHARGE_CURRENT_UA , CHARGER_PROP_CHARGE_TERM_CURRENT_UA ,
  CHARGER_PROP_CONSTANT_CHARGE_VOLTAGE_UV , CHARGER_PROP_INPUT_REGULATION_CURRENT_UA , CHARGER_PROP_INPUT_REGULATION_VOLTAGE_UV , CHARGER_PROP_INPUT_CURRENT_NOTIFICATION ,
  CHARGER_PROP_DISCHARGE_CURRENT_NOTIFICATION , CHARGER_PROP_SYSTEM_VOLTAGE_NOTIFICATION_UV , CHARGER_PROP_STATUS_NOTIFICATION , CHARGER_PROP_ONLINE_NOTIFICATION ,
  CHARGER_PROP_COMMON_COUNT , CHARGER_PROP_CUSTOM_BEGIN = CHARGER_PROP_COMMON_COUNT + 1 , CHARGER_PROP_MAX = UINT16_MAX
}
 Runtime Dynamic Battery Parameters. More...
 
enum  charger_online { CHARGER_ONLINE_OFFLINE = 0 , CHARGER_ONLINE_FIXED , CHARGER_ONLINE_PROGRAMMABLE }
 External supply states. More...
 
enum  charger_status {
  CHARGER_STATUS_UNKNOWN = 0 , CHARGER_STATUS_CHARGING , CHARGER_STATUS_DISCHARGING , CHARGER_STATUS_NOT_CHARGING ,
  CHARGER_STATUS_FULL
}
 Charging states. More...
 
enum  charger_charge_type {
  CHARGER_CHARGE_TYPE_UNKNOWN = 0 , CHARGER_CHARGE_TYPE_NONE , CHARGER_CHARGE_TYPE_TRICKLE , CHARGER_CHARGE_TYPE_FAST ,
  CHARGER_CHARGE_TYPE_STANDARD , CHARGER_CHARGE_TYPE_ADAPTIVE , CHARGER_CHARGE_TYPE_LONGLIFE , CHARGER_CHARGE_TYPE_BYPASS
}
 Charge algorithm types. More...
 
enum  charger_health {
  CHARGER_HEALTH_UNKNOWN = 0 , CHARGER_HEALTH_GOOD , CHARGER_HEALTH_OVERHEAT , CHARGER_HEALTH_OVERVOLTAGE ,
  CHARGER_HEALTH_UNSPEC_FAILURE , CHARGER_HEALTH_COLD , CHARGER_HEALTH_WATCHDOG_TIMER_EXPIRE , CHARGER_HEALTH_SAFETY_TIMER_EXPIRE ,
  CHARGER_HEALTH_CALIBRATION_REQUIRED , CHARGER_HEALTH_WARM , CHARGER_HEALTH_COOL , CHARGER_HEALTH_HOT ,
  CHARGER_HEALTH_NO_BATTERY
}
 Charger health conditions. More...
 
enum  charger_notification_severity { CHARGER_SEVERITY_PEAK = 0 , CHARGER_SEVERITY_CRITICAL , CHARGER_SEVERITY_WARNING }
 Charger severity levels for system notifications. More...
 

Functions

int charger_get_prop (const struct device *dev, const charger_prop_t prop, union charger_propval *val)
 Fetch a battery charger property.
 
int charger_set_prop (const struct device *dev, const charger_prop_t prop, const union charger_propval *val)
 Set a battery charger property.
 
int charger_charge_enable (const struct device *dev, const bool enable)
 Enable or disable a charge cycle.
 

Detailed Description

Charger APIs.