diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-02-01 20:20:53 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-02-01 20:20:53 (GMT) |
| commit | e21f2a79cae0a79687061d30606599b930aa7480 (patch) | |
| tree | fe8e78885d7d17af5fb8668269fa45ddf830b290 /wasp/boards/simulator/watch.py | |
| parent | c7e11d60205a50e3f63344cc327be1930ff2f7d3 (diff) | |
wasp: simulator: Add ST7789 simulation
Diffstat (limited to 'wasp/boards/simulator/watch.py')
| -rw-r--r-- | wasp/boards/simulator/watch.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/wasp/boards/simulator/watch.py b/wasp/boards/simulator/watch.py index c6d695f..89faffe 100644 --- a/wasp/boards/simulator/watch.py +++ b/wasp/boards/simulator/watch.py @@ -9,6 +9,13 @@ from machine import SPI from drivers.st7789 import ST7789_SPI from drivers.vibrator import Vibrator +class Backlight(object): + def __init__(self, level=1): + self.set(level) + + def set(self, level): + print(f'BACKLIGHT: {level}') + class Display(ST7789_SPI): def __init__(self): spi = SPI(0) @@ -16,11 +23,12 @@ class Display(ST7789_SPI): spi.init(polarity=1, phase=1, baudrate=8000000) # Configure the display - cs = Pin("DISP_CS", Pin.OUT) - dc = Pin("DISP_DC", Pin.OUT) - rst = Pin("DISP_RST", Pin.OUT) + cs = Pin("DISP_CS", Pin.OUT, quiet=True) + dc = Pin("DISP_DC", Pin.OUT, quiet=True) + rst = Pin("DISP_RST", Pin.OUT, quiet=True) super().__init__(240, 240, spi, cs=cs, dc=dc, res=rst) display = Display() +backlight = Backlight() vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True) |
