Streamline main loop operations
This commit is contained in:
+4
-25
@@ -57,36 +57,15 @@ main:
|
|||||||
rcall timer0_set
|
rcall timer0_set
|
||||||
rcall timer1_set
|
rcall timer1_set
|
||||||
|
|
||||||
|
sei ; Enable global interrupt
|
||||||
|
|
||||||
; loop: calculate tempo (high priority!) and save, led blinking, segment led writing
|
|
||||||
loop:
|
loop:
|
||||||
;ldi r24, 30 ; Load current BPM to register //NOTE: hardcoded temporary
|
; led in parallel with midi_out_pin (on a 555 monostable)
|
||||||
; TODO: compare two registers (current bpm and previous bpm)
|
|
||||||
;rcall tempo_calc ; CHANGE: if BPM changed then rcall BPM calculation function else skip because ticks tempo is the value already in [OCR1C]
|
|
||||||
; if this BPM != previous BPM then load this to another register (will be used as the 'previous register')
|
|
||||||
|
|
||||||
; final result stored in OCR1C as ticks
|
|
||||||
|
|
||||||
; TODO: look if there are alternatives to rcall
|
|
||||||
|
|
||||||
;rcall midi_send ; Send MIDI ping
|
|
||||||
|
|
||||||
|
|
||||||
; if midi clock then after do:
|
|
||||||
; 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]
|
|
||||||
|
|
||||||
|
SET_BPM 0x51, 0x29
|
||||||
|
; for ex: use two sram addresses for bpm->lookup table for division
|
||||||
|
|
||||||
; 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
|
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user