mirror of
https://github.com/arendst/Tasmota.git
synced 2026-07-27 20:05:46 +00:00
Support for M5Stack Atom S3R drivers (#24747)
This commit is contained in:
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||
### Added
|
||||
- Support for Modbus RX Enable GPIO (#24726)
|
||||
- Support for hostname generation using single-specifier Format() patterns (#24731)
|
||||
- Support for M5Stack Atom S3R drivers
|
||||
|
||||
### Breaking Changed
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class I2C_Driver
|
||||
if self.name == nil self.wire = nil end
|
||||
|
||||
if self.wire
|
||||
print("I2C:", self.name, "detected on bus", self.wire.bus)
|
||||
log("I2C:", self.name, "detected on bus", self.wire.bus, 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,42 @@
|
||||
###############################################################
|
||||
# Specialized driver for LP5562 on M5Stack S3R
|
||||
#
|
||||
# This driver controls the backlighting of the screen
|
||||
###############################################################
|
||||
|
||||
# This code is ported from https://github.com/m5stack/M5GFX/blob/master/src/M5GFX.cpp
|
||||
# `struct Light_M5StackAtomS3R : public lgfx::ILight`
|
||||
class M5Stack_S3R_LP5562 : I2C_Driver
|
||||
def init(addr)
|
||||
if (addr == nil) addr = 0x30 end # default address is 0x30
|
||||
super(self, I2C_Driver).init("LP5562", 0x30)
|
||||
|
||||
if self.wire # if found
|
||||
import display
|
||||
|
||||
self.write8(0x00, 0x40)
|
||||
tasmota.delay(1)
|
||||
self.write8(0x08, 0x01)
|
||||
self.write8(0x70, 0x00)
|
||||
|
||||
self.set_displaydimmer(display.dimmer()) # apply dimmer value on start
|
||||
|
||||
tasmota.add_driver(self) # register this driver
|
||||
end
|
||||
end
|
||||
|
||||
# Dimmer in percentage
|
||||
def set_displaydimmer(x)
|
||||
self.write8(0x0e, tasmota.scale_uint(x, 0, 100, 0, 255))
|
||||
end
|
||||
|
||||
# respond to display events
|
||||
def display(cmd, idx, payload, raw)
|
||||
if cmd == "dim" || cmd == "power"
|
||||
self.set_displaydimmer(idx)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return M5Stack_S3R_LP5562()
|
||||
@@ -0,0 +1,34 @@
|
||||
:H,GC9107,128,128,16,SPI,1,*,*,*,*,*,*,*,16
|
||||
:I
|
||||
FE,A0
|
||||
EF,A0
|
||||
3A,1,55
|
||||
B0,1,C0
|
||||
B2,1,2F
|
||||
B3,1,03
|
||||
B6,1,19
|
||||
B7,1,01
|
||||
AC,1,CB
|
||||
AB,1,0E
|
||||
B4,1,04
|
||||
A8,1,19
|
||||
B8,1,08
|
||||
E8,1,24
|
||||
E9,1,48
|
||||
EA,1,22
|
||||
C6,1,30
|
||||
C7,1,18
|
||||
F0,0E,01,2b,23,3c,b7,12,17,60,00,06,0c,17,12,1f
|
||||
F1,0E,05,2e,2d,44,d6,15,17,a0,02,0d,0d,1a,18,1f
|
||||
11,80
|
||||
29,0
|
||||
:o,28
|
||||
:O,29
|
||||
:A,2A,2B,2C
|
||||
:R,36
|
||||
:0,08,00,20,00
|
||||
:1,A8,00,00,00
|
||||
:2,C8,00,00,00
|
||||
:3,68,20,00,00
|
||||
:B,64
|
||||
#
|
||||
Reference in New Issue
Block a user