introduce app "hub"

This commit is contained in:
Martin Preuss
2025-08-18 18:06:35 +02:00
parent 7c01aa255f
commit 3592a745d3
6 changed files with 787 additions and 67 deletions

View File

@@ -33,6 +33,10 @@ initApps:
bigcall AppRouter_Init
#endif
#ifdef APPS_HUB
bigcall AppHub_Init
#endif
#ifdef APPS_MOTION
bigcall AppMotion_Init
#endif
@@ -74,6 +78,10 @@ runApps:
sbci r16, 0 ; decrease r16 only if CFLAG set
#endif
#ifdef APPS_HUB
bigcall AppHub_Run
#endif
; add more modules here
tst r16

View File

@@ -296,6 +296,19 @@
#endif
#ifdef APPS_HUB
.include "apps/hub/main.asm"
.include "modules/network/msg/reboot-d.asm"
.include "modules/network/msg/reboot-r.asm"
.include "modules/network/msg/pong-w.asm"
.include "modules/network/msg/range-d.asm"
.include "modules/network/msg/range-r.asm"
.include "modules/network/msg/range-w.asm"
.include "common/eeprom-r.asm"
.include "common/eeprom-w.asm"
#endif
#ifdef APPS_REPORTSENSORS
.include "apps/reportsensors/data.asm"
.include "apps/reportsensors/main.asm"

View File

@@ -185,11 +185,8 @@ initModules:
;
; Call run functions of the used modules. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; @return CFLAG set: at least one RUN routine returned CFLAG set
; @clobbers all
runModules:
clr r16
@@ -197,6 +194,7 @@ runModules:
push r16
bigcall BaseTimer_Run
pop r16
sbci r16, 0
#ifdef MODULES_TTYONUART1
push r16
@@ -204,10 +202,40 @@ runModules:
pop r16
#endif
#ifdef MODULES_COMONUART0
push r16
rcall runComModules
bigcall ComOnUart0_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COMONUART1
push r16
bigcall ComOnUart1_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COM2W0
push r16
bigcall COM2W0_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COM2W1
push r16
bigcall COM2W1_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COM2WN
push r16
bigcall COM2WN_Run
pop r16
sbci r16, 0
#endif
; add more modules here
@@ -218,67 +246,7 @@ runModules:
sec
runModules_end:
ret
; run until every module idle
runComModules:
clr r17
runComModules_loop:
push r17
clr r16
#ifdef MODULES_COMONUART0
push r16
bigcall ComOnUart0_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COMONUART1
push r16
bigcall ComOnUart1_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COM2W0
push r16
bigcall COM2W0_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COM2W1
push r16
bigcall COM2W1_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_COM2WN
push r16
bigcall COM2WN_Run
pop r16
sbci r16, 0
#endif
pop r17
; check for repeat request
tst r16
clc
breq runComModules_loopEnd
inc r17
cpi r17, 2
brne runComModules_loop
runComModules_loopEnd:
tst r17
clc
breq runComModules_end
sec
runComModules_end:
ret
; @end
mainModulesOnPacketReceived: