Firmware SDK
|
Driver for Battery Module. More...
Enumerations | |
enum | twr_module_battery_format_t { TWR_MODULE_BATTERY_FORMAT_UNKNOWN = 0 , TWR_MODULE_BATTERY_FORMAT_STANDARD = 1 , TWR_MODULE_BATTERY_FORMAT_MINI = 2 } |
Battery Module format. More... | |
enum | twr_module_battery_event_t { TWR_MODULE_BATTERY_EVENT_LEVEL_LOW = 0 , TWR_MODULE_BATTERY_EVENT_LEVEL_CRITICAL = 1 , TWR_MODULE_BATTERY_EVENT_UPDATE = 2 , TWR_MODULE_BATTERY_EVENT_ERROR = 3 } |
Battery Module event. More... | |
Functions | |
void | twr_module_battery_init (void) |
Initialize Battery Module. | |
void | twr_module_battery_set_event_handler (void(*event_handler)(twr_module_battery_event_t, void *), void *event_param) |
Set callback function. More... | |
void | twr_module_battery_set_update_interval (twr_tick_t interval) |
Set update interval. More... | |
void | twr_module_battery_set_threshold_levels (float level_low_threshold, float level_critical_threshold) |
Set voltage levels. More... | |
twr_module_battery_format_t | twr_module_battery_get_format () |
Get Battery Module format. | |
bool | twr_module_battery_measure (void) |
Start mesurement. More... | |
bool | twr_module_battery_get_voltage (float *voltage) |
Get Battery Module voltage. More... | |
bool | twr_module_battery_get_charge_level (int *percentage) |
Get Battery Module charge in percents. More... | |
bool | twr_module_battery_is_present (void) |
Get Battery Module is pressent, can use without twr_module_battery_init. | |
Driver for Battery Module.
Battery Module event.
Definition at line 27 of file twr_module_battery.h.
Battery Module format.
Enumerator | |
---|---|
TWR_MODULE_BATTERY_FORMAT_UNKNOWN | Format is unknown. |
TWR_MODULE_BATTERY_FORMAT_STANDARD | Format is standard 4xAAA. |
TWR_MODULE_BATTERY_FORMAT_MINI | Format is mini 2xAAA. |
Definition at line 12 of file twr_module_battery.h.
bool twr_module_battery_get_charge_level | ( | int * | percentage | ) |
Get Battery Module charge in percents.
[out] | percentage | Measured charge |
Definition at line 131 of file twr_module_battery.c.
bool twr_module_battery_get_voltage | ( | float * | voltage | ) |
Get Battery Module voltage.
[out] | voltage | Measured voltage |
Definition at line 124 of file twr_module_battery.c.
Referenced by twr_module_battery_get_charge_level().
bool twr_module_battery_measure | ( | void | ) |
Start mesurement.
Definition at line 108 of file twr_module_battery.c.
Referenced by twr_module_battery_set_update_interval().
void twr_module_battery_set_event_handler | ( | void(*)(twr_module_battery_event_t, void *) | event_handler, |
void * | event_param | ||
) |
Set callback function.
[in] | event_handler | Function address |
[in] | event_param | Optional event parameter (can be NULL) |
Definition at line 74 of file twr_module_battery.c.
void twr_module_battery_set_threshold_levels | ( | float | level_low_threshold, |
float | level_critical_threshold | ||
) |
Set voltage levels.
[in] | level_low_threshold | Voltage level considered as low |
[in] | level_critical_threshold | Voltage level considered as critical |
Definition at line 97 of file twr_module_battery.c.
void twr_module_battery_set_update_interval | ( | twr_tick_t | interval | ) |
Set update interval.
[in] | interval | Update interval |
Definition at line 80 of file twr_module_battery.c.