MAV'RIC
|
Battery voltage monitor. More...
#include <battery.hpp>
Public Member Functions | |
Battery (Adc &adc, battery_conf_t config=battery_default_config()) | |
Constructor. | |
bool | update (void) |
Updates the battery voltage level. | |
const float & | voltage (void) const |
Returns the level of the battery in volts. | |
const float & | level (void) const |
Returns the level of the battery in percents (from 0 to 100) | |
bool | is_low (void) const |
Indicates if the battery is low. |
Battery voltage monitor.
Battery::Battery | ( | Adc & | adc, |
battery_conf_t | config = battery_default_config() |
||
) |
Constructor.
adc | Reference to analog to digital converter |
config | Configuration |
bool Battery::is_low | ( | void | ) | const |
Indicates if the battery is low.
const float & Battery::level | ( | void | ) | const |
Returns the level of the battery in percents (from 0 to 100)
bool Battery::update | ( | void | ) |
Updates the battery voltage level.
battery | Pointer to the battery structure |
voltage | Update measured battery voltage |
const float & Battery::voltage | ( | void | ) | const |
Returns the level of the battery in volts.