I bought a Lanbon L8 switch since it dropped in price. It is rectangular which fits well on our 503 wall boxes.
It uses an ESP32 with PSRAM and a ST7789 TFT (#5 on annex).
Everything works with annex except touch.
I don't know if FT6336 has been implemented on annex yet.
Regards
FT6336 Touch capacitive
Re: FT6336 Touch capacitive
Hi, I found some code for FT6336U in a thread on M5Stack.
I didn't find an interrupt pin on the board. So I'm using a polling routine.
'Config page
'MOSI 23
'MISO 25
'SCLK 19
'CS 22
'DC 21
'RST 18
'BL 5
'
'Landscape
'ST7789 #5
PWM.SETUP 5, 1, 100 'BL
I2C.SETUP 4, 0 'SDA , SCL
touch_x=0: touch_y=0: touch_z=0
i2c_addr = &h38
timer0 100, polltouch
wlog "Startup"
tft.fill orange
TFT.TEXT.FONT 1
TFT.TEXT.SIZE 1
TFT.TEXT.COLOR black, orange
TFT.TEXT.POS 1, 1
TFT.Print "...Startup"
init:
do
if touch_z=1 then
TFT.CIRCLE touch_x, touch_y, 5, blue,1
TFT.TEXT.POS 10, 30
TFT.Print "Touch X="+str$(touch_x)+" Y="+str$(touch_y)+" "+ hex$(touch_z)
end if
loop
wait
polltouch:
i2c.read_iobuff(0), i2c_addr, 3, 2 '
if iobuff.len(0) = 0 or (iobuff.read(0, 0)<&H7F) then
touch_z=0
else
touch_z=1
touch_y = (iobuff.read(0, 0) and &Hf) << 8 + iobuff.read(0, 1)
i2c.read_iobuff(0), i2c_addr, 5, 2
touch_x = 320-((iobuff.read(0, 0) and &Hf) << 8 + iobuff.read(0, 1))
end if
return
Maybe the FT6336U management is already in annex, anyway it works and it's usable.
Regards
I didn't find an interrupt pin on the board. So I'm using a polling routine.
'Config page
'MOSI 23
'MISO 25
'SCLK 19
'CS 22
'DC 21
'RST 18
'BL 5
'
'Landscape
'ST7789 #5
PWM.SETUP 5, 1, 100 'BL
I2C.SETUP 4, 0 'SDA , SCL
touch_x=0: touch_y=0: touch_z=0
i2c_addr = &h38
timer0 100, polltouch
wlog "Startup"
tft.fill orange
TFT.TEXT.FONT 1
TFT.TEXT.SIZE 1
TFT.TEXT.COLOR black, orange
TFT.TEXT.POS 1, 1
TFT.Print "...Startup"
init:
do
if touch_z=1 then
TFT.CIRCLE touch_x, touch_y, 5, blue,1
TFT.TEXT.POS 10, 30
TFT.Print "Touch X="+str$(touch_x)+" Y="+str$(touch_y)+" "+ hex$(touch_z)
end if
loop
wait
polltouch:
i2c.read_iobuff(0), i2c_addr, 3, 2 '
if iobuff.len(0) = 0 or (iobuff.read(0, 0)<&H7F) then
touch_z=0
else
touch_z=1
touch_y = (iobuff.read(0, 0) and &Hf) << 8 + iobuff.read(0, 1)
i2c.read_iobuff(0), i2c_addr, 5, 2
touch_x = 320-((iobuff.read(0, 0) and &Hf) << 8 + iobuff.read(0, 1))
end if
return
Maybe the FT6336U management is already in annex, anyway it works and it's usable.
Regards