summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-17 16:19:01 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-17 16:19:11 (GMT)
commitbfd914a5d1d09712b6763457440ba30f35b34d05 (patch)
tree7061de2be0789178ff479bedaf0b4263562ef11d
parent1fe06029957c23eebd2bd6cbf705d33a8044cd4d (diff)
boards: simulator: Add ptr32 support
-rw-r--r--wasp/boards/simulator/micropython.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/wasp/boards/simulator/micropython.py b/wasp/boards/simulator/micropython.py
index 804f514..66f1fd5 100644
--- a/wasp/boards/simulator/micropython.py
+++ b/wasp/boards/simulator/micropython.py
@@ -12,12 +12,17 @@ def viper(fn):
return buf
def ptr16(buf):
- return memoryview(buf).cast('H')
+ return memoryview(buf).cast('b').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
+ def ptr32(buf):
+ return memoryview(buf).cast('b').cast('I')
+
+ # This is a bit of a hack since the scopes don't exactly match where
+ # they would be in micropython but for the simple cases it does mean
+ # no changes to the client
fn.__globals__['ptr8'] = ptr8
fn.__globals__['ptr16'] = ptr16
+ fn.__globals__['ptr32'] = ptr32
return fn