From f7e5e677df120122eeaac18b81d3fccfe0965180 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 10 Feb 2016 17:06:07 +0000 Subject: [PATCH] tests/pyb: Add simple test for stm module on pyboard. --- tests/pyb/modstm.py | 13 +++++++++++++ tests/pyb/modstm.py.exp | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 tests/pyb/modstm.py create mode 100644 tests/pyb/modstm.py.exp 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)) diff --git a/tests/pyb/modstm.py.exp b/tests/pyb/modstm.py.exp new file mode 100644 index 000000000..a24c9f865 --- /dev/null +++ b/tests/pyb/modstm.py.exp @@ -0,0 +1,2 @@ +0x8000 +0x0