5#ifndef POWER_POWER_HANDLER_H
6#define POWER_POWER_HANDLER_H
10#include <etl/string.h>
94void set_temporary_output(
const uint16_t outputVoltage_mV,
const uint16_t outputCurrent_mA,
const uint16_t timeout_ms);
135void show_recovery_trace();
bool was_started_in_battery_recovery()
Indicates if the charger tried the battery recovery system.
Definition: power_handler.cpp:1186
bool go_to_error()
Set the power handler to ERROR mode (locked safety state)
Definition: power_handler.cpp:1120
bool enable_charge(const bool enable)
Block or allow the charging of the battery. Note that the system can still be in CHARGING_MODE mode i...
Definition: power_handler.cpp:1173
bool is_started()
Return true when power machine finally exits the STARTUP.
Definition: power_handler.cpp:1265
bool go_to_output_mode()
Set the power handler to main OUTPUT_VOLTAGE_MODE.
Definition: power_handler.cpp:1031
void show_recovery_diagnostics()
Read-only startup trace and current status. Does not initialize or enable charging.
Definition: power_handler.cpp:1195
bool is_output_mode_ready()
Return true when the current state is OUTPUT_VOLTAGE_MODE, and the desired voltage are set and gates ...
Definition: power_handler.cpp:196
etl::string< 128 > get_error_string()
Return the error string if set, or "x".
Definition: power_handler.cpp:137
bool go_to_charger_mode()
Set the power handler to battery CHARGING_MODE.
Definition: power_handler.cpp:1048
bool is_setup()
Return true if the power handler system is effectivly started.
Definition: power_handler.cpp:1263
bool go_to_idle()
Set the power handler to IDLE mode (no power output/input)
Definition: power_handler.cpp:1081
bool is_in_error_state()
Return true if the power handling is locked in an ERROR state. No power actions can be made.
Definition: power_handler.cpp:1028
void set_temporary_output(const uint16_t outputVoltage_mV, const uint16_t outputCurrent_mA, const uint16_t timeout)
Set a new output with a time limit, after wich the output will go back to the original values....
Definition: power_handler.cpp:1153
etl::string< 32 > get_state()
Return the current state, as a string.
Definition: power_handler.cpp:1179
bool is_in_output_mode()
Return true if the current state is OUTPUT_VOLTAGE_MODE.
Definition: power_handler.cpp:1184
void set_output_voltage_mv(const uint16_t outputVoltage_mV)
Set the desired output voltage of the charger.
Definition: power_handler.cpp:1129
void init()
Call once at system startup. This can fail, and it would set the state to ERROR.
Definition: power_handler.cpp:1267
bool go_to_shutdown()
Set the power handler to SHUTDOWN mode (last mode before shuting system down) The power thread shuts ...
Definition: power_handler.cpp:1091
bool is_in_otg_mode()
Return true if the current state is OTG_MODE.
Definition: power_handler.cpp:1185
bool go_to_otg_mode()
Set the power handler to OTG_MODE (eg: external battery mode)
Definition: power_handler.cpp:1059
bool is_in_in_battery_recovery()
Indicates that the system is currently attempting battery recovery.
Definition: power_handler.cpp:1187
void set_output_max_current_mA(const uint16_t outputCurrent_mA)
Set the desired maximum output current of the charger. This is just an information,...
Definition: power_handler.cpp:1146
Program scope.
Definition: control_fixed_modes.hpp:14