|
Lamp-Da 0.1
A compact lantern project
|
Entry point of the battery charging and power gate behavior, implemented as a state machine. More...
Go to the source code of this file.
Namespaces | |
| namespace | lampda |
| Program scope. | |
| namespace | lampda::logic |
| Handle the main high level logics. | |
| namespace | lampda::logic::power |
| Main entry point of the power handling of the board. Responsible the main state of the power handling. | |
Functions | |
| void | lampda::logic::power::init () |
| Call once at system startup. This can fail, and it would set the state to ERROR. | |
| bool | lampda::logic::power::is_setup () |
| Return true if the power handler system is effectivly started. | |
| bool | lampda::logic::power::is_started () |
| Return true when power machine finally exits the STARTUP. | |
| bool | lampda::logic::power::is_in_error_state () |
| Return true if the power handling is locked in an ERROR state. No power actions can be made. | |
| bool | lampda::logic::power::go_to_output_mode () |
| Set the power handler to main OUTPUT_VOLTAGE_MODE. | |
| bool | lampda::logic::power::go_to_charger_mode () |
| Set the power handler to battery CHARGING_MODE. | |
| bool | lampda::logic::power::go_to_otg_mode () |
| Set the power handler to OTG_MODE (eg: external battery mode) | |
| bool | lampda::logic::power::go_to_idle () |
| Set the power handler to IDLE mode (no power output/input) | |
| bool | lampda::logic::power::go_to_shutdown () |
| Set the power handler to SHUTDOWN mode (last mode before shuting system down) | |
| bool | lampda::logic::power::go_to_error () |
| Set the power handler to ERROR mode (locked safety state) | |
| void | lampda::logic::power::set_output_voltage_mv (const uint16_t outputVoltage_mV) |
| Set the desired output voltage of the charger. | |
| void | lampda::logic::power::set_output_max_current_mA (const uint16_t outputCurrent_mA) |
| Set the desired maximum output current of the charger. This is just an information, that will be used when the state machine reaches the OUTPUT_VOLTAGE_MODE state. | |
| void | lampda::logic::power::set_temporary_output (const uint16_t outputVoltage_mV, const uint16_t outputCurrent_mA, const uint16_t timeout_ms) |
| Set a new output with a time limit, after wich the output will go back to the original values. It is canceled at any point by a call to set_output_voltage_mv. This is just an information, that will be used when the state machine reaches the OUTPUT_VOLTAGE_MODE state. | |
| bool | lampda::logic::power::enable_charge (const bool) |
| Block or allow the charging of the battery. Note that the system can still be in CHARGING_MODE mode if you set this to false, but the battery just wont charge. | |
| std::string | lampda::logic::power::get_state () |
| Return the current state, as a string. | |
| std::string | lampda::logic::power::get_error_string () |
| Return the error string if set, or "x". | |
| bool | lampda::logic::power::is_output_mode_ready () |
| Return true when the current state is OUTPUT_VOLTAGE_MODE, and the desired voltage are set and gates are ready. Basically, it returns true when the output is being powered. | |
| bool | lampda::logic::power::is_in_output_mode () |
| Return true if the current state is OUTPUT_VOLTAGE_MODE. | |
| bool | lampda::logic::power::is_in_otg_mode () |
| Return true if the current state is OTG_MODE. | |
| bool | lampda::logic::power::was_started_in_battery_recovery () |
| Indicates if the charger tried the battery recovery system. | |
Entry point of the battery charging and power gate behavior, implemented as a state machine.