Proof of concept: 2bpp greyscale LVGL display
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
# Andrew Villeneuve 2026/05
|
||||
# Waveshare 2.9inch Touch ePaper HAT integration demo
|
||||
#
|
||||
# Platform: https://www.waveshare.com/2.9inch-Touch-e-Paper-HAT.htm
|
||||
#
|
||||
# Pin mappings
|
||||
# ---
|
||||
# |Function |ESP Pin |HAT Pin |Wire |
|
||||
# |--- |--- |--- |--- |
|
||||
# |5V |VIN |Pin2/5V |Red |
|
||||
# |GND |GND |Pin6/GND |Blk |
|
||||
# |Display SCLK |GPIO23 |Pin23/GPIO11/SPI0_SCLK |Blue |
|
||||
# |Display MOSI |GPIO22 |Pin19/GPIO10/SPI0_MOSI |Green |
|
||||
# |Display CS |GPIO19 |Pin24/GPIO8/SPI0_CE0 |Mgnta |
|
||||
# |Display DC |GPIO18 |Pin22/GPIO25 |White |
|
||||
# |Display Busy |GPIO4 |Pin24/GPIO24 |Brown |
|
||||
# |Display RST |GPIO5 |Pin11/GPIO17/SPI1_CE1 |Orange |
|
||||
#
|
||||
# Exposed Entities
|
||||
# ---
|
||||
#
|
||||
|
||||
### Boilerplate ###
|
||||
|
||||
esphome:
|
||||
name: waveshare-epaper-test
|
||||
|
||||
esp32:
|
||||
board: nodemcu-32s
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: !secret enckey
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: !secret apipw
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wappw
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: ${fallbackssid}
|
||||
password: !secret hotspotpw
|
||||
|
||||
captive_portal:
|
||||
|
||||
### Setup Interfaces ###
|
||||
|
||||
# For the display
|
||||
spi:
|
||||
clk_pin: GPIO23
|
||||
mosi_pin: GPIO22
|
||||
|
||||
# For the touchscreen
|
||||
# ...
|
||||
|
||||
### Okay, now the Good Stuff ###
|
||||
|
||||
# Load some fonts for the display renderer (we don't neeed these with LVGL)
|
||||
font:
|
||||
- file: "FreeSans.ttf"
|
||||
id: font1
|
||||
size: 26
|
||||
bpp: 2
|
||||
- file: "FreeSans.ttf"
|
||||
id: headerfont
|
||||
size: 80
|
||||
- file: "FreeSans.ttf"
|
||||
id: console
|
||||
size: 30
|
||||
|
||||
# Pull in some icons from the material design library
|
||||
image:
|
||||
- file: "mdi:home-lock-open"
|
||||
id: home_lock_open
|
||||
type: binary
|
||||
transparency: chroma_key
|
||||
invert_alpha: true
|
||||
resize: 40x40
|
||||
|
||||
# Force a full display refresh when we press the "boot" button on the devboard
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO0
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
inverted: true
|
||||
id: boot_button
|
||||
internal: true
|
||||
on_press:
|
||||
then:
|
||||
- component.update: lvgl0
|
||||
- delay: 1s
|
||||
- component.update: display0
|
||||
|
||||
display:
|
||||
- platform: waveshare_epaper_2bit
|
||||
id: display0
|
||||
cs_pin: GPIO19
|
||||
dc_pin: GPIO18
|
||||
busy_pin: GPIO4
|
||||
reset_pin: GPIO5
|
||||
model: 2.90inv2-r2-2bpp
|
||||
full_update_every: 30
|
||||
rotation: 270°
|
||||
auto_clear_enabled: false
|
||||
update_interval: never
|
||||
# show_test_card: true
|
||||
# lambda: |-
|
||||
# it.print(0, 0, id(headerfont), "Bleat!");
|
||||
|
||||
lvgl:
|
||||
- id: lvgl0
|
||||
displays:
|
||||
- display0
|
||||
# on_draw_end:
|
||||
# - component.update: display0
|
||||
bg_color: 0xFFFFFF
|
||||
# Black: 0x000000
|
||||
# Dark Grey: 0x555555
|
||||
# Light Grey: 0xAAAAAA
|
||||
# White: 0xFFFFFF
|
||||
theme:
|
||||
label:
|
||||
text_color: 0x000000
|
||||
# button:
|
||||
# bg_color: 0x000000
|
||||
# text_color: 0xFFFFFF
|
||||
obj:
|
||||
bg_color: 0xFFFFFF
|
||||
widgets:
|
||||
- label:
|
||||
text: 'Test 2bpp 1326'
|
||||
align: TOP_LEFT
|
||||
text_font: font1
|
||||
# - label:
|
||||
# text: "0xFFFFFF"
|
||||
# text_color: 0xFFFFFF
|
||||
# x: 0
|
||||
# y: 15
|
||||
# - label:
|
||||
# text: "0xAAAAAA"
|
||||
# text_color: 0xAAAAAA
|
||||
# x: 0
|
||||
# y: 30
|
||||
# - label:
|
||||
# text: "0x555555"
|
||||
# text_color: 0x555555
|
||||
# x: 0
|
||||
# y: 45
|
||||
# - label:
|
||||
# text: "0x000000"
|
||||
# text_color: 0x000000
|
||||
# x: 0
|
||||
# y: 60
|
||||
- obj:
|
||||
align: BOTTOM_LEFT
|
||||
width: 33%
|
||||
height: 30%
|
||||
bg_color: 0x000000 #Black
|
||||
- obj:
|
||||
align: BOTTOM_MID
|
||||
width: 33%
|
||||
height: 30%
|
||||
bg_color: 0x555555 #Dark Grey
|
||||
- obj:
|
||||
align: BOTTOM_RIGHT
|
||||
width: 33%
|
||||
height: 30%
|
||||
bg_color: 0xAAAAAA #Light Grey
|
||||
- obj:
|
||||
align: TOP_RIGHT
|
||||
width: 33%
|
||||
height: 30%
|
||||
bg_color: 0xFFFFFF #White
|
||||
- obj:
|
||||
align: LEFT_MID
|
||||
width: 66%
|
||||
height: 30%
|
||||
bg_color: 0x000000
|
||||
bg_grad_color: 0xFFFFFF
|
||||
bg_grad_dir: HOR
|
||||
- button:
|
||||
id: button0
|
||||
align: TOP_RIGHT
|
||||
widgets:
|
||||
- image:
|
||||
src: home_lock_open
|
||||
|
||||
Reference in New Issue
Block a user