Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
balancer.h
Go to the documentation of this file.
1
5#ifndef POWER_BALANCER_H
6#define POWER_BALANCER_H
7
8#include <array>
9#include <cstdint>
10
12
13namespace lampda {
14namespace power {
15
17namespace balancer {
18
22struct Status
23{
25 std::array<uint16_t, batteryCount> batteryVoltages_mV;
27 std::array<bool, batteryCount> isBalancing;
32
35
37 bool is_valid() const;
38};
39
42
47bool init();
48
52void loop();
53
57void enable_balancing(bool enable);
58
62void go_to_sleep();
63
64} // namespace balancer
65} // namespace power
66} // namespace lampda
67
68#endif
void go_to_sleep()
call before the system goes to sleep
Definition: balancer.cpp:358
Status get_status()
Return the status of the balancer.
Definition: balancer.cpp:230
void enable_balancing(bool enable)
enable the battery balancing process
Definition: balancer.cpp:343
void loop()
call often to refresh measurments
Definition: balancer.cpp:287
bool init()
Call once on init.
Definition: balancer.cpp:232
Program scope.
Definition: control_fixed_modes.hpp:12
Store the balancer component status.
Definition: balancer.h:23
bool is_valid() const
True if this structure contains valid data.
Definition: balancer.cpp:27
std::array< uint16_t, batteryCount > batteryVoltages_mV
Cells voltages, in order.
Definition: balancer.h:25
uint16_t temperature_degrees
Temperature of the component, in degrees.
Definition: balancer.h:31
std::array< bool, batteryCount > isBalancing
True if the cell is currently balancing.
Definition: balancer.h:27
uint16_t stackVoltage_mV
Voltage of the battery pack, in millivolts.
Definition: balancer.h:29
uint32_t lastMeasurmentUpdate
Last time the measurment was updated, in milliseconds.
Definition: balancer.h:34
Define the system hardware constants.