summaryrefslogtreecommitdiff
path: root/wasp/boards
diff options
context:
space:
mode:
Diffstat (limited to 'wasp/boards')
-rw-r--r--wasp/boards/dsd6/manifest.py3
-rw-r--r--wasp/boards/dsd6/watch.py3
-rw-r--r--wasp/boards/nitrogen/manifest.py3
-rw-r--r--wasp/boards/nitrogen/watch.py3
-rw-r--r--wasp/boards/pinetime/manifest.py8
-rw-r--r--wasp/boards/pinetime/watch.py3
-rw-r--r--wasp/boards/simulator/display.py33
-rw-r--r--wasp/boards/simulator/machine.py3
-rw-r--r--wasp/boards/simulator/micropython.py3
-rw-r--r--wasp/boards/simulator/watch.py3
-rw-r--r--wasp/boards/sphinx/machine.py3
-rw-r--r--wasp/boards/sphinx/watch.py3
12 files changed, 60 insertions, 11 deletions
diff --git a/wasp/boards/dsd6/manifest.py b/wasp/boards/dsd6/manifest.py
index 9efab20..bee48c0 100644
--- a/wasp/boards/dsd6/manifest.py
+++ b/wasp/boards/dsd6/manifest.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
freeze('../..',
(
'demo.py',
diff --git a/wasp/boards/dsd6/watch.py b/wasp/boards/dsd6/watch.py
index fdfdba9..0148d95 100644
--- a/wasp/boards/dsd6/watch.py
+++ b/wasp/boards/dsd6/watch.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
from machine import RTCounter as RTC
# Start measuring time (and feeding the watchdog)
diff --git a/wasp/boards/nitrogen/manifest.py b/wasp/boards/nitrogen/manifest.py
index f60ebd9..b17711b 100644
--- a/wasp/boards/nitrogen/manifest.py
+++ b/wasp/boards/nitrogen/manifest.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
freeze('../..',
(
'demo.py',
diff --git a/wasp/boards/nitrogen/watch.py b/wasp/boards/nitrogen/watch.py
index fdfdba9..0148d95 100644
--- a/wasp/boards/nitrogen/watch.py
+++ b/wasp/boards/nitrogen/watch.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
from machine import RTCounter as RTC
# Start measuring time (and feeding the watchdog)
diff --git a/wasp/boards/pinetime/manifest.py b/wasp/boards/pinetime/manifest.py
index 6a19c1a..30d54e2 100644
--- a/wasp/boards/pinetime/manifest.py
+++ b/wasp/boards/pinetime/manifest.py
@@ -1,9 +1,13 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
freeze('.', 'watch.py', opt=3)
freeze('../..',
(
'apps/clock.py',
- 'apps/testapp.py',
'apps/flashlight.py',
+ 'apps/launcher.py',
+ 'apps/testapp.py',
'boot.py',
'demo.py',
'draw565.py',
@@ -17,8 +21,8 @@ freeze('../..',
'fonts/sans24.py',
'icons.py',
'logo.py',
- 'manager.py',
'shell.py',
+ 'wasp.py',
'widgets.py',
),
opt=3
diff --git a/wasp/boards/pinetime/watch.py b/wasp/boards/pinetime/watch.py
index 8248d9e..1caeea5 100644
--- a/wasp/boards/pinetime/watch.py
+++ b/wasp/boards/pinetime/watch.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
# Start measuring time (and feeding the watchdog) before *anything* else
from machine import RTCounter
from drivers.nrf_rtc import RTC
diff --git a/wasp/boards/simulator/display.py b/wasp/boards/simulator/display.py
index 3d7d388..c226050 100644
--- a/wasp/boards/simulator/display.py
+++ b/wasp/boards/simulator/display.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
""" Simulated ST7789 display and CST816S touchscreen. """
import sys
@@ -38,7 +41,8 @@ class ST7789Sim(object):
self.y = self.rowclip[0]
elif self.cmd == RAMWR:
- pixelview = sdl2.ext.PixelView(windowsurface)
+ #pixelview = sdl2.ext.PixelView(windowsurface)
+ pixelview = sdl2.ext.pixels2d(windowsurface)
half = False
for d in data:
@@ -49,11 +53,14 @@ class ST7789Sim(object):
rgb |= d
half = False
- pixel = ((rgb & 0xf800) >> 8,
- (rgb & 0x07e0) >> 3,
- (rgb & 0x001f) << 3)
+ #pixel = ((rgb & 0xf800) >> 8,
+ # (rgb & 0x07e0) >> 3,
+ # (rgb & 0x001f) << 3)
+ pixel = (((rgb & 0xf800) << 8) +
+ ((rgb & 0x07e0) << 5) +
+ ((rgb & 0x001f) << 3))
- pixelview[self.y][self.x] = pixel
+ pixelview[self.x][self.y] = pixel
self.x += 1
if self.x > self.colclip[1]:
@@ -83,14 +90,22 @@ class CST816SSim():
self.regs[1] = 0
def handle_key(self, key):
+ """Use key presses to provoke different touchscreen events.
+
+ Note: The Down key provokes an upward swipe and vice versa.
+ Same for left and right. That is because the swipe up
+ gesture means show me the screen the is below me (hence
+ the controls are inverted compared to joystick-like
+ direction control).
+ """
if key.keysym.sym == sdl2.SDLK_DOWN:
- self.regs[1] = 1
- elif key.keysym.sym == sdl2.SDLK_UP:
self.regs[1] = 2
+ elif key.keysym.sym == sdl2.SDLK_UP:
+ self.regs[1] = 1
elif key.keysym.sym == sdl2.SDLK_LEFT:
- self.regs[1] = 3
- elif key.keysym.sym == sdl2.SDLK_RIGHT:
self.regs[1] = 4
+ elif key.keysym.sym == sdl2.SDLK_RIGHT:
+ self.regs[1] = 3
self.regs[3] = 0x80
self.raise_interrupt()
diff --git a/wasp/boards/simulator/machine.py b/wasp/boards/simulator/machine.py
index 62a95c5..2fc9754 100644
--- a/wasp/boards/simulator/machine.py
+++ b/wasp/boards/simulator/machine.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
import display
import time
diff --git a/wasp/boards/simulator/micropython.py b/wasp/boards/simulator/micropython.py
index 578a12d..41c30a4 100644
--- a/wasp/boards/simulator/micropython.py
+++ b/wasp/boards/simulator/micropython.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
def const(fn):
return fn
diff --git a/wasp/boards/simulator/watch.py b/wasp/boards/simulator/watch.py
index f38d7a1..ce281f4 100644
--- a/wasp/boards/simulator/watch.py
+++ b/wasp/boards/simulator/watch.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
import time
def sleep_ms(ms):
time.sleep(ms / 1000)
diff --git a/wasp/boards/sphinx/machine.py b/wasp/boards/sphinx/machine.py
index b35a2a7..dfddb6d 100644
--- a/wasp/boards/sphinx/machine.py
+++ b/wasp/boards/sphinx/machine.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
class ADC():
pass
diff --git a/wasp/boards/sphinx/watch.py b/wasp/boards/sphinx/watch.py
index dccee44..57b590e 100644
--- a/wasp/boards/sphinx/watch.py
+++ b/wasp/boards/sphinx/watch.py
@@ -1,3 +1,6 @@
+# SPDX-License-Identifier: LGPL-3.0-or-later
+# Copyright (C) 2020 Daniel Thompson
+
import time
def sleep_ms(ms):
time.sleep(ms / 1000)