diff options
author | Damien George <damien.p.george@gmail.com> | 2020-02-27 15:36:53 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-28 10:33:03 +1100 |
commit | 69661f3343bedf86e514337cff63d96cc42f8859 (patch) | |
tree | af5dfb380ffdb75dda84828f63cf9d840d992f0f /examples/asmled.py | |
parent | 3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff) | |
download | micropython-69661f3343bedf86e514337cff63d96cc42f8859.tar.gz micropython-69661f3343bedf86e514337cff63d96cc42f8859.zip |
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'examples/asmled.py')
-rw-r--r-- | examples/asmled.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/asmled.py b/examples/asmled.py index 917d9ba03c..09a06c184a 100644 --- a/examples/asmled.py +++ b/examples/asmled.py @@ -2,8 +2,8 @@ # this version is overly verbose and uses word stores @micropython.asm_thumb def flash_led(r0): - movw(r1, (stm.GPIOA + stm.GPIO_BSRRL) & 0xffff) - movt(r1, ((stm.GPIOA + stm.GPIO_BSRRL) >> 16) & 0x7fff) + movw(r1, (stm.GPIOA + stm.GPIO_BSRRL) & 0xFFFF) + movt(r1, ((stm.GPIOA + stm.GPIO_BSRRL) >> 16) & 0x7FFF) movw(r2, 1 << 13) movt(r2, 0) movw(r3, 0) @@ -17,8 +17,8 @@ def flash_led(r0): str(r2, [r1, 0]) # delay for a bit - movw(r4, 5599900 & 0xffff) - movt(r4, (5599900 >> 16) & 0xffff) + movw(r4, 5599900 & 0xFFFF) + movt(r4, (5599900 >> 16) & 0xFFFF) label(delay_on) sub(r4, r4, 1) cmp(r4, 0) @@ -28,8 +28,8 @@ def flash_led(r0): str(r3, [r1, 0]) # delay for a bit - movw(r4, 5599900 & 0xffff) - movt(r4, (5599900 >> 16) & 0xffff) + movw(r4, 5599900 & 0xFFFF) + movt(r4, (5599900 >> 16) & 0xFFFF) label(delay_off) sub(r4, r4, 1) cmp(r4, 0) @@ -41,6 +41,7 @@ def flash_led(r0): cmp(r0, 0) bgt(loop1) + # flash LED #2 using inline assembler # this version uses half-word sortes, and the convenience assembler operation 'movwt' @micropython.asm_thumb @@ -81,5 +82,6 @@ def flash_led_v2(r0): cmp(r0, 0) bgt(loop1) + flash_led(5) flash_led_v2(5) |