Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
behavior.h
Go to the documentation of this file.
1
5#ifndef BEHAVIOR_HPP
6#define BEHAVIOR_HPP
7
8#include "src/compile.h"
9#include <cstdint>
10
11#include <etl/string.h>
12
13namespace lampda {
14namespace logic {
16namespace behavior {
17
22extern bool read_parameters();
23
27extern void write_parameters();
28
32extern bool is_user_code_running();
33
38extern void set_woke_up_from_vbus(const bool wokeUp);
39
40// main loop of the system
41extern void loop();
42
43etl::string<32> get_state();
44
46etl::string<128> get_error_state_message();
47
50
53
55void set_power_on();
57void set_power_off();
58
61
68
69namespace internal {
70
74void handle_shutdown_state();
75
77uint32_t get_bluetooth_auto_activation_left();
78
79} // namespace internal
80
81} // namespace behavior
82} // namespace logic
83} // namespace lampda
84
86#ifdef LMBD_CPP17
87extern const char* ensure_build_canary();
88#endif
89
90#endif
Compile definitions and sanity checks.
Charger_t get_state()
Return the latest known state of the charger.
Definition: charger.cpp:426
void write_parameters()
Write the parameters to the filesystem.
Definition: behavior.cpp:265
void set_power_on()
set system state to "output on"
Definition: behavior.cpp:142
bool is_user_code_running()
Definition: behavior.cpp:299
bool is_in_start_logic_state()
return true if the system is in start mode
Definition: behavior.cpp:155
void set_woke_up_from_vbus(const bool wokeUp)
call once at program start, before the first main loop runs The system was powered from a vbus powere...
Definition: behavior.cpp:847
bool is_in_charge_state()
return true if the system is in charge mode
Definition: behavior.cpp:157
bool read_parameters()
Load the parameters from the filesystem.
Definition: behavior.cpp:173
bool can_system_allowed_to_be_powered()
true if system can work at all (charger or output mode)
Definition: behavior.cpp:164
void set_power_off()
set system state to "output off". Can be ignored
Definition: behavior.cpp:143
bool is_system_should_be_powered()
Return true if the system is expected to power on.
Definition: behavior.cpp:141
etl::string< 128 > get_error_state_message()
return the error message associated with the error state
Definition: behavior.cpp:308
void go_to_external_battery_mode()
Try to switch to external battery mode.
Definition: behavior.cpp:152
bool is_in_output_state()
return true if the system is in output mode
Definition: behavior.cpp:156
void loop()
Called at each tick of the main loop.
Definition: default_behavior.hpp:179
Program scope.
Definition: control_fixed_modes.hpp:14