Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
lampda::power::charger::Charger_t Struct Reference

Store the charger characteristics. More...

#include <charger.h>

Public Types

enum class  ChargerStatus_t {
  UNINITIALIZED , INACTIVE , POWER_DETECTED , SLOW_CHARGING ,
  CHARGING , CHARGE_FINISHED , ERROR_BATTERY_MISSING , ERROR_SOFTWARE ,
  ERROR_HARDWARE
}
 Indicates a charger status soecific states. More...
 

Public Member Functions

bool is_charging () const
 Return true when the status is charging or powered.
 
bool is_effectivly_charging () const
 Return true when the battery is truly charging.
 
bool is_charge_finished () const
 Return true if the charge is finished.
 
std::string get_status_str () const
 Return the status as a string.
 

Public Attributes

bool areMeasuresOk = false
 everything below makes no sense if this is false
 
bool isChargeOkSignalHigh
 True if we have a valid chargeOk signal from the component.
 
bool isInOtg
 True if OTG is activated.
 
uint32_t lastUpdateTime_ms = 0
 time of the last update of this struct.
 
uint16_t inputCurrent_mA = 0
 input current in VBUS side, in milliamps.
 
uint16_t chargeCurrent_mA = 0
 charge current of the battery, in milliamps.
 
uint16_t powerRail_mV = 0
 powerRail voltage (can be the same as VBUS in charge & OTG mode). Min value at 3200mV
 
uint16_t batteryVoltage_mV = 0
 battery voltage
 
int16_t batteryCurrent_mA = 0
 battery current (> 0 charging, < 0 discharging)
 
ChargerStatus_t status = ChargerStatus_t::UNINITIALIZED
 global high level charger status
 
std::string hardwareErrorMessage = ""
 Contain a more detailed error of an hardware error.
 
std::string softwareErrorMessage = ""
 Contain a more detailed error of a software error.
 

Detailed Description

Store the charger characteristics.

Member Enumeration Documentation

◆ ChargerStatus_t

Indicates a charger status soecific states.

Enumerator
UNINITIALIZED 

not initialized yet

INACTIVE 

no input power, charger is down

POWER_DETECTED 

charger detects power on the input

SLOW_CHARGING 

charging but very slowly

CHARGING 

currently charging the batteries

CHARGE_FINISHED 

charging process is done

ERROR_BATTERY_MISSING 

battery not detected

ERROR_SOFTWARE 

a software error was detected

ERROR_HARDWARE 

critical: some hardware is faulty


The documentation for this struct was generated from the following files: