avr/devices/all: started integrating code from t03.
This commit is contained in:
@@ -53,22 +53,16 @@ main:
|
||||
#endif
|
||||
|
||||
main_loop:
|
||||
; only modify SE, SM1 and SM0
|
||||
cli
|
||||
in r16, MCUCR
|
||||
ldi r17, (1<<SE) | (1<<SM1) | (1<<SM0)
|
||||
neg r17
|
||||
and r16, r17
|
||||
ori r16, (1<<SE) ; sleep mode "idle", enable
|
||||
out MCUCR, r16
|
||||
sei ; make sure interrupts really are enabled
|
||||
sleep ; sleep, wait for interrupt
|
||||
|
||||
rcall systemSleep ; system-dependant
|
||||
rcall runModules
|
||||
rcall runApps
|
||||
|
||||
|
||||
rcall onEveryLoop ; call into main app
|
||||
|
||||
#ifdef MODULES_NETWORK
|
||||
rcall handleMessages
|
||||
#ifndef MAIN_WITHOUT_MSG_HANDLING
|
||||
rcall mainHandleMessages
|
||||
#endif
|
||||
#endif
|
||||
|
||||
rjmp main_loop
|
||||
@@ -100,6 +94,14 @@ onSystemTimerTick:
|
||||
rcall UART_BitBang_Every100ms
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_TTYONUART1
|
||||
rcall TtyOnUart1_Periodically
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_COMONUART0
|
||||
rcall ComOnUart0_Periodically
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_TCRT1000
|
||||
rcall TCRT1K_Every100ms
|
||||
#endif
|
||||
@@ -163,6 +165,27 @@ sysOnEveryDay:
|
||||
|
||||
|
||||
|
||||
#ifdef MODULES_NETWORK
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mainHandleMessages
|
||||
|
||||
mainHandleMessages:
|
||||
rcall NET_GetNextIncomingMsgNum ; R16=msg num
|
||||
brcc mainHandleMessages_end
|
||||
rcall NET_Buffer_Locate ; X=buffer addr (R17)
|
||||
adiw xh:xl, 1
|
||||
|
||||
push r16
|
||||
rcall onMessageReceived
|
||||
rcall mainModulesOnPacketReceived
|
||||
rcall mainAppsOnPacketReceived
|
||||
pop r16
|
||||
rcall NET_Buffer_ReleaseByNum
|
||||
sec
|
||||
mainHandleMessages_end:
|
||||
ret
|
||||
; @end
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user