35e0c12938d6e7ba5298193c3daa171ea72ea1be
m5core2 uses DC-DC3 to control brightness rather than using LDO2. DC-DC3 is controlled by the 7 least significant bits in the 0x27 register; the most significant bit is reserved. As a result the brightness value shifts left 3 places rather than 4. in order to set the register I read the entire byte, logical AND with 0x80 to clear all bits except the reserved bit, logical OR with the shifted brightness value. added brightness to the sample m5core2 config
ESPHome AXP192 Component
This custom component it to implement support for the AXP192 for both the M5Stick-C, and the M5Stack Core2, building on top of airy10's code.
Installation
Copy the components to a custom_components directory next to your .yaml configuration file.
Configuration
Sample configurations can be found within /sample-config. Please note that I've not yet been able to correctly configure the M5Stick-C screen just yet, however the AXP192 component does initalise it, and the sample configuration currently demostrates a white screen, when it should present some text. I plan to fix this soon.
This component adds a new model configuration to the AXP192 sensor, model: M5CORE2 & model: M5STICKC, as so the right pins are initalized and voltages go to the right places:
M5Stick-C
sensor:
- platform: axp192
model: M5STICKC
address: 0x34
i2c_id: bus_a
update_interval: 30s
battery_level:
name: "M5Stick Battery Level"
id: "m5stick_batterylevel"
M5Stack Core2
sensor:
- platform: axp192
model: M5CORE2
address: 0x34
i2c_id: bus_a
update_interval: 30s
battery_level:
name: "${upper_devicename} Battery Level"
id: "${devicename}_batterylevel"
Description
Languages
C++
91.2%
Python
8.8%