timer: Added callbacks for every 10s and every minute.
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
timerModuleData:
|
||||
timerModuleTickCounter: .byte 1 ; only low byte used
|
||||
timerModuleFlags: .byte 1
|
||||
|
||||
timerModuleCounter10s: .byte 1
|
||||
timerModuleCounter1m: .byte 1
|
||||
timerModuleCounterSecs: .byte 4
|
||||
timerModuleData_end:
|
||||
|
||||
@@ -110,9 +111,35 @@ Timer_Run_l1:
|
||||
mov r16, r17
|
||||
andi r16, TIMER_FLAGS_1S
|
||||
breq Timer_Run_l2
|
||||
; another 1s passed, invoke callback, check for 10s and 1m
|
||||
push r17
|
||||
rcall onEverySecond
|
||||
pop r17
|
||||
; 1s
|
||||
lds r16, timerModuleCounter10s
|
||||
inc r16
|
||||
sts timerModuleCounter10s, r16
|
||||
cpi r16, 10
|
||||
brcs Timer_Run_check1m
|
||||
clr r16
|
||||
sts timerModuleCounter10s, r16
|
||||
push r17
|
||||
rcall onEvery10s
|
||||
pop r17
|
||||
|
||||
Timer_Run_check1m:
|
||||
; 1m
|
||||
lds r16, timerModuleCounter1m
|
||||
inc r16
|
||||
sts timerModuleCounter1m, r16
|
||||
cpi r16, 60
|
||||
brcs Timer_Run_l2
|
||||
clr r16
|
||||
sts timerModuleCounter1m, r16
|
||||
push r17
|
||||
rcall onEveryMinute
|
||||
pop r17
|
||||
|
||||
Timer_Run_l2:
|
||||
sec
|
||||
tst r17
|
||||
|
||||
Reference in New Issue
Block a user