|
Lamp-Da 0.1
A compact lantern project
|
Hardware driver interactions for the charger component. More...
Classes | |
| struct | Battery |
| Store the battery specific measurments ans status. It is a refined data version of the Measurments class. More... | |
| struct | Measurments |
| Store the DAC values mesured by some system sensors, relative to the battery and power. More... | |
| struct | PowerLimits |
| Store the power limits for the battery charge protocol. More... | |
Typedefs | |
| using | charger_ic = bq25713::BQ25713 |
Enumerations | |
| enum class | Status_t { UNINITIALIZED , NOMINAL , ERROR , ERROR_COMPONENT , ERROR_HAS_FAULTS } |
| Store the status of the charge component. More... | |
| enum class | ChargeStatus_t { OFF , PRECHARGE , FASTCHARGE , SLOW_CHARGE } |
| Status of the charge process. More... | |
Functions | |
| std::string | get_software_error_message () |
| contains details on software error if any | |
| void | set_software_error_message (const std::string &msg) |
| void | run_fault_detection () |
| void | run_status_update () |
| void | control_charge () |
| void | control_OTG () |
| void | enable_charge (const bool enable) |
| Enable the charge process. this will start the charge only if the conditions are right. | |
| void | enable_input_current_optimization (const bool enable) |
| enable/disable the Input Current Optimizer algorithm | |
| void | update_battery () |
| void | run_ADC () |
| void | program_input_current_limit () |
| bool | enable (const uint16_t minSystemVoltage_mV, const uint16_t maxBatteryVoltage_mV, const uint16_t maxChargingCurrent_mA, const uint16_t maxDichargingCurrent_mA, const bool forceReset=false) |
| Call once on program start. | |
| void | loop (const bool isChargeOk) |
| Call often during execution. | |
| void | shutdown () |
| call on program stop to gracefully shutdown the component. | |
| void | set_input_current_limit (const uint16_t maxInputCurrent_mA, const bool shouldUseICO) |
| Set the input current limit. | |
| uint16_t | get_charge_current () |
| return the actual charge current, in milliamps. | |
| bool | is_input_source_present () |
| return true if an input source is present for the charger on the USB port. | |
| void | try_clear_faults () |
| try to clear the faults that can be cleared. if this succeeds, the status will be to NOMINAL next loop call. | |
| void | enable_OTG () |
| Enable the OTG and disable the charging process. | |
| void | disable_OTG () |
| Disable the OTG. | |
| void | set_OTG_targets (const uint16_t voltage_mV, const uint16_t maxCurrent_mA) |
| set the desired OTG capabilities | |
| bool | is_in_OTG () |
| Return true if the system is in OTG mode. | |
| Status_t | get_status () |
| return the status of the component | |
| std::string | get_status_detail () |
| return a string with details on the error status | |
| ChargeStatus_t | get_charge_status () |
| return the charge status object of the battery | |
| Measurments | get_measurments () |
| Battery | get_battery () |
Variables | |
| charger_ic | chargerIc |
| charger_ic::Regt | chargerIcRegisters |
| static Measurments | measurments_s |
| static Battery | battery_s |
| static Status_t | status_s = Status_t::UNINITIALIZED |
| static std::string | status_error = "" |
| static ChargeStatus_t | chargeStatus_s = ChargeStatus_t::OFF |
| static bool | isChargeOk_s = false |
| static bool | isChargeEnabled_s = false |
| static bool | isInOtg_s = false |
| std::string | softwareError_detail = "" |
| static PowerLimits | powerLimits_s |
| define the power limits for input power | |
| bool | isInit = false |
Hardware driver interactions for the charger component.
|
strong |
|
strong |
| bool lampda::power::charger::drivers::enable | ( | const uint16_t | minSystemVoltage_mV, |
| const uint16_t | maxBatteryVoltage_mV, | ||
| const uint16_t | maxChargingCurrent_mA, | ||
| const uint16_t | maxDichargingCurrent_mA, | ||
| const bool | forceReset = false |
||
| ) |
Call once on program start.
| [in] | minSystemVoltage_mV | Minimal allowed battery voltage. |
| [in] | maxBatteryVoltage_mV | Maximal allowed battery voltage |
| [in] | maxChargingCurrent_mA | Maximum allowed charge current for the battery. |
| [in] | maxDichargingCurrent_mA | Maximum allowed discharging current of the battery. |
| [in] | forceReset | If true, will reset the internal registers of the component. |
| void lampda::power::charger::drivers::enable_input_current_optimization | ( | const bool | enable | ) |
enable/disable the Input Current Optimizer algorithm
| [in] | enable | If true, the InputCurrentOptimization algorithm will be activated and the VBUS charge current will be optimized to reach a target droop voltage |
| void lampda::power::charger::drivers::loop | ( | const bool | isChargeOk | ) |
Call often during execution.
| [in] | isChargeOk | Should match what is read on the CHRG_OK IC pin of the charger. |
| void lampda::power::charger::drivers::set_input_current_limit | ( | const uint16_t | maxInputCurrent_mA, |
| const bool | shouldUseICO | ||
| ) |
Set the input current limit.
| [in] | maxInputCurrent_mA | Maximum allowed current use on VBUS, in milliamps. |
| [in] | shouldUseICO | If True, the InputCurrentInitialization will be used. It automatically finds the most allowed current. |
| bool lampda::power::charger::drivers::isInit = false |
HEADER FUNCTIONS