|
|
static void | publish_state () |
| | Publish the working charger state to the readers.
|
| |
|
bool | should_charge () |
| |
| void | control_OTG (const uint16_t mv, const uint16_t ma) |
| | Set the OTG control parameters. Set the parameters to zero to disable OTG mode.
|
| |
|
bool | is_status_error () |
| |
|
void | update_state_status () |
| |
|
void | update_state () |
| |
|
bool | setup () |
| | call once at program startup
|
| |
|
void | loop () |
| | call at every loop runs
|
| |
|
void | shutdown () |
| | Call when system goes to sleep.
|
| |
|
void | set_enable_charge (const bool shouldCharge) |
| | debug feature: enable/disable the charging process
|
| |
|
bool | is_vbus_powered () |
| | Return true if voltage is detected on VBUS.
|
| |
|
bool | can_use_vbus_power () |
| | Return true if we are allowed to use the VBUS power.
|
| |
|
bool | is_vbus_signal_detected () |
| | Return true if the USB VBUS presence signal is active.
|
| |
|
Charger_t | get_state () |
| | Return the latest known state of the charger.
|
| |
|
|
static policy::ChargeLimiter | chargeLimiter_s |
| | Charge stop rules state (battery full, over voltage)
|
| |
|
static bool | enableCharge_s = true |
| |
|
static BatteryStatus_t | batteryStatus |
| |
|
static Charger_t | charger |
| | Working charger state: only accessed by the power thread, that runs the charger loop.
|
| |
|
static Charger_t | publishedCharger |
| | Copy of the charger state given to the readers of all threads, see get_state(). The power thread updates it from charger once its update is complete: only access it under _publishedChargerMutex.
|
| |
|
static hal::mutex::hal_mutex_t | _publishedChargerMutex |
| | Guards publishedCharger: a reader never sees a partial update (status, measurements and error messages). Not recursive.
|
| |
| static const bool | _isPublishedChargerMutexInit |
| | Initialized at program start: the state can be read before the charger setup.
|
| |
|
bool | isOtgEnabled_s = false |
| |
| bool | isSetup = false |
| |
|
const hal::gpio::DigitalPin | chargeOkPin (hal::gpio::DigitalPin::GPIO::Input_isChargeOk) |
| |
Handles the battery charging processes, and power output control.