improved "run" code.
This commit is contained in:
@@ -66,11 +66,21 @@ initApps:
|
||||
;
|
||||
|
||||
runApps:
|
||||
clr r16
|
||||
#ifdef APPS_ROUTER
|
||||
bigcall AppRouter_Run
|
||||
push r16
|
||||
bigcall AppRouter_Run
|
||||
pop r16
|
||||
sbci r16, 0 ; decrease r16 only if CFLAG set
|
||||
#endif
|
||||
|
||||
; add more modules here
|
||||
|
||||
tst r16
|
||||
clc
|
||||
breq runApps_end
|
||||
sec
|
||||
runApps_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
@@ -241,6 +241,8 @@
|
||||
.include "modules/network/msg/pong-w.asm"
|
||||
.include "modules/network/msg/range-d.asm"
|
||||
.include "modules/network/msg/range-r.asm"
|
||||
.include "common/eeprom-r.asm"
|
||||
.include "common/eeprom-w.asm"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -55,10 +55,26 @@ main:
|
||||
|
||||
main_loop:
|
||||
bigcall systemSleep ; system-dependant
|
||||
bigcall runModules
|
||||
bigcall runApps
|
||||
|
||||
; run loop as long as some run function returns with CFLAG set
|
||||
main_runLoop:
|
||||
clr r16
|
||||
push r16
|
||||
bigcall runModules
|
||||
pop r16
|
||||
sbci r16, 0
|
||||
|
||||
push r16
|
||||
bigcall runApps
|
||||
pop r16
|
||||
sbci r16, 0
|
||||
|
||||
bigcall onEveryLoop ; call into main app
|
||||
push r16
|
||||
bigcall onEveryLoop ; call into main app
|
||||
pop r16
|
||||
|
||||
tst r16
|
||||
brne main_runLoop
|
||||
|
||||
#ifdef MODULES_NETWORK
|
||||
#ifndef MAIN_WITHOUT_MSG_HANDLING
|
||||
|
||||
@@ -175,56 +175,46 @@ initModules:
|
||||
; USED: depending on called routines
|
||||
|
||||
runModules:
|
||||
bigcall BaseTimer_Run
|
||||
clr r16
|
||||
|
||||
push r16
|
||||
bigcall BaseTimer_Run
|
||||
pop r16
|
||||
|
||||
#ifdef MODULES_COM
|
||||
; COM module (call until carry flag cleared but at most 10 times to not starve other modules)
|
||||
ldi r16, 10
|
||||
runModules_Com:
|
||||
push r16
|
||||
bigcall Com2_Run
|
||||
pop r16
|
||||
brcc runModules_ComEnd
|
||||
dec r16
|
||||
brne runModules_Com
|
||||
runModules_ComEnd:
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_TTYONUART1
|
||||
bigcall TtyOnUart1_Run
|
||||
push r16
|
||||
bigcall TtyOnUart1_Run
|
||||
pop r16
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_COMONUART0
|
||||
bigcall ComOnUart0_Run
|
||||
push r16
|
||||
bigcall ComOnUart0_Run
|
||||
pop r16
|
||||
sbci r16, 0
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_COMONUART1
|
||||
bigcall ComOnUart1_Run
|
||||
push r16
|
||||
bigcall ComOnUart1_Run
|
||||
pop r16
|
||||
sbci r16, 0
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_STATS
|
||||
bigcall Stats_Run
|
||||
push r16
|
||||
bigcall Stats_Run
|
||||
pop r16
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_REED
|
||||
bigcall REED_Run
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_CNY70
|
||||
bigcall CNY70_Run
|
||||
#endif
|
||||
|
||||
#ifdef MODULES_MOTION_LIGHT
|
||||
; rcall MotionLight_Run
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODULES_TCRT1000
|
||||
; rcall TCRT1K_Run
|
||||
#endif
|
||||
|
||||
|
||||
; add more modules here
|
||||
|
||||
; check for repeat request
|
||||
tst r16
|
||||
clc
|
||||
breq runModules_end
|
||||
sec
|
||||
runModules_end:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user