main: added timer callbacks for 10s and 1m. removed debug code.
This commit is contained in:
94
avr/main.asm
94
avr/main.asm
@@ -123,15 +123,6 @@ main:
|
||||
ldi yh, HIGH(ledA3Sram)
|
||||
rcall Led_SetPattern
|
||||
|
||||
; ldi r17, 219 ; debug
|
||||
; rcall COM_EnqueuePing ; debug
|
||||
; nop
|
||||
; nop
|
||||
; nop
|
||||
; ldi r16, 4
|
||||
; rcall RingBuffer_DeallocRead
|
||||
; rjmp PC+0
|
||||
|
||||
main_loop:
|
||||
rcall runModulesUntilIdle
|
||||
; sbi DDRA, PORTA2 ; debug
|
||||
@@ -194,9 +185,9 @@ runModulesUntilIdle_Timer: ; repeat this block for every module with run f
|
||||
rcall Timer_Run ;
|
||||
brcs runModulesUntilIdle_Timer ;
|
||||
|
||||
;runModulesUntilIdle_Com:
|
||||
; rcall Com_Run
|
||||
; brcs runModulesUntilIdle_Com
|
||||
runModulesUntilIdle_Com:
|
||||
rcall Com_Run
|
||||
brcs runModulesUntilIdle_Com
|
||||
|
||||
ret
|
||||
|
||||
@@ -239,61 +230,48 @@ onEvery100ms:
|
||||
; USED: depending on called routines
|
||||
|
||||
onEverySecond:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; onEvery10s
|
||||
;
|
||||
; Called every 10 seconds. Add your routine calls here.
|
||||
;
|
||||
; IN:
|
||||
; - nothing
|
||||
; OUT:
|
||||
; - nothing
|
||||
; USED: depending on called routines
|
||||
|
||||
onEvery10s:
|
||||
in r15, SREG ; debug
|
||||
cli
|
||||
push r15
|
||||
|
||||
ldi yl, LOW(comRingBuffer)
|
||||
ldi yh, HIGH(comRingBuffer)
|
||||
ldd r16, y+RINGBUFFER_OFFS_USED
|
||||
rcall debugSendByte
|
||||
|
||||
ldi r17, 219
|
||||
rcall COM_EnqueuePing
|
||||
|
||||
|
||||
rcall comHandleNextPacketInRingbuffer
|
||||
; brcc debug1
|
||||
|
||||
rjmp debugEnd
|
||||
|
||||
rcall comHandleNextPacketInRingbuffer
|
||||
brcs debug2 ; CF set should not be okay here
|
||||
|
||||
ldi r16, 9
|
||||
rcall debugSendByte
|
||||
rjmp debugEnd
|
||||
debug1:
|
||||
ldi r16, 5
|
||||
rcall debugSendByte
|
||||
rjmp debugEnd
|
||||
|
||||
debug2:
|
||||
ldi r16, 17
|
||||
rcall debugSendByte
|
||||
|
||||
debugEnd:
|
||||
ldi r17, 219
|
||||
rcall COM_EnqueuePing
|
||||
; rcall comHandleNextPacketInRingbuffer
|
||||
pop r15
|
||||
out SREG, r15
|
||||
ret
|
||||
|
||||
|
||||
; in r15, SREG ; debug
|
||||
; cli
|
||||
; push r15
|
||||
; ldi r18, 0
|
||||
; rcall comSendPacketRaw
|
||||
; pop r15
|
||||
; out SREG, r15
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; onEveryMinute
|
||||
;
|
||||
; Called every minute. Add your routine calls here.
|
||||
;
|
||||
; IN:
|
||||
; - nothing
|
||||
; OUT:
|
||||
; - nothing
|
||||
; USED: depending on called routines
|
||||
|
||||
; in r15, SREG ; debug
|
||||
; cli
|
||||
; push r15
|
||||
; ldi r16, 219
|
||||
; rcall comSendByte ; 1101 1011
|
||||
; pop r15
|
||||
; out SREG, r15
|
||||
|
||||
onEveryMinute:
|
||||
sbi DDRA, PORTA2 ; debug
|
||||
sbi PINA, PORTA2 ; debug (toggle)
|
||||
ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user