summaryrefslogtreecommitdiff
path: root/tests/pyb/modstm.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-02-10 17:06:07 +0000
committerDamien George <damien.p.george@gmail.com>2016-02-10 17:06:07 +0000
commitf7e5e677df120122eeaac18b81d3fccfe0965180 (patch)
tree46bdfc2facdc63e5cb7c7049e7da7f34c231464e /tests/pyb/modstm.py
parent3a042fb9215528b5b918d7850c1b776dd359fce7 (diff)
tests/pyb: Add simple test for stm module on pyboard.
Diffstat (limited to 'tests/pyb/modstm.py')
-rw-r--r--tests/pyb/modstm.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/pyb/modstm.py b/tests/pyb/modstm.py
new file mode 100644
index 000000000..f1e147c05
--- /dev/null
+++ b/tests/pyb/modstm.py
@@ -0,0 +1,13 @@
+# test stm module
+
+import stm
+import pyb
+
+# test storing a full 32-bit number
+# turn on then off the A15(=yellow) LED
+BSRR = 0x18
+stm.mem32[stm.GPIOA + BSRR] = 0x00008000
+pyb.delay(100)
+print(hex(stm.mem32[stm.GPIOA + stm.GPIO_ODR] & 0x00008000))
+stm.mem32[stm.GPIOA + BSRR] = 0x80000000
+print(hex(stm.mem32[stm.GPIOA + stm.GPIO_ODR] & 0x00008000))