avr: cleanup handling of apps and modules in devices/all

This commit is contained in:
Martin Preuss
2026-03-16 21:37:46 +01:00
parent dbb004234f
commit 5c18f5bf9a
22 changed files with 1452 additions and 982 deletions

View File

@@ -36,10 +36,10 @@ main:
bigcall systemInitHardware
bigcall Utils_Init
bigcall Utils_SetupUid
bigcall initModules
bigcall initApps
bigcall modulesInit
bigcall appsInit
bigcall Utils_InitialWait
sei ; Enable interrupts
sei ; Enable interrupts TODO: move below!
bigcall onSystemStart
@@ -62,12 +62,12 @@ main_runLoop:
push r17
clr r16
push r16
bigcall runModules
bigcall modulesRun
pop r16
sbci r16, 0
push r16
bigcall runApps
bigcall appsRun
pop r16
sbci r16, 0
@@ -99,175 +99,40 @@ main_loop_reboot:
; ---------------------------------------------------------------------------
; @routine onSystemTimerTick
;
; Called every 100ms. No arguments, no results.
onSystemTimerTick:
bigcall onEvery100ms
#ifdef MODULES_CLOCK
bigcall Clock_Every100ms ; generates calls to onEverySecond/Minute/Hour/Day
#endif
#ifdef MODULES_LED_SIMPLE
bigcall LedSimple_Every100ms
#endif
#ifdef MODULES_LED_SIGNAL
bigcall LedSignal_Every100ms
#endif
#ifdef MODULES_LED_ACTIVITY
bigcall LedActivity_Every100ms
#endif
#ifdef MODULES_BEEPER_SIMPLE
bigcall BeeperSimple_Every100ms
#endif
#ifdef MODULES_UART_BITBANG
bigcall UART_BitBang_Every100ms
#endif
#ifdef MODULES_UART_HW
bigcall NET_Uart_Every100ms
#endif
#ifdef MODULES_TTYONUART1
bigcall TtyOnUart1_Periodically
#endif
#ifdef MODULES_UARTFD0
bigcall UARTFD0_Every100ms
#endif
#ifdef MODULES_UARTFD1
bigcall UARTFD1_Every100ms
#endif
#ifdef MODULES_COMONUART0
bigcall ComOnUart0_Periodically
#endif
#ifdef MODULES_COMONUART1
bigcall ComOnUart1_Periodically
#endif
#ifdef MODULES_COM2W
bigcall COM2W_Every100ms
#endif
#ifdef MODULES_COM2W0
bigcall COM2W0_Periodically
#endif
#ifdef MODULES_COM2W1
bigcall COM2W1_Periodically
#endif
#ifdef MODULES_COM2WN
bigcall COM2WN_Periodically
#endif
#ifdef MODULES_TCRT1000
bigcall TCRT1K_Every100ms
#endif
#ifdef MODULES_BRIGHTNESS
bigcall Brightness_Every100ms
#endif
#ifdef MODULES_XPT2046
bigcall XPT2046_Every100ms
#endif
#ifdef APPS_NETWORK
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_Every100ms
#endif
#ifdef APPS_MOTION
bigcall AppMotion_Every100ms
#endif
#ifdef APPS_DOOR
bigcall AppDoor_Every100ms
#endif
#ifdef APPS_MA_LIGHT
bigcall AppMotionLight_Every100ms
#endif
bigcall modulesOnEvery100ms
bigcall appsOnEvery100ms
ret
; @end
#ifdef MODULES_CLOCK
sysOnEverySecond:
#ifdef MODULES_DS18B20
bigcall Ds18b20_OnEverySecond
#endif
#ifdef APPS_REPORTSENSORS
bigcall AppReportSensors_OnEverySecond
#endif
#ifdef MODULES_SGP30
bigcall SGP30_EverySecond
#endif
bigcall modulesOnEverySecond
bigcall appsOnEverySecond
bigjmp onEverySecond
; @end
sysOnEveryMinute:
#ifdef APPS_STATS
bigcall AppStats_OnEveryMinute
#endif
#ifdef MODULES_CCS811
bigcall CCS811_OnEveryMinute
#endif
#ifdef MODULES_DS3231
bigcall Ds3231_OnEveryMinute
#endif
bigcall modulesOnEveryMinute
bigcall appsOnEveryMinute
bigjmp onEveryMinute
; @end
sysOnEveryHour:
bigcall modulesOnEveryHour
bigcall appsOnEveryHour
bigjmp onEveryHour
; @end
sysOnEveryDay:
#ifdef APPS_NETWORK
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_EveryDay
#endif
#ifdef APPS_ROUTER
bigcall AppRouter_EveryDay
#endif
#ifdef APPS_FORWARDER
bigcall AppForwarder_EveryDay
#endif
bigcall modulesOnEveryDay
bigcall appsOnEveryDay
bigjmp onEveryDay
; @end
@@ -287,8 +152,8 @@ mainHandleMessages:
push r16
bigcall onMessageReceived
bigcall mainModulesOnPacketReceived
bigcall mainAppsOnPacketReceived
bigcall modulesOnPacketReceived
bigcall appsOnPacketReceived
pop r16
bigcall NET_Buffer_ReleaseByNum
sec