FreeRTOS:
Common I/O
AWS IoT Common I/O library
|
Return to main page ↑ |
This file contains all the Battery HAL API definitions. The APIs defined in this file helps with battery information and charging related functions. More...
Go to the source code of this file.
Data Structures | |
struct | IotBatteryInfo_t |
Battery information. More... | |
Macros | |
#define | IOT_BATTERY_SUCCESS ( 0 ) |
Return values used by BATTERY driver. More... | |
#define | IOT_BATTERY_INVALID_VALUE ( 1 ) |
#define | IOT_BATTERY_NOT_EXIST ( 2 ) |
#define | IOT_BATTERY_READ_FAILED ( 3 ) |
#define | IOT_BATTERY_FUNCTION_NOT_SUPPORTED ( 4 ) |
Typedefs | |
typedef struct IotBatteryDescriptor_t * | IotBatteryHandle_t |
IotBatteryHandle_t type is the Battery handle returned by calling iot_battery_open() this is initialized in open and returned to caller. Caller must pass this pointer to the rest of the APIs. | |
typedef void(* | IotBatteryCallback_t) (IotBatteryStatus_t xStatus, void *pvUserContext) |
Battery notification callback type. This callback is passed to the driver by using iot_battery_set_callback API. The callback is used to get the notifications about battery status changes for ex: when charging starts, or when critical threshold is reached or when battery is full etc... The callback is only used if the driver supports the asynchronous notifications. The caller must get the batteryInfo to find if the asynchronous notifications are supported. On simiple underlying batteries, the caller/application must manage the battery conditions by periodically probing the battery using read APIs, and for sophisticated battery management service modules, these can be managed in the HW hence asyncrhonous notifications can be sent (using registered callback) More... | |
Functions | |
IotBatteryHandle_t | iot_battery_open (int32_t lBatteryInstance) |
iot_battery_open is used to initialize the Battery and Charging driver. More... | |
void | iot_battery_set_callback (IotBatteryHandle_t const pxBatteryHandle, IotBatteryCallback_t xCallback, void *pvUserContext) |
iot_battery_set_callback is used to set the callback to be called when a notification needs to be sent to the caller. THe callback is only called if the battery supports async notifications. Caller must check isAsyncNotificationSupported value before registering for callbacks, if async is not supported, registering for callback has no affect, and the callback will never be called. More... | |
IotBatteryInfo_t * | iot_battery_getInfo (IotBatteryHandle_t const pxBatteryHandle) |
iot_battery_getInfo is used to get the battery info More... | |
int32_t | iot_battery_current (IotBatteryHandle_t const pxBatteryHandle, uint16_t *pusCurrent) |
iot_battery_current is used to get the battery current in mA. More... | |
int32_t | iot_battery_voltage (IotBatteryHandle_t const pxBatteryHandle, uint16_t *pusVoltage) |
iot_battery_voltage is used to get the battery voltage in milli-volts. More... | |
int32_t | iot_battery_chargeLevel (IotBatteryHandle_t const pxBatteryHandle, uint8_t *pucChargeLevel) |
iot_battery_chargeLevel is used to get the battery charging level in percentage (from 1 to 100). More... | |
int32_t | iot_battery_capacity (IotBatteryHandle_t const pxBatteryHandle, uint16_t *pusCapacity) |
iot_battery_capacity is used to get the current battery capacity value in mAh More... | |
int32_t | iot_battery_temp (IotBatteryHandle_t const pxBatteryHandle, int16_t *psTemp) |
iot_battery_temp is used to get the battery temperature in milliCelcius More... | |
int32_t | iot_battery_enable_charging (IotBatteryHandle_t const pxBatteryHandle, uint8_t *pucEnable) |
iot_battery_enable_charging is used to enable battery charging if charging is supported. if battery is already at full charge, enable will not charge battery until the charging level drops below 100, and even if battery is at critical level, and charging is not enabled, battery will not be charging. Charging is always enabled by default unless disabled by using this API. More... | |
int32_t | iot_battery_is_charging (IotBatteryHandle_t const pxBatteryHandle, uint8_t *pucCharging) |
iot_battery_is_charging is used to query if the battery is currently charging. More... | |
int32_t | iot_battery_ioctl (IotBatteryHandle_t const pxBatteryHandle, IotBatteryIoctlRequest_t xRequest, void *const pvBuffer) |
iot_battery_ioctl is used to set Battery configuration and Battery properties like battery threshold, temperature threshold, charging max, chargin min etc.. More... | |
int32_t | iot_battery_close (IotBatteryHandle_t const pxBatteryHandle) |
iot_battery_close is used to de-Initialize Battery driver. More... | |
This file contains all the Battery HAL API definitions. The APIs defined in this file helps with battery information and charging related functions.