FreeRTOS:
Common I/O
AWS IoT Common I/O library
|
Return to main page ↑ |
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... | |
#define IOT_BATTERY_SUCCESS ( 0 ) |
Return values used by BATTERY driver.
Battery operation completed successfully.
#define IOT_BATTERY_INVALID_VALUE ( 1 ) |
At least one parameter is invalid.
#define IOT_BATTERY_NOT_EXIST ( 2 ) |
No battery exists in this hardware.
#define IOT_BATTERY_READ_FAILED ( 3 ) |
Battery read operation failed.
#define IOT_BATTERY_FUNCTION_NOT_SUPPORTED ( 4 ) |
Battery operation not supported.
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)
[in] | xStatus | battery status from IotBatteryStatus_t |
[in] | pvUserContext | User Context passed when setting the callback. This is not used by the driver, but just passed back to the user in the callback. |
enum IotBatteryType_t |
enum IotBatteryStatus_t |
Battery status.
Ioctl request types.
IotBatteryHandle_t iot_battery_open | ( | int32_t | lBatteryInstance | ) |
iot_battery_open is used to initialize the Battery and Charging driver.
[in] | lBatteryInstance | The instance of the battery interface to initialize. Usually, there is only one battery interface. |
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.
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[in] | xCallback | callback function to be called. |
[in] | pvUserContext | user context to be passed when callback is called. |
IotBatteryInfo_t* iot_battery_getInfo | ( | IotBatteryHandle_t const | pxBatteryHandle | ) |
iot_battery_getInfo is used to get the battery info
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
int32_t iot_battery_current | ( | IotBatteryHandle_t const | pxBatteryHandle, |
uint16_t * | pusCurrent | ||
) |
iot_battery_current is used to get the battery current in mA.
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[out] | pusCurrent | battery current value. |
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.
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[out] | pusVoltage | battery voltage value. |
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).
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[out] | pucChargeLevel | battery charging value. |
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
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[out] | pusCapacity | battery capacity value. |
int32_t iot_battery_temp | ( | IotBatteryHandle_t const | pxBatteryHandle, |
int16_t * | psTemp | ||
) |
iot_battery_temp is used to get the battery temperature in milliCelcius
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[out] | psTemp | battery temperature in milliCelcius |
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.
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[in] | pucEnable | Enable or Disable the charging of battery. set to 1 to enable, or 0 to disable. |
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.
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[out] | pucCharging | If charging this will contain value of 1 otherwise 0. |
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..
[in] | pxBatteryHandle | handle to Battery driver returned in iot_battery_open() |
[in] | xRequest | configuration request of type IotBatteryIoctlRequest_t |
[in,out] | pvBuffer | buffer holding Battery set and get values. |
int32_t iot_battery_close | ( | IotBatteryHandle_t const | pxBatteryHandle | ) |
iot_battery_close is used to de-Initialize Battery driver.
[in] | pxBatteryHandle | handle to Battery interface. |