aboutsummaryrefslogtreecommitdiff
path: root/blink.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2023-12-25 01:40:53 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2023-12-25 01:40:53 -0600
commitc6ddfc67dd16bd197580fbead9f454031384cc5a (patch)
treeb1e72fa3e3fe5277495639e5eb810b4050ebaa2f /blink.s
parentad75550260068087c4351a6a197e10c02fe3b399 (diff)
Add blink_hex subroutine
Diffstat (limited to 'blink.s')
-rw-r--r--blink.s39
1 files changed, 37 insertions, 2 deletions
diff --git a/blink.s b/blink.s
index 62b6654..5150cab 100644
--- a/blink.s
+++ b/blink.s
@@ -29,6 +29,7 @@ setup_led:
.global blink
blink:
+ ldr r1, =SIO_BASE
movs r0, 1
lsls r0, 25
1:
@@ -36,21 +37,55 @@ blink:
bl delay_1s
b 1b
+.type long_blink, %function
+.global long_blink
+
+long_blink:
+ push {lr}
+ ldr r1, =SIO_BASE
+ movs r0, 1
+ lsls r0, 25
+ bl delay_1s
+ str r0, [r1, GPIO_OUT_XOR_OFST]
+ bl delay_1s
+ str r0, [r1, GPIO_OUT_XOR_OFST]
+ bl delay_1s
+ pop {pc}
+
.type blinkN, %function
.global blinkN
blinkN:
push {lr}
+ ldr r1, =SIO_BASE
movs r2, 1
lsls r2, 25
tst r0, r0
beq done
on_then_off:
str r2, [r1, GPIO_OUT_XOR_OFST]
- bl delay_1s
+ bl delay_quick
str r2, [r1, GPIO_OUT_XOR_OFST]
- bl delay_1s
+ bl delay_quick
subs r0, r0, 1
bne on_then_off
done:
pop {pc}
+
+.type blink_hex, %function
+.global blink_hex
+
+blink_hex:
+ push {lr}
+ movs r4, r0
+ movs r5, 0xf
+1:
+ ands r0, r5
+ bl blinkN
+ lsrs r4, 4
+ beq 2f
+ bl long_blink
+ movs r0, r4
+ b 1b
+2:
+ pop {pc}