5 #include <esp_adc_cal.h>
39 void install(
bool disableEmergencyShutdown =
false);
42 void setWarning(
bool on);
43 uint32_t rawToMv(uint32_t rawVal);
45 esp_adc_cal_characteristics_t m_adcChars;
47 std::atomic<uint32_t> m_raw;
48 std::atomic<uint32_t> m_voltageMv;
49 std::atomic<float> m_coef;
52 bool m_emergencyShutdown;
53 uint8_t m_undervoltedCounter;
Controls the expander pins.
Definition: Adafruit_MCP23017.h:24
Contains the battery state and can control the robot's power.
Definition: RBControl_battery.hpp:17
static constexpr uint32_t VOLTAGE_MAX
Maximal battery voltage, in mV.
Definition: RBControl_battery.hpp:22
static constexpr uint32_t VOLTAGE_MIN
Minimal battery voltage, in mV, at which the robot shuts down.
Definition: RBControl_battery.hpp:21
static constexpr uint32_t VOLTAGE_WARNING
The voltage at which alert triggers.
Definition: RBControl_battery.hpp:23
uint32_t voltageMv() const
returns current battery voltage
Definition: RBControl_battery.cpp:84
void setFineTuneCoef(float coef)
Tunes battery measurement to compensate e.g. for voltage divider error. Default 1,...
Definition: RBControl_battery.cpp:56
uint32_t pct() const
returns current battery percentage
Definition: RBControl_battery.cpp:88
uint32_t raw() const
returns the raw value
Definition: RBControl_battery.cpp:80
void shutdown()
shuts the robot down
Definition: RBControl_battery.cpp:69
static constexpr float BATT_DIVIDER
Voltage divider ratio.
Definition: RBControl_battery.hpp:24
float fineTuneCoef() const
Definition: RBControl_battery.cpp:65
Helper class for controlling the LEDs connected to the expander.
Definition: RBControl_leds.hpp:10
The main library class for working with the RBControl board. Call the install() method at the start o...
Definition: RBControl_manager.hpp:49
Helper class for controlling the piezo.
Definition: RBControl_piezo.hpp:10
The base namespace. Contains some logging functions, too.
Definition: half_duplex_uart.cpp:53