summaryrefslogtreecommitdiff
path: root/wasp/boards/simulator/micropython.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-08 20:50:42 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-08 20:50:42 (GMT)
commitfd64abe882a2064bad0131424835c169e365d83f (patch)
treed63acda8b2afb03e8ed6ee4f5dfea48d9f30f2a7 /wasp/boards/simulator/micropython.py
parentac61d8a1c114d7f4ca8000afc02c843db5fd6245 (diff)
wasp: draw565: Optimize the 2-bit RLE drawing functions
There's a bunch of different changes here but there are only really three big wins. The biggest win comes from restructuring the 2-bit RLE decode loop to avoid the inner function (~20%) but the switch to 16-bit writes in _fill() and adoption of quick_write (e.g. no CS toggling) are also note worthy (and about 5% each).
Diffstat (limited to 'wasp/boards/simulator/micropython.py')
-rw-r--r--wasp/boards/simulator/micropython.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/wasp/boards/simulator/micropython.py b/wasp/boards/simulator/micropython.py
index 41c30a4..804f514 100644
--- a/wasp/boards/simulator/micropython.py
+++ b/wasp/boards/simulator/micropython.py
@@ -11,9 +11,13 @@ def viper(fn):
def ptr8(buf):
return buf
+ def ptr16(buf):
+ return memoryview(buf).cast('H')
+
# This is a bit of a hack since the scope for ptr8 won't be right
# but it does mean no changes to the client
fn.__globals__['ptr8'] = ptr8
+ fn.__globals__['ptr16'] = ptr16
return fn