DigoleDisplay - WimWWimW/touchScreen GitHub Wiki
This class is a subclass of DigoleBasic and adds conveniency methods, but also an event stack (limited functionality).
methods:
---
print to display; syntax like python's print()
---
Prints v as bold face text. Note that this changes the drawmode to OR ('|')
- parameters
- v :: (any type convertible to string)
Prints v as underlined text. Note that this changes the drawmode to OR ('|'). The underline effect us realized by oversprinting the underscore character. How well this works depends on the selected font. +
- parameters
- v :: (any type convertible to string)
shorthand synonym of clearScreen() for interactive use +
---
Wait until the device is responsive again. Use this after sending a large data file.
- parameters
- timeOut :: millisecs
function to be called at intervals to detect response events. + This is a software implementation that works better than the hardware interrupt penirq (but still not very well). +
class Console(InputControl):
def __init__(self, i2cConnection, address):
self.screen = TouchScreen(i2cConnection, address)
def doCheck(self):
result = []
for msg in self.screen.doCheck():
if msg[0] == AppEvent.CLICK:
self.window.handleClick(*msg[1])
else:
# not handled by me:
result.append(Event(msg[0], *msg[1]))
try:
self.screen.checkTouchScreen()
except:
pass
return result
if __name__ == '__main__':
import machine
from digole import *
import utime as time
from display import Display
def connect(clockSpeed):
pinSDA = machine.Pin(23)
pinSCL = machine.Pin(19)
for i in range(10):
# Create an I2C object out of our SDA and SCL pin objects
i2c = machine.I2C(sda=pinSDA, scl=pinSCL, freq=clockSpeed)
slaves = i2c.scan()
if len(slaves) > 0:
break
# address on the I2C bus
display = 0x27
if not display in slaves:
raise Exception("i2c error: touch screen not available")
return i2c
i2c = connect(250000)
d = Display(i2c, 39)
#d.startUp()
ok = True
while ok:
time.sleep_ms(100)
print(end='>')
e = d.doCheck()
if e:
print(e)
ok = False
gc.collect()
print("DONE.")