![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Chargers are not a separate class. A charger is a **struct rt_power_supply** with USB/mains **type** and properties such as **ONLINE**, **STATUS**, **CONSTANT_CHARGE_CURRENT_MAX**.
Core registration flow: Power supply.
Kconfig: **RT_POWER_SUPPLY_CHARGER_GPIO** → **components/drivers/power/supply/gpio-charger.c**.
Properties actually exposed depend on which GPIOs/mapping are present — the driver builds **properties[]** dynamically in **probe**.
| Property | Behavior |
|---|---|
**ONLINE** | Read VBUS GPIO |
**STATUS** | Charging vs not from **charge-status** GPIO |
**CONSTANT_CHARGE_CURRENT_MAX** | Mapping table + limit GPIOs; **set_property** selects limit |
**emu-power.c** (**RT_POWER_SUPPLY_EMU**): registers test battery + charger; MSH **emu_charger** toggles state for thermal/PM tests.
components/drivers/power/supply/gpio-charger.c