Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
balancer.h
Go to the documentation of this file.
1
5#ifndef BSP_BALANCER_H
6#define BSP_BALANCER_H
7
8#include <array>
9#include <cstdint>
10
11#include <etl/bitset.h>
12
14
15namespace lampda {
16namespace bsp {
17
19namespace balancer {
20
24struct Status
25{
27 std::array<uint16_t, physical_constants::batterySeriesCount> batteryVoltages_mV;
29 etl::bitset<physical_constants::batterySeriesCount> isBalancing;
34
37
39 bool is_valid() const;
40};
41
44
49bool init();
50
54void loop();
55
59void enable_balancing(bool enable);
60
64void go_to_sleep();
65
66} // namespace balancer
67} // namespace bsp
68} // namespace lampda
69
70#endif
void enable_balancing(bool enable)
enable the battery balancing process
Definition: balancer.cpp:377
bool init()
Call once on init.
Definition: balancer.cpp:263
Status get_status()
Return the status of the balancer.
Definition: balancer.cpp:255
void loop()
call often to refresh measurments
Definition: balancer.cpp:318
void go_to_sleep()
call before the system goes to sleep
Definition: balancer.cpp:392
Program scope.
Definition: control_fixed_modes.hpp:14
Store the balancer component status.
Definition: balancer.h:25
etl::bitset< physical_constants::batterySeriesCount > isBalancing
True if the cell is currently balancing.
Definition: balancer.h:29
uint16_t stackVoltage_mV
Voltage of the battery pack, in millivolts.
Definition: balancer.h:31
std::array< uint16_t, physical_constants::batterySeriesCount > batteryVoltages_mV
Cells voltages, in order.
Definition: balancer.h:27
uint16_t temperature_degrees
Temperature of the component, in degrees.
Definition: balancer.h:33
bool is_valid() const
True if this structure contains valid data.
Definition: balancer.cpp:29
uint32_t lastMeasurmentUpdate
Last time the measurment was updated, in milliseconds.
Definition: balancer.h:36
Define the system hardware constants.