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#include <string>
11
12namespace lampda {
13namespace logic {
15namespace behavior {
16
21extern bool read_parameters();
22
26extern bool is_user_code_running();
27
32extern void set_woke_up_from_vbus(const bool wokeUp);
33
34// main loop of the system
35extern void loop();
36
37std::string get_state();
38
40std::string get_error_state_message();
41
44
47
49void set_power_on();
51void set_power_off();
52
55
62
63namespace internal {
64
70void handle_shutdown_state(const bool shouldSaveUserParameters = true, const bool shouldSaveSystemParameters = true);
71
73uint32_t get_bluetooth_auto_activation_left();
74
75} // namespace internal
76
77namespace sunset {
79void progress_update(const float progress);
80} // namespace sunset
81
82} // namespace behavior
83} // namespace logic
84} // namespace lampda
85
87#ifdef LMBD_CPP17
88extern const char* ensure_build_canary();
89#endif
90
91#endif
Compile definitions and sanity checks.
void set_power_on()
set system state to "output on"
Definition: behavior.cpp:123
bool is_user_code_running()
Definition: behavior.cpp:283
bool is_in_start_logic_state()
return true if the system is in start mode
Definition: behavior.cpp:136
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:824
bool is_in_charge_state()
return true if the system is in charge mode
Definition: behavior.cpp:138
bool read_parameters()
Load the parameters from the filesystem.
Definition: behavior.cpp:161
bool can_system_allowed_to_be_powered()
true if system can work at all (charger or output mode)
Definition: behavior.cpp:152
std::string get_error_state_message()
return the error message associated with the error state
Definition: behavior.cpp:343
void set_power_off()
set system state to "output off". Can be ignored
Definition: behavior.cpp:124
bool is_system_should_be_powered()
Return true if the system is expected to power on.
Definition: behavior.cpp:122
void go_to_external_battery_mode()
Try to switch to external battery mode.
Definition: behavior.cpp:133
bool is_in_output_state()
return true if the system is in output mode
Definition: behavior.cpp:137
void loop()
Called at each tick of the main loop.
Definition: default_behavior.hpp:139
Program scope.
Definition: control_fixed_modes.hpp:12