Inline with macros to save on jump clock cycles
This commit is contained in:
+12
-5
@@ -1,5 +1,5 @@
|
|||||||
; Registers
|
; Registers
|
||||||
; r16: ISR setup, reusable after main;
|
; r16: ISR setup, reused only by START_BLINK on loop
|
||||||
|
|
||||||
.org 0x0000 ; RESET Vector
|
.org 0x0000 ; RESET Vector
|
||||||
rjmp main
|
rjmp main
|
||||||
@@ -56,13 +56,20 @@ loop:
|
|||||||
|
|
||||||
|
|
||||||
; if midi clock then after do:
|
; if midi clock then after do:
|
||||||
rcall start_blink
|
; SOME CPI HERE
|
||||||
|
brne segment_led
|
||||||
|
START_BLINK ; Macro for inlining blink start logic
|
||||||
|
|
||||||
|
rjmp segment_led ; Output current BPM to 3-digit 7-segment LED [r24]
|
||||||
;rcall segment_led ; Output current BPM to 3-digit 7-segment LED [r24]
|
|
||||||
|
|
||||||
|
|
||||||
; sleep when BPM is stabilized (whenever BPM calculation are not being done) and outside of midi send
|
; sleep when BPM is stabilized (whenever BPM calculation are not being done) and outside of midi send
|
||||||
; to do this explore MCUCR register, it can do a lot of stuff
|
; to do this explore MCUCR register, it can do a lot of stuff
|
||||||
|
|
||||||
rjmp loop ; Loopback
|
rjmp loop
|
||||||
|
|
||||||
|
; TODO: move to separate file
|
||||||
|
; keep as subroutine as it's called in two parts in the code
|
||||||
|
; or it can create issues with compiler
|
||||||
|
segment_led:
|
||||||
|
rjmp loop
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,7 @@
|
|||||||
; Registers:
|
; Registers:
|
||||||
; r16: timer0 start and stop operations
|
; r16: timer0 start and stop operations
|
||||||
|
|
||||||
start_blink:
|
.MACRO START_BLINK
|
||||||
ldi r16, (1 << OCF0A) ; Write Output Compare Flag 0 A to 1
|
ldi r16, (1 << OCF0A) ; Write Output Compare Flag 0 A to 1
|
||||||
out TIFR, r16 ; Clear Timer0 interrupt flag register
|
out TIFR, r16 ; Clear Timer0 interrupt flag register
|
||||||
|
|
||||||
@@ -12,8 +12,7 @@ start_blink:
|
|||||||
out TCCR0B, r16 ; Enable clock source
|
out TCCR0B, r16 ; Enable clock source
|
||||||
|
|
||||||
sbi PORTB, PB0 ; Set LED on
|
sbi PORTB, PB0 ; Set LED on
|
||||||
|
.endm
|
||||||
ret
|
|
||||||
|
|
||||||
stop_blink:
|
stop_blink:
|
||||||
cbi PORTB, PB0 ; Set LED off
|
cbi PORTB, PB0 ; Set LED off
|
||||||
|
|||||||
Reference in New Issue
Block a user