summaryrefslogtreecommitdiff
path: root/wasp
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-02-03 19:23:10 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-02-03 19:23:10 (GMT)
commitfc74f7e37b3db9024d6cecf9fabdddf602b88b3c (patch)
treeea14cbd6e0f41ce433c6deb4f3258d27debe3ab9 /wasp
parenta5caa845b792b164915db2acc0a7dddcde426c52 (diff)
wasp: simulator: Add RTC support
Diffstat (limited to 'wasp')
-rw-r--r--wasp/boards/simulator/watch.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/wasp/boards/simulator/watch.py b/wasp/boards/simulator/watch.py
index 89faffe..e25d03c 100644
--- a/wasp/boards/simulator/watch.py
+++ b/wasp/boards/simulator/watch.py
@@ -29,6 +29,27 @@ class Display(ST7789_SPI):
super().__init__(240, 240, spi, cs=cs, dc=dc, res=rst)
+class RTC(object):
+ def __init__(self):
+ self.uptime = 0
+
+ def update(self):
+ now = time.time()
+ if now == self.uptime:
+ return False
+ self.uptime = now
+ return True
+
+ def get_time(self):
+ now = time.localtime()
+ return (now[3], now[4], now[5])
+
+ def uptime(self):
+ return time.time
+
display = Display()
backlight = Backlight()
+rtc = RTC()
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
+button = Pin('BUTTON', Pin.IN, quiet=True)
+