#include <battery.hpp>
Public Types | |
enum | Level { Dangerous, Low, Healthy, Maximum } |
enum | Source { None, Adapter, Dock } |
enum | State { Discharging, Charged, Charging } |
Public Member Functions | |
Battery () | |
Battery (const uint8_t &new_voltage, const uint8_t &charger_flag) | |
Level | level () const |
float | percent () const |
Public Attributes | |
Source | charging_source |
State | charging_state |
double | voltage |
Static Public Attributes | |
static double | capacity = 16.5 |
static double | dangerous = 13.2 |
static double | low = 14.0 |
Battery level module.
Currently hard codes the battery status. It might be useful to provide some configurable parameters for this module in the future.
Definition at line 40 of file battery.hpp.
Enumerator | |
---|---|
Dangerous | |
Low | |
Healthy | |
Maximum |
Definition at line 47 of file battery.hpp.
Enumerator | |
---|---|
None | |
Adapter | |
Dock |
Definition at line 42 of file battery.hpp.
Enumerator | |
---|---|
Discharging | |
Charged | |
Charging |
Definition at line 53 of file battery.hpp.
|
inline |
Default constructor.
Definition at line 59 of file battery.hpp.
kobuki::Battery::Battery | ( | const uint8_t & | new_voltage, |
const uint8_t & | charger_flag | ||
) |
Configures the battery status given the current sensor readings.
new_voltage | : measured voltage*10 |
charger_flag | : bit flag representing charging status and source |
Definition at line 39 of file battery.cpp.
Battery::Level kobuki::Battery::level | ( | ) | const |
Definition at line 61 of file battery.cpp.
float kobuki::Battery::percent | ( | ) | const |
Definition at line 68 of file battery.cpp.
|
static |
Definition at line 64 of file battery.hpp.
Source kobuki::Battery::charging_source |
Definition at line 69 of file battery.hpp.
State kobuki::Battery::charging_state |
Definition at line 68 of file battery.hpp.
|
static |
Definition at line 66 of file battery.hpp.
|
static |
Definition at line 65 of file battery.hpp.
double kobuki::Battery::voltage |
Definition at line 67 of file battery.hpp.