My Tab5 Extended GPIO and Power management library.
-
Hi all;
This is something I've been working on; a easy way of taking control of the Tab5's power management circuitry from vanilla MicroPython; without needing a special board build.
https://codeberg.org/easytarget/tab5-egpio-micropython
The README there has the full install and usage notes; plus a list of the (30!) methods it provides. This is deigned to be very simple in use; it is self-contained and lets you:
- Control power on/off for the WiFi chip, Speaker Amplifier, USB-A port and Expansion port 5V power.
- Switch WiFi between internal and external antennas
- Enable and disable battery charging, set the quick charge status, read the charge indicator pin.
- Read the battery voltage and current in/out.
- Detect if headphones are plugged in.
- Set LCD backlight brightness
- Trigger a poweroff event.
- Send reset signals to the LCD, TouchPanel and Camera modules.
Use it to create a power control object and set the device up as you need:
from tab5_egpio import TAB5_EGPIO tab5pwr = TAB5_EGPIO() tab5pwr.wlan_pwr_on() tab5pwr.charge_enable() # later (let the charge controller settle first) voltage, current = tab5pwr.battery_status() print('Battery: {:.2f}V @ {:.3f}A'.format(voltage, current))There are some demo's in the repo that show how to use this in more detail. And I have a page where I am documenting general hardware related Tab5 micropython information at: https://codeberg.org/easytarget/m5-tab5-micropython
[note: I'm cross-posting this here from the micropython official discussions, since it is specific to the Tab5]