Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_module_battery

Driver for Battery Module. More...

Enumerations

enum  bc_module_battery_format_t {
  BC_MODULE_BATTERY_FORMAT_UNKNOWN = 0,
  BC_MODULE_BATTERY_FORMAT_STANDARD = 1,
  BC_MODULE_BATTERY_FORMAT_MINI = 2
}
 Battery Module format. More...
 
enum  bc_module_battery_event_t {
  BC_MODULE_BATTERY_EVENT_LEVEL_LOW = 0,
  BC_MODULE_BATTERY_EVENT_LEVEL_CRITICAL = 1,
  BC_MODULE_BATTERY_EVENT_UPDATE = 2,
  BC_MODULE_BATTERY_EVENT_ERROR = 3
}
 Battery Module event. More...
 

Functions

void bc_module_battery_init (void)
 Initialize Battery Module.
 
void bc_module_battery_set_event_handler (void(*event_handler)(bc_module_battery_event_t, void *), void *event_param)
 Set callback function. More...
 
void bc_module_battery_set_update_interval (bc_tick_t interval)
 Set update interval. More...
 
void bc_module_battery_set_threshold_levels (float level_low_threshold, float level_critical_threshold)
 Set voltage levels. More...
 
bc_module_battery_format_t bc_module_battery_get_format ()
 Get Battery Module format.
 
bool bc_module_battery_measure (void)
 Start mesurement. More...
 
bool bc_module_battery_get_voltage (float *voltage)
 Get Battery Module voltage. More...
 
bool bc_module_battery_get_charge_level (int *percentage)
 Get Battery Module charge in percents. More...
 
bool bc_module_battery_is_present (void)
 Get Battery Module is pressent, can use without bc_module_battery_init.
 

Detailed Description

Driver for Battery Module.

Enumeration Type Documentation

Battery Module event.

Enumerator
BC_MODULE_BATTERY_EVENT_LEVEL_LOW 

Event low level.

BC_MODULE_BATTERY_EVENT_LEVEL_CRITICAL 

Event critical level.

BC_MODULE_BATTERY_EVENT_UPDATE 

Event update.

BC_MODULE_BATTERY_EVENT_ERROR 

Event error.

Definition at line 27 of file bc_module_battery.h.

Battery Module format.

Enumerator
BC_MODULE_BATTERY_FORMAT_UNKNOWN 

Format is unknown.

BC_MODULE_BATTERY_FORMAT_STANDARD 

Format is standard 4xAAA.

BC_MODULE_BATTERY_FORMAT_MINI 

Format is mini 2xAAA.

Definition at line 12 of file bc_module_battery.h.

Function Documentation

bool bc_module_battery_get_charge_level ( int *  percentage)

Get Battery Module charge in percents.

Parameters
[out]percentageMeasured charge
Returns
true On success
false On failure

Definition at line 129 of file bc_module_battery.c.

Here is the call graph for this function:

bool bc_module_battery_get_voltage ( float *  voltage)

Get Battery Module voltage.

Parameters
[out]voltageMeasured voltage
Returns
true On success
false On failure

Definition at line 122 of file bc_module_battery.c.

Referenced by bc_module_battery_get_charge_level().

Here is the caller graph for this function:

bool bc_module_battery_measure ( void  )

Start mesurement.

Returns
true On success
false On failure

Definition at line 108 of file bc_module_battery.c.

Referenced by bc_module_battery_set_update_interval().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_module_battery_set_event_handler ( void(*)(bc_module_battery_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 74 of file bc_module_battery.c.

void bc_module_battery_set_threshold_levels ( float  level_low_threshold,
float  level_critical_threshold 
)

Set voltage levels.

Parameters
[in]level_low_thresholdVoltage level considered as low
[in]level_critical_thresholdVoltage level considered as critical

Definition at line 97 of file bc_module_battery.c.

void bc_module_battery_set_update_interval ( bc_tick_t  interval)

Set update interval.

Parameters
[in]intervalUpdate interval

Definition at line 80 of file bc_module_battery.c.

Here is the call graph for this function: