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)
|
ldi yh, HIGH(ledA3Sram)
|
||||||
rcall Led_SetPattern
|
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:
|
main_loop:
|
||||||
rcall runModulesUntilIdle
|
rcall runModulesUntilIdle
|
||||||
; sbi DDRA, PORTA2 ; debug
|
; sbi DDRA, PORTA2 ; debug
|
||||||
@@ -194,9 +185,9 @@ runModulesUntilIdle_Timer: ; repeat this block for every module with run f
|
|||||||
rcall Timer_Run ;
|
rcall Timer_Run ;
|
||||||
brcs runModulesUntilIdle_Timer ;
|
brcs runModulesUntilIdle_Timer ;
|
||||||
|
|
||||||
;runModulesUntilIdle_Com:
|
runModulesUntilIdle_Com:
|
||||||
; rcall Com_Run
|
rcall Com_Run
|
||||||
; brcs runModulesUntilIdle_Com
|
brcs runModulesUntilIdle_Com
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -239,61 +230,48 @@ onEvery100ms:
|
|||||||
; USED: depending on called routines
|
; USED: depending on called routines
|
||||||
|
|
||||||
onEverySecond:
|
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
|
in r15, SREG ; debug
|
||||||
cli
|
cli
|
||||||
push r15
|
push r15
|
||||||
|
ldi r17, 219
|
||||||
ldi yl, LOW(comRingBuffer)
|
rcall COM_EnqueuePing
|
||||||
ldi yh, HIGH(comRingBuffer)
|
; rcall comHandleNextPacketInRingbuffer
|
||||||
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:
|
|
||||||
pop r15
|
pop r15
|
||||||
out SREG, 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
|
onEveryMinute:
|
||||||
; cli
|
sbi DDRA, PORTA2 ; debug
|
||||||
; push r15
|
sbi PINA, PORTA2 ; debug (toggle)
|
||||||
; ldi r16, 219
|
|
||||||
; rcall comSendByte ; 1101 1011
|
|
||||||
; pop r15
|
|
||||||
; out SREG, r15
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user