LPC SPI Firmware and Driver Prototype

no problem!
I’ve added power_supply driver class support based on the properties currently available in the lpc. existing power apps now recognize the battery and its state, after the lpc calibrates itself through a full charge cycle.

An interface to poll the cell voltage and lpc charge state is also present, though unused in the power_supply sys class.

  native-path:          8xlifepo4
  power supply:         yes
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    energy:              48.9942 Wh
    energy-empty:        0 Wh
// -- obv incorrect, result of battery not being calibrated yet
    energy-full:         79.9064 Wh 
    energy-full-design:  51.6258 Wh
    energy-rate:         5.39929 W
    voltage:             27.219 V
    charge-cycles:       N/A
    percentage:          100%
    capacity:            100%
    technology:          lithium-iron-phosphate
    icon-name:          'battery-full-charged-symbolic'
POWER_SUPPLY_NAME=8xlifepo4
POWER_SUPPLY_TYPE=Unknown
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_TECHNOLOGY=LiFe
POWER_SUPPLY_VOLTAGE_NOW=27136000
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CHARGE_FULL_DESIGN=1800000
POWER_SUPPLY_CHARGE_NOW=1800000
POWER_SUPPLY_CHARGE_EMPTY=430000
2 Likes