summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/wasp.rst12
-rw-r--r--wasp/apps/template.py43
-rw-r--r--wasp/boards/sphinx/watch.py6
-rw-r--r--wasp/wasp.py2
4 files changed, 62 insertions, 1 deletions
diff --git a/docs/wasp.rst b/docs/wasp.rst
index e1f5bec..7ff7cc3 100644
--- a/docs/wasp.rst
+++ b/docs/wasp.rst
@@ -19,6 +19,18 @@ Applications
:members:
:undoc-members:
+.. automodule:: apps.launcher
+ :members:
+ :undoc-members:
+
+.. automodule:: apps.pager
+ :members:
+ :undoc-members:
+
+.. automodule:: apps.template
+ :members:
+ :undoc-members:
+
.. automodule:: apps.testapp
:members:
:undoc-members:
diff --git a/wasp/apps/template.py b/wasp/apps/template.py
new file mode 100644
index 0000000..9e9ea1c
--- /dev/null
+++ b/wasp/apps/template.py
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
+import wasp
+import icons
+
+class TemplateApp():
+ """Template application ready to use as a basis for new applications.
+ """
+ NAME = 'Template'
+ ICON = icons.app
+
+ def __init__(self):
+ pass
+
+ def foreground(self):
+ """Activate the application."""
+ self._draw()
+ wasp.system.request_event(wasp.EventMask.TOUCH |
+ wasp.EventMask.SWIPE_UPDOWN |
+ wasp.EventMask.BUTTON)
+
+ def press(self, button, state):
+ draw = wasp.watch.drawable
+ draw.string('Button', 0, 108, width=240)
+
+ def swipe(self, event):
+ draw = wasp.watch.drawable
+ if event[0] == wasp.EventType.UP:
+ draw.string('Swipe up', 0, 108, width=240)
+ else:
+ draw.string('Swipe down', 0, 108, width=240)
+
+ def touch(self, event):
+ draw = wasp.watch.drawable
+ wasp.watch.drawable.string('({}, {})'.format(
+ event[1], event[2]), 0, 108, width=240)
+
+ def _draw(self):
+ """Draw the display from scratch."""
+ draw = wasp.watch.drawable
+ draw.fill()
+ draw.string('Template', 0, 6, width=240)
diff --git a/wasp/boards/sphinx/watch.py b/wasp/boards/sphinx/watch.py
index 57b590e..f3f6502 100644
--- a/wasp/boards/sphinx/watch.py
+++ b/wasp/boards/sphinx/watch.py
@@ -5,3 +5,9 @@ import time
def sleep_ms(ms):
time.sleep(ms / 1000)
time.sleep_ms = sleep_ms
+
+class Pin():
+ def value(v=None):
+ pass
+
+button = Pin()
diff --git a/wasp/wasp.py b/wasp/wasp.py
index e5315a1..2711454 100644
--- a/wasp/wasp.py
+++ b/wasp/wasp.py
@@ -64,7 +64,7 @@ class PinHandler():
return it.
:return: boolean of the pin state if an event is received, None
- otherwise.
+ otherwise.
"""
new_value = self._pin.value()
if self._value == new_value: