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
77 lines
1.3 KiB
YAML
77 lines
1.3 KiB
YAML
esphome:
|
|
name: m5stack-core2
|
|
platform: ESP32
|
|
board: m5stack-core-esp32
|
|
|
|
# Use this to hardlink the component if it is not discovered
|
|
# includes:
|
|
# - /config/custom_components/axp192/axp192.h
|
|
|
|
wifi:
|
|
ssid: "SSID"
|
|
password: "PASSPHRASE"
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "XXX"
|
|
password: "XXX"
|
|
|
|
substitutions:
|
|
devicename: ${devicename}
|
|
upper_devicename: ${upper_devicename}
|
|
|
|
captive_portal:
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
|
|
ota:
|
|
|
|
web_server:
|
|
|
|
# AXP192 power management - must be present to initialize TFT power on
|
|
sensor:
|
|
- platform: axp192
|
|
model: M5CORE2
|
|
address: 0x34
|
|
i2c_id: bus_a
|
|
update_interval: 30s
|
|
brightness: 75%
|
|
battery_level:
|
|
name: "${upper_devicename} Battery Level"
|
|
id: "${devicename}_batterylevel"
|
|
|
|
- platform: wifi_signal
|
|
name: ${upper_devicename} WiFi Signal
|
|
id: wifi_dbm
|
|
- platform: uptime
|
|
name: ${upper_devicename} Uptime
|
|
|
|
spi:
|
|
clk_pin: GPIO18
|
|
mosi_pin: GPIO23
|
|
miso_pin: GPIO38
|
|
|
|
i2c:
|
|
- id: bus_a
|
|
sda: GPIO21
|
|
scl: GPIO22
|
|
scan: True
|
|
|
|
font:
|
|
- file: 'fonts/arial.ttf'
|
|
id: font1
|
|
size: 8
|
|
|
|
# # builtin 80x160 TFT
|
|
display:
|
|
- platform: ili9341
|
|
model: M5STACK
|
|
cs_pin: 5
|
|
dc_pin: 15
|
|
lambda: |-
|
|
it.line(20, 20, 200, 200);
|