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

@@ -1,5 +1,5 @@
; *************************************************************************** ; ***************************************************************************
; copyright : (C) 2025 by Martin Preuss ; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de ; email : martin@libchipcard.de
; ;
; *************************************************************************** ; ***************************************************************************
@@ -7,130 +7,24 @@
; * Please see toplevel file COPYING of that project for license details. * ; * Please see toplevel file COPYING of that project for license details. *
; *************************************************************************** ; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_ASM
; *************************************************************************** #define AQH_AVR_DEVICES_ALL_APPS_ASM
; code
.cseg .include "devices/all/apps_init.asm"
.include "devices/all/apps_run.asm"
.include "devices/all/apps_msg.asm"
#ifdef MODULES_CLOCK
; --------------------------------------------------------------------------- .include "devices/all/apps_100ms.asm"
; @routine initApps .include "devices/all/apps_1s.asm"
; .include "devices/all/apps_1m.asm"
; Call init functions of the used apps. Add your routine calls here. .include "devices/all/apps_1h.asm"
.include "devices/all/apps_1d.asm"
initApps:
#ifdef APPS_NETWORK
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_Init
#endif #endif
#ifdef APPS_ROUTER
bigcall AppRouter_Init
#endif #endif
#ifdef APPS_HUB
bigcall AppHub_Init
#endif
#ifdef APPS_FORWARDER
bigcall AppForwarder_Init
#endif
#ifdef APPS_MOTION
bigcall AppMotion_Init
#endif
#ifdef APPS_DOOR
bigcall AppDoor_Init
#endif
#ifdef APPS_REPORTSENSORS
bigcall AppReportSensors_Init
#endif
#ifdef APPS_STATS
bigcall AppStats_Init
#endif
#ifdef APPS_MA_LIGHT
bigcall AppMotionLight_Init
#endif
; done
ret
; @end
; ---------------------------------------------------------------------------
; @routine runApps
;
; Call run functions of the used modules. Add your routine calls here.
;
runApps:
clr r16
#ifdef APPS_ROUTER
push r16
bigcall AppRouter_Run
pop r16
sbci r16, 0 ; decrease r16 only if CFLAG set
#endif
#ifdef APPS_HUB
push r16
bigcall AppHub_Run
pop r16
sbci r16, 0 ; decrease r16 only if CFLAG set
#endif
#ifdef APPS_FORWARDER
push r16
bigcall AppForwarder_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
; ---------------------------------------------------------------------------
; @routine mainAppsOnPacketReceived
;
; Let all apps handle received message.
mainAppsOnPacketReceived:
#ifdef APPS_NETWORK
; handle messages
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_HandleMsg
#endif
#ifdef APPS_MA_LIGHT
bigcall AppMotionLight_OnPacketReceived
#endif
; add more here
ret
; @end

View File

@@ -0,0 +1,54 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_100MS_ASM
#define AQH_AVR_DEVICES_ALL_APPS_100MS_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine appsOnEvery100ms
;
; Called every 100ms. No arguments, no results.
appsOnEvery100ms:
#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
ret
; @end
#endif

View File

@@ -0,0 +1,43 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_1D_ASM
#define AQH_AVR_DEVICES_ALL_APPS_1D_ASM
; ***************************************************************************
; code
.cseg
appsOnEveryDay:
#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
ret
; @end
#endif

View File

@@ -0,0 +1,30 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_1H_ASM
#define AQH_AVR_DEVICES_ALL_APPS_1H_ASM
; ***************************************************************************
; code
.cseg
appsOnEveryHour:
ret
; @end
#endif

View File

@@ -0,0 +1,33 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_1M_ASM
#define AQH_AVR_DEVICES_ALL_APPS_1M_ASM
; ***************************************************************************
; code
.cseg
appsOnEveryMinute:
#ifdef APPS_STATS
bigcall AppStats_OnEveryMinute
#endif
ret
; @end
#endif

View File

@@ -0,0 +1,33 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_1S_ASM
#define AQH_AVR_DEVICES_ALL_APPS_1S_ASM
; ***************************************************************************
; code
.cseg
appsOnEverySecond:
#ifdef APPS_REPORTSENSORS
bigcall AppReportSensors_OnEverySecond
#endif
ret
; @end
#endif

View File

@@ -0,0 +1,99 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_INCLUDE_ASM
#define AQH_AVR_DEVICES_ALL_APPS_INCLUDE_ASM
#ifdef APPS_MOTION
.include "modules/f_keepup/main.asm"
.include "modules/valsched/main.asm"
.include "apps/motion/main.asm"
#endif
#ifdef APPS_DOOR
#ifndef APPS_MOTION
.include "modules/f_keepup/main.asm"
.include "modules/valsched/main.asm"
#endif
.include "apps/door/main.asm"
#endif
#ifdef APPS_NETWORK
.include "apps/network/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 "common/eeprom-r.asm"
.include "common/eeprom-w.asm"
#endif
#ifdef APPS_ROUTER
.include "apps/router/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_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_FORWARDER
.include "apps/forwarder/main.asm"
.include "modules/network/msg/reboot-r.asm"
.include "modules/network/msg/reboot-d.asm"
.include "modules/network/msg/pong-w.asm"
#endif
#ifdef APPS_REPORTSENSORS
.include "apps/reportsensors/data.asm"
.include "apps/reportsensors/main.asm"
#endif
#ifdef APPS_STATS
.include "apps/stats/data.asm"
.include "apps/stats/main.asm"
.include "apps/network/stats.asm"
.include "modules/network/msg/sendstats-w.asm"
.include "modules/network/msg/recvstats-w.asm"
.include "modules/network/msg/memstats-w.asm"
.include "modules/network/msg/device-w.asm"
#endif
#ifdef APPS_MA_LIGHT
.include "apps/ma_light/defs.asm"
.include "apps/ma_light/data.asm"
.include "apps/ma_light/main.asm"
.include "apps/ma_light/recv.asm"
;.include "common/eeprom-r.asm"
;.include "common/eeprom-w.asm"
#endif
#endif

View File

@@ -0,0 +1,73 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_INIT_ASM
#define AQH_AVR_DEVICES_ALL_APPS_INIT_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine appsInit
;
; Call init functions of the used apps. Add your routine calls here.
appsInit:
#ifdef APPS_NETWORK
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_Init
#endif
#ifdef APPS_ROUTER
bigcall AppRouter_Init
#endif
#ifdef APPS_HUB
bigcall AppHub_Init
#endif
#ifdef APPS_FORWARDER
bigcall AppForwarder_Init
#endif
#ifdef APPS_MOTION
bigcall AppMotion_Init
#endif
#ifdef APPS_DOOR
bigcall AppDoor_Init
#endif
#ifdef APPS_REPORTSENSORS
bigcall AppReportSensors_Init
#endif
#ifdef APPS_STATS
bigcall AppStats_Init
#endif
#ifdef APPS_MA_LIGHT
bigcall AppMotionLight_Init
#endif
; done
ret
; @end
#endif

View File

@@ -0,0 +1,48 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_MSG_ASM
#define AQH_AVR_DEVICES_ALL_APPS_MSG_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine appsOnPacketReceived
;
; Let all apps handle received message.
appsOnPacketReceived:
#ifdef APPS_NETWORK
; handle messages
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_HandleMsg
#endif
#ifdef APPS_MA_LIGHT
bigcall AppMotionLight_OnPacketReceived
#endif
; add more here
ret
; @end
#endif

View File

@@ -0,0 +1,65 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_APPS_RUN_ASM
#define AQH_AVR_DEVICES_ALL_APPS_RUN_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine runApps
;
; Call run functions of the used apps. Add your routine calls here.
;
appsRun:
clr r16
#ifdef APPS_ROUTER
push r16
bigcall AppRouter_Run
pop r16
sbci r16, 0 ; decrease r16 only if CFLAG set
#endif
#ifdef APPS_HUB
push r16
bigcall AppHub_Run
pop r16
sbci r16, 0 ; decrease r16 only if CFLAG set
#endif
#ifdef APPS_FORWARDER
push r16
bigcall AppForwarder_Run
pop r16
sbci r16, 0 ; decrease r16 only if CFLAG set
#endif
; add more modules here
tst r16
clc
breq appsRun_end
sec
appsRun_end:
ret
; @end
#endif

View File

@@ -1,5 +1,5 @@
; *************************************************************************** ; ***************************************************************************
; copyright : (C) 2025 by Martin Preuss ; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de ; email : martin@libchipcard.de
; ;
; *************************************************************************** ; ***************************************************************************
@@ -7,10 +7,13 @@
; * Please see toplevel file COPYING of that project for license details. * ; * Please see toplevel file COPYING of that project for license details. *
; *************************************************************************** ; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_INCLUDES_ASM
#define AQH_AVR_DEVICES_ALL_INCLUDES_ASM
.include "devices/all/main.asm" .include "devices/all/main.asm"
.include "devices/all/apps.asm" .include "devices/all/modules_include.asm"
.include "devices/all/modules.asm" .include "devices/all/apps_include.asm"
#ifdef MODULES_NETWORK #ifdef MODULES_NETWORK
.include "devices/all/sendvalue.asm" .include "devices/all/sendvalue.asm"
#endif #endif
@@ -24,372 +27,9 @@
.include "modules/basetimer/main.asm" .include "modules/basetimer/main.asm"
#ifdef MODULES_XRAM .include "devices/all/modules.asm"
.include "modules/xram/main.asm" .include "devices/all/apps.asm"
#endif #endif
#ifdef MODULES_HEAP
.include "modules/heap/main.asm"
#endif
#ifdef MODULES_NETWORK
.include "common/crc8.asm"
.include "common/m_fixedbuffers.asm"
.include "common/m_ringbuffer_y.asm"
.include "common/ringbuffer_y.asm"
.include "modules/network/defs.asm"
.include "modules/network/data.asm"
.include "modules/network/iface.asm"
.include "modules/network/main.asm"
.include "modules/network/buffer.asm"
.include "modules/network/msg/defs.asm"
.include "modules/network/msg/common.asm"
.include "modules/network/msg/crc.asm"
.include "modules/network/msg/value-w.asm"
.include "modules/network/msg/value-r.asm"
.include "modules/network/msg/addr-r.asm"
.include "modules/network/msg/addr-w.asm"
#endif
#ifdef MODULES_UART_BITBANG
.include "modules/uart_bitbang2/defs.asm"
.include "modules/uart_bitbang2/iface.asm"
.include "modules/uart_bitbang2/bytelevel.asm"
.include "modules/uart_bitbang2/msglevel.asm"
#endif
#ifdef MODULES_UART_HW
.include "modules/uart_hw/defs.asm"
.include "modules/uart_hw/lowlevel.asm"
.include "modules/uart_hw/uart.asm"
.include "modules/uart_hw/attn.asm"
.include "modules/uart_hw/net_uart.asm"
#endif
#ifdef MODULES_COMONUART0
;.include "modules/uart_hw/defs.asm"
;.include "modules/uart_hw/lowlevel.asm"
;.include "modules/uart_hw/m_lowlevel_uart.asm"
;.include "modules/uart_hw/comonuart0.asm"
.include "modules/uart_hw2/defs.asm"
.include "modules/uart_hw2/comonuart0.asm"
#endif
#ifdef MODULES_COMONUART1
;.include "modules/uart_hw/defs.asm"
;.include "modules/uart_hw/lowlevel.asm"
;.include "modules/uart_hw/m_lowlevel_uart.asm"
;.include "modules/uart_hw/comonuart1.asm"
.include "modules/uart_hw2/defs.asm"
.include "modules/uart_hw2/comonuart1.asm"
#endif
#ifdef MODULES_TTYONUART1
.include "modules/uart_hw/defs.asm"
.include "modules/uart_hw/lowlevel.asm"
.include "modules/uart_hw/m_lowlevel_uart.asm"
.include "modules/uart_hw/ttyonuart1.asm"
;.include "modules/uart_hw2/defs.asm"
;.include "modules/uart_hw2/ttyonuart1.asm"
#endif
#ifdef MODULES_COM2W
.include "modules/com2w/defs.asm"
.include "modules/com2w/com2w.asm"
#endif
#ifdef MODULES_COM2W0
.include "modules/com2w/defs.asm"
.include "modules/com2w/common.asm"
.include "modules/com2w/com2w0.asm"
#endif
#ifdef MODULES_COM2W1
.include "modules/com2w/defs.asm"
.include "modules/com2w/common.asm"
.include "modules/com2w/com2w1.asm"
#endif
#ifdef MODULES_COM2WN
.include "modules/com2w/defs.asm"
.include "modules/com2w/com2wn_init.asm"
.include "modules/com2w/com2wn_io.asm"
.include "modules/com2w/com2wn_irq.asm"
.include "modules/com2w/com2wn_recv.asm"
.include "modules/com2w/com2wn_run.asm"
.include "modules/com2w/com2wn_send.asm"
.include "modules/com2w/com2wn_wait.asm"
.include "modules/com2w/com2wn_data.asm"
#endif
#ifdef MODULES_COM2WI
.include "modules/com2w/com2wi2.asm"
#endif
#ifdef MODULES_UARTFD0
.include "modules/uart_fd/defs.asm"
.include "modules/uart_fd/macros.asm"
.include "modules/uart_fd/uartfd0.asm"
#endif
#ifdef MODULES_UARTFD1
.include "modules/uart_fd/defs.asm"
.include "modules/uart_fd/macros.asm"
.include "modules/uart_fd/uartfd1.asm"
#endif
#ifdef MODULES_CLOCK
.include "modules/clock/main.asm"
#endif
#ifdef MODULES_LED_SIMPLE
.include "modules/led_simple/main.asm"
#ifdef MODULES_NETWORK
.include "modules/led_simple/recv.asm"
#endif
#endif
#ifdef MODULES_LED_SIGNAL
.include "modules/led_signal/main.asm"
#endif
#ifdef MODULES_LED_ACTIVITY
.include "modules/led_activity/main.asm"
#endif
#ifdef MODULES_BEEPER_SIMPLE
.include "modules/beeper_simple/main.asm"
#ifdef MODULES_NETWORK
.include "modules/beeper_simple/recv.asm"
#endif
#endif
#ifdef MODULES_TWI_MASTER
.include "modules/twimaster/main.asm"
#endif
#ifdef MODULES_SI7021
.include "modules/si7021/main2.asm"
#ifdef MODULES_NETWORK
.include "modules/si7021/send.asm"
#endif
.include "common/multiply.asm"
#endif
#ifdef MODULES_SGP30
.include "modules/sgp30/main.asm"
#ifdef MODULES_NETWORK
.include "modules/sgp30/send.asm"
#endif
#endif
#ifdef MODULES_SGP40
.include "modules/sgp40/main.asm"
#ifdef MODULES_NETWORK
.include "modules/sgp40/send.asm"
#endif
#endif
#ifdef MODULES_OWI_MASTER
.include "modules/owimaster/main.asm"
#endif
#ifdef MODULES_SPI_HW
.include "modules/spi_hw/main.asm"
#endif
#ifdef MODULES_DS18B20
.include "modules/ds18b20/main2.asm"
#ifdef MODULES_NETWORK
.include "modules/ds18b20/send.asm"
#endif
#endif
#ifdef MODULES_DS3231
.include "modules/rtc/ds3231/main.asm"
#ifdef MODULES_NETWORK
.include "modules/network/msg/time-d.asm"
.include "modules/network/msg/time-r.asm"
.include "modules/network/msg/time-w.asm"
.include "modules/rtc/ds3231/recv.asm"
.include "modules/rtc/ds3231/send.asm"
#endif
#endif
#ifdef MODULES_MOTION
.include "modules/motion/main2.asm"
#endif
#ifdef MODULES_CCS811
.include "modules/ccs811/main.asm"
#ifdef MODULES_NETWORK
.include "modules/ccs811/send.asm"
#endif
#endif
#ifdef MODULES_TCRT1000
.include "modules/tcrt1000/main2.asm"
#endif
#ifdef MODULES_SK6812
.include "modules/sk6812/main.asm"
#ifdef MODULES_NETWORK
.include "modules/sk6812/recv.asm"
#endif
#endif
#ifdef MODULES_LCD
.include "modules/lcd/main.asm"
#endif
#ifdef MODULES_ILI9341
.include "modules/lcd2/ili9341/defs.asm"
.include "modules/lcd2/ili9341/colors.asm"
.include "modules/lcd2/ili9341/images.asm"
.include "modules/lcd2/ili9341/main.asm"
.include "modules/lcd2/ili9341/io_spi.asm"
.include "modules/lcd2/ili9341/graphops.asm"
.include "modules/lcd2/ili9341/text.asm"
#endif
#ifdef MODULES_XPT2046
.include "modules/lcd2/xpt2046/main.asm"
#endif
#ifdef MODULES_FONT
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/main.asm"
#endif
#ifdef MODULES_FONT_8X8
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/font8x8.asm"
#endif
#ifdef MODULES_FONT_6X8
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/font6x8.asm"
#endif
#ifdef MODULES_BRIGHTNESS
.include "modules/brightness/main.asm"
#ifdef MODULES_NETWORK
.include "modules/brightness/send.asm"
#endif
#endif
#ifdef APPS_MOTION
.include "modules/f_keepup/main.asm"
.include "modules/valsched/main.asm"
.include "apps/motion/main.asm"
#endif
#ifdef APPS_DOOR
#ifndef APPS_MOTION
.include "modules/f_keepup/main.asm"
.include "modules/valsched/main.asm"
#endif
.include "apps/door/main.asm"
#endif
#ifdef APPS_NETWORK
.include "apps/network/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 "common/eeprom-r.asm"
.include "common/eeprom-w.asm"
#endif
#ifdef APPS_ROUTER
.include "apps/router/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_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_FORWARDER
.include "apps/forwarder/main.asm"
.include "modules/network/msg/reboot-r.asm"
.include "modules/network/msg/reboot-d.asm"
.include "modules/network/msg/pong-w.asm"
#endif
#ifdef APPS_REPORTSENSORS
.include "apps/reportsensors/data.asm"
.include "apps/reportsensors/main.asm"
#endif
#ifdef APPS_STATS
.include "apps/stats/data.asm"
.include "apps/stats/main.asm"
.include "apps/network/stats.asm"
.include "modules/network/msg/sendstats-w.asm"
.include "modules/network/msg/recvstats-w.asm"
.include "modules/network/msg/memstats-w.asm"
.include "modules/network/msg/device-w.asm"
#endif
#ifdef APPS_MA_LIGHT
.include "apps/ma_light/defs.asm"
.include "apps/ma_light/data.asm"
.include "apps/ma_light/main.asm"
.include "apps/ma_light/recv.asm"
;.include "common/eeprom-r.asm"
;.include "common/eeprom-w.asm"
#endif

View File

@@ -36,10 +36,10 @@ main:
bigcall systemInitHardware bigcall systemInitHardware
bigcall Utils_Init bigcall Utils_Init
bigcall Utils_SetupUid bigcall Utils_SetupUid
bigcall initModules bigcall modulesInit
bigcall initApps bigcall appsInit
bigcall Utils_InitialWait bigcall Utils_InitialWait
sei ; Enable interrupts sei ; Enable interrupts TODO: move below!
bigcall onSystemStart bigcall onSystemStart
@@ -62,12 +62,12 @@ main_runLoop:
push r17 push r17
clr r16 clr r16
push r16 push r16
bigcall runModules bigcall modulesRun
pop r16 pop r16
sbci r16, 0 sbci r16, 0
push r16 push r16
bigcall runApps bigcall appsRun
pop r16 pop r16
sbci r16, 0 sbci r16, 0
@@ -99,175 +99,40 @@ main_loop_reboot:
; ---------------------------------------------------------------------------
; @routine onSystemTimerTick
;
; Called every 100ms. No arguments, no results.
onSystemTimerTick: onSystemTimerTick:
bigcall onEvery100ms bigcall onEvery100ms
bigcall modulesOnEvery100ms
#ifdef MODULES_CLOCK bigcall appsOnEvery100ms
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
ret ret
; @end ; @end
#ifdef MODULES_CLOCK #ifdef MODULES_CLOCK
sysOnEverySecond: sysOnEverySecond:
#ifdef MODULES_DS18B20 bigcall modulesOnEverySecond
bigcall Ds18b20_OnEverySecond bigcall appsOnEverySecond
#endif
#ifdef APPS_REPORTSENSORS
bigcall AppReportSensors_OnEverySecond
#endif
#ifdef MODULES_SGP30
bigcall SGP30_EverySecond
#endif
bigjmp onEverySecond bigjmp onEverySecond
; @end ; @end
sysOnEveryMinute: sysOnEveryMinute:
#ifdef APPS_STATS bigcall modulesOnEveryMinute
bigcall AppStats_OnEveryMinute bigcall appsOnEveryMinute
#endif
#ifdef MODULES_CCS811
bigcall CCS811_OnEveryMinute
#endif
#ifdef MODULES_DS3231
bigcall Ds3231_OnEveryMinute
#endif
bigjmp onEveryMinute bigjmp onEveryMinute
; @end ; @end
sysOnEveryHour: sysOnEveryHour:
bigcall modulesOnEveryHour
bigcall appsOnEveryHour
bigjmp onEveryHour bigjmp onEveryHour
; @end ; @end
sysOnEveryDay: sysOnEveryDay:
#ifdef APPS_NETWORK bigcall modulesOnEveryDay
ldi yl, LOW(netInterfaceData) bigcall appsOnEveryDay
ldi yh, HIGH(netInterfaceData)
bigcall AppNetwork_EveryDay
#endif
#ifdef APPS_ROUTER
bigcall AppRouter_EveryDay
#endif
#ifdef APPS_FORWARDER
bigcall AppForwarder_EveryDay
#endif
bigjmp onEveryDay bigjmp onEveryDay
; @end ; @end
@@ -287,8 +152,8 @@ mainHandleMessages:
push r16 push r16
bigcall onMessageReceived bigcall onMessageReceived
bigcall mainModulesOnPacketReceived bigcall modulesOnPacketReceived
bigcall mainAppsOnPacketReceived bigcall appsOnPacketReceived
pop r16 pop r16
bigcall NET_Buffer_ReleaseByNum bigcall NET_Buffer_ReleaseByNum
sec sec

View File

@@ -1,5 +1,5 @@
; *************************************************************************** ; ***************************************************************************
; copyright : (C) 2025 by Martin Preuss ; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de ; email : martin@libchipcard.de
; ;
; *************************************************************************** ; ***************************************************************************
@@ -7,352 +7,24 @@
; * Please see toplevel file COPYING of that project for license details. * ; * Please see toplevel file COPYING of that project for license details. *
; *************************************************************************** ; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_ASM
; *************************************************************************** #define AQH_AVR_DEVICES_ALL_MODULES_ASM
; code
.cseg .include "devices/all/modules_init.asm"
.include "devices/all/modules_run.asm"
.include "devices/all/modules_msg.asm"
; ---------------------------------------------------------------------------
; @routine initModules
;
; Call init functions of the used modules. Add your routine calls here.
initModules:
bigcall BaseTimer_Init ; unconditionally call this
#ifdef MODULES_HEAP
bigcall Heap_Init
#endif
#ifdef MODULES_CLOCK #ifdef MODULES_CLOCK
bigcall Clock_Init .include "devices/all/modules_100ms.asm"
#endif .include "devices/all/modules_1s.asm"
.include "devices/all/modules_1m.asm"
#ifdef MODULES_TIMER .include "devices/all/modules_1h.asm"
bigcall Timer_Init .include "devices/all/modules_1d.asm"
#endif
#ifdef MODULES_XRAM
bigcall XRAM_Init
#endif
#ifdef MODULES_LED
ldi zl, LOW(ledA3Flash)
ldi zh, HIGH(ledA3Flash)
ldi yl, LOW(ledA3Sram)
ldi yh, HIGH(ledA3Sram)
bigcall Led_Init
#endif
#ifdef MODULES_LED_SIMPLE
bigcall LedSimple_Init
#endif #endif
#ifdef MODULES_LED_SIGNAL
bigcall LedSignal_Init
#endif #endif
#ifdef MODULES_LED_ACTIVITY
bigcall LedActivity_Init
#endif
#ifdef MODULES_BEEPER_SIMPLE
bigcall BeeperSimple_Init
#endif
#ifdef MODULES_COM
bigcall Com2_Init ; init COM module
bigcall CPRO_Init ; init COM protocol module
#endif
#ifdef MODULES_NETWORK
bigcall NET_Init
#endif
#ifdef MODULES_UART_BITBANG
bigcall UART_BitBang_Init
#endif
#ifdef MODULES_UART_HW
bigcall NET_Uart_Init
#endif
#ifdef MODULES_TTYONUART1
bigcall TtyOnUart1_Init
#endif
#ifdef MODULES_UARTFD0
bigcall UARTFD0_Init
#endif
#ifdef MODULES_UARTFD1
bigcall UARTFD1_Init
#endif
#ifdef MODULES_COMONUART0
bigcall ComOnUart0_Init
#endif
#ifdef MODULES_COMONUART1
bigcall ComOnUart1_Init
#endif
#ifdef MODULES_COM2W
bigcall COM2W_Init
#endif
#ifdef MODULES_COM2W0
bigcall COM2W0_Init
#endif
#ifdef MODULES_COM2W1
bigcall COM2W1_Init
#endif
#ifdef MODULES_COM2WN
bigcall COM2WN_Init
#endif
#ifdef MODULES_COM2WI
bigcall COM2WI_Init
#endif
#ifdef MODULES_MOTION
bigcall Motion_Init
#endif
#ifdef MODULES_TWI_MASTER
bigcall TWI_Master_Init
#endif
#ifdef MODULES_OWI_MASTER
bigcall OwiMaster_Init
#endif
#ifdef MODULES_SPI_HW
bigcall SPIHW_Init
#endif
#ifdef MODULES_LCD
bigcall LCD_Init
#endif
#ifdef MODULES_BMP280
bigcall BMP280_Init
#endif
#ifdef MODULES_SI7021
bigcall SI7021_Init
#endif
#ifdef MODULES_SGP30
bigcall SGP30_Init
#endif
#ifdef MODULES_SGP40
bigcall SGP40_Init
#endif
#ifdef MODULES_DS18B20
bigcall Ds18b20_Init
#endif
#ifdef MODULES_STATS
bigcall Stats_Init
#endif
#ifdef MODULES_CNY70
bigcall CNY70_Init
#endif
#ifdef MODULES_REED
bigcall REED_Init
#endif
#ifdef MODULES_SK6812
bigcall SK6812_Init
#endif
#ifdef MODULES_MOTION_LIGHT
bigcall MotionLight_Init
#endif
#ifdef MODULES_TCRT1000
bigcall TCRT1K_Init
#endif
#ifdef MODULES_CCS811
bigcall CCS811_Init
#endif
#ifdef MODULES_ILI9341
bigcall ILI9341_Init
#endif
#ifdef MODULES_XPT2046
bigcall XPT2046_Init
#endif
#ifdef MODULES_BRIGHTNESS
bigcall Brightness_Init
#endif
#ifdef MODULES_DS3231
bigcall Ds3231_Init
#endif
; done
ret
; @end
; ---------------------------------------------------------------------------
; runModules
;
; Call run functions of the used modules. Add your routine calls here.
;
; @return CFLAG set: at least one RUN routine returned CFLAG set
; @clobbers all
runModules:
clr r16
push r16
bigcall BaseTimer_Run
pop r16
sbci r16, 0
#ifdef MODULES_TTYONUART1
push r16
bigcall TtyOnUart1_Run
pop r16
#endif
#ifdef MODULES_UARTFD0
push r16
bigcall UARTFD0_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_UARTFD1
push r16
bigcall UARTFD1_Run
pop r16
sbci r16, 0
#endif
#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_COM2W
push r16
bigcall COM2W_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
#ifdef MODULES_COM2WI
push r16
bigcall COM2WI_Run
pop r16
sbci r16, 0
#endif
; add more modules here
; check for repeat request
tst r16
clc
breq runModules_end
sec
runModules_end:
ret
; @end
mainModulesOnPacketReceived:
#ifdef MODULES_SK6812
bigcall SK6812_OnPacketReceived
#endif
#ifdef MODULES_LED_SIMPLE
#ifdef MODULES_NETWORK
bigcall LedSimple_OnPacketReceived
#endif
#endif
#ifdef MODULES_BEEPER_SIMPLE
#ifdef MODULES_NETWORK
bigcall BeeperSimple_OnPacketReceived
#endif
#endif
#ifdef MODULES_DS3231
#ifdef MODULES_NETWORK
bigcall Ds3231_OnPacketReceived
#endif
#endif
#ifdef MODULES_DS3231
#ifdef MODULES_NETWORK
bigcall Ds3231_OnPacketReceived
#endif
#endif
; add more here
ret
; @end

View File

@@ -0,0 +1,111 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_100MS_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_100MS_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine onSystemTimerTick
;
; Called every 100ms. No arguments, no results.
modulesOnEvery100ms:
#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
ret
; @end
#endif

View File

@@ -0,0 +1,29 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_1D_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_1D_ASM
; ***************************************************************************
; code
.cseg
modulesOnEveryDay:
ret
; @end
#endif

View File

@@ -0,0 +1,28 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_1H_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_1H_ASM
; ***************************************************************************
; code
.cseg
modulesOnEveryHour:
ret
; @end
#endif

View File

@@ -0,0 +1,37 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_1M_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_1M_ASM
; ***************************************************************************
; code
.cseg
modulesOnEveryMinute:
#ifdef MODULES_CCS811
bigcall CCS811_OnEveryMinute
#endif
#ifdef MODULES_DS3231
bigcall Ds3231_OnEveryMinute
#endif
ret
; @end
#endif

View File

@@ -0,0 +1,37 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_1S_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_1S_ASM
; ***************************************************************************
; code
.cseg
modulesOnEverySecond:
#ifdef MODULES_DS18B20
bigcall Ds18b20_OnEverySecond
#endif
#ifdef MODULES_SGP30
bigcall SGP30_EverySecond
#endif
ret
; @end
#endif

View File

@@ -0,0 +1,279 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_INCLUDE_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_INCLUDE_ASM
; ***************************************************************************
; code
.cseg
#ifdef MODULES_XRAM
.include "modules/xram/main.asm"
#endif
#ifdef MODULES_HEAP
.include "modules/heap/main.asm"
#endif
#ifdef MODULES_NETWORK
.include "common/crc8.asm"
.include "common/m_fixedbuffers.asm"
.include "common/m_ringbuffer_y.asm"
.include "common/ringbuffer_y.asm"
.include "modules/network/defs.asm"
.include "modules/network/data.asm"
.include "modules/network/iface.asm"
.include "modules/network/main.asm"
.include "modules/network/buffer.asm"
.include "modules/network/msg/defs.asm"
.include "modules/network/msg/common.asm"
.include "modules/network/msg/crc.asm"
.include "modules/network/msg/value-w.asm"
.include "modules/network/msg/value-r.asm"
.include "modules/network/msg/addr-r.asm"
.include "modules/network/msg/addr-w.asm"
#endif
#ifdef MODULES_UART_BITBANG
.include "modules/uart_bitbang2/defs.asm"
.include "modules/uart_bitbang2/iface.asm"
.include "modules/uart_bitbang2/bytelevel.asm"
.include "modules/uart_bitbang2/msglevel.asm"
#endif
#ifdef MODULES_UART_HW
.include "modules/uart_hw/defs.asm"
.include "modules/uart_hw/lowlevel.asm"
.include "modules/uart_hw/uart.asm"
.include "modules/uart_hw/attn.asm"
.include "modules/uart_hw/net_uart.asm"
#endif
#ifdef MODULES_COMONUART0
;.include "modules/uart_hw/defs.asm"
;.include "modules/uart_hw/lowlevel.asm"
;.include "modules/uart_hw/m_lowlevel_uart.asm"
;.include "modules/uart_hw/comonuart0.asm"
.include "modules/uart_hw2/defs.asm"
.include "modules/uart_hw2/comonuart0.asm"
#endif
#ifdef MODULES_COMONUART1
;.include "modules/uart_hw/defs.asm"
;.include "modules/uart_hw/lowlevel.asm"
;.include "modules/uart_hw/m_lowlevel_uart.asm"
;.include "modules/uart_hw/comonuart1.asm"
.include "modules/uart_hw2/defs.asm"
.include "modules/uart_hw2/comonuart1.asm"
#endif
#ifdef MODULES_TTYONUART1
.include "modules/uart_hw/defs.asm"
.include "modules/uart_hw/lowlevel.asm"
.include "modules/uart_hw/m_lowlevel_uart.asm"
.include "modules/uart_hw/ttyonuart1.asm"
;.include "modules/uart_hw2/defs.asm"
;.include "modules/uart_hw2/ttyonuart1.asm"
#endif
#ifdef MODULES_COM2W
.include "modules/com2w/defs.asm"
.include "modules/com2w/com2w.asm"
#endif
#ifdef MODULES_COM2W0
.include "modules/com2w/defs.asm"
.include "modules/com2w/common.asm"
.include "modules/com2w/com2w0.asm"
#endif
#ifdef MODULES_COM2W1
.include "modules/com2w/defs.asm"
.include "modules/com2w/common.asm"
.include "modules/com2w/com2w1.asm"
#endif
#ifdef MODULES_COM2WN
.include "modules/com2w/defs.asm"
.include "modules/com2w/com2wn_init.asm"
.include "modules/com2w/com2wn_io.asm"
.include "modules/com2w/com2wn_irq.asm"
.include "modules/com2w/com2wn_recv.asm"
.include "modules/com2w/com2wn_run.asm"
.include "modules/com2w/com2wn_send.asm"
.include "modules/com2w/com2wn_wait.asm"
.include "modules/com2w/com2wn_data.asm"
#endif
#ifdef MODULES_COM2WI
.include "modules/com2w/com2wi2.asm"
#endif
#ifdef MODULES_UARTFD0
.include "modules/uart_fd/defs.asm"
.include "modules/uart_fd/macros.asm"
.include "modules/uart_fd/uartfd0.asm"
#endif
#ifdef MODULES_UARTFD1
.include "modules/uart_fd/defs.asm"
.include "modules/uart_fd/macros.asm"
.include "modules/uart_fd/uartfd1.asm"
#endif
#ifdef MODULES_CLOCK
.include "modules/clock/main.asm"
#endif
#ifdef MODULES_LED_SIMPLE
.include "modules/led_simple/main.asm"
#ifdef MODULES_NETWORK
.include "modules/led_simple/recv.asm"
#endif
#endif
#ifdef MODULES_LED_SIGNAL
.include "modules/led_signal/main.asm"
#endif
#ifdef MODULES_LED_ACTIVITY
.include "modules/led_activity/main.asm"
#endif
#ifdef MODULES_BEEPER_SIMPLE
.include "modules/beeper_simple/main.asm"
#ifdef MODULES_NETWORK
.include "modules/beeper_simple/recv.asm"
#endif
#endif
#ifdef MODULES_TWI_MASTER
.include "modules/twimaster/main.asm"
#endif
#ifdef MODULES_SI7021
.include "modules/si7021/main2.asm"
#ifdef MODULES_NETWORK
.include "modules/si7021/send.asm"
#endif
.include "common/multiply.asm"
#endif
#ifdef MODULES_SGP30
.include "modules/sgp30/main.asm"
#ifdef MODULES_NETWORK
.include "modules/sgp30/send.asm"
#endif
#endif
#ifdef MODULES_SGP40
.include "modules/sgp40/main.asm"
#ifdef MODULES_NETWORK
.include "modules/sgp40/send.asm"
#endif
#endif
#ifdef MODULES_OWI_MASTER
.include "modules/owimaster/main.asm"
#endif
#ifdef MODULES_SPI_HW
.include "modules/spi_hw/main.asm"
#endif
#ifdef MODULES_DS18B20
.include "modules/ds18b20/main2.asm"
#ifdef MODULES_NETWORK
.include "modules/ds18b20/send.asm"
#endif
#endif
#ifdef MODULES_DS3231
.include "modules/rtc/ds3231/main.asm"
#ifdef MODULES_NETWORK
.include "modules/network/msg/time-d.asm"
.include "modules/network/msg/time-r.asm"
.include "modules/network/msg/time-w.asm"
.include "modules/rtc/ds3231/recv.asm"
.include "modules/rtc/ds3231/send.asm"
#endif
#endif
#ifdef MODULES_MOTION
.include "modules/motion/main2.asm"
#endif
#ifdef MODULES_CCS811
.include "modules/ccs811/main.asm"
#ifdef MODULES_NETWORK
.include "modules/ccs811/send.asm"
#endif
#endif
#ifdef MODULES_TCRT1000
.include "modules/tcrt1000/main2.asm"
#endif
#ifdef MODULES_SK6812
.include "modules/sk6812/main.asm"
#ifdef MODULES_NETWORK
.include "modules/sk6812/recv.asm"
#endif
#endif
#ifdef MODULES_LCD
.include "modules/lcd/main.asm"
#endif
#ifdef MODULES_ILI9341
.include "modules/lcd2/ili9341/defs.asm"
.include "modules/lcd2/ili9341/colors.asm"
.include "modules/lcd2/ili9341/images.asm"
.include "modules/lcd2/ili9341/main.asm"
.include "modules/lcd2/ili9341/io_spi.asm"
.include "modules/lcd2/ili9341/graphops.asm"
.include "modules/lcd2/ili9341/text.asm"
#endif
#ifdef MODULES_XPT2046
.include "modules/lcd2/xpt2046/main.asm"
#endif
#ifdef MODULES_FONT
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/main.asm"
#endif
#ifdef MODULES_FONT_8X8
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/font8x8.asm"
#endif
#ifdef MODULES_FONT_6X8
.include "modules/lcd2/font/defs.asm"
.include "modules/lcd2/font/font6x8.asm"
#endif
#ifdef MODULES_BRIGHTNESS
.include "modules/brightness/main.asm"
#ifdef MODULES_NETWORK
.include "modules/brightness/send.asm"
#endif
#endif
#endif

View File

@@ -0,0 +1,217 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_INIT_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_INIT_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine initModules
;
; Call init functions of the used modules. Add your routine calls here.
modulesInit:
bigcall BaseTimer_Init ; unconditionally call this
#ifdef MODULES_HEAP
bigcall Heap_Init
#endif
#ifdef MODULES_CLOCK
bigcall Clock_Init
#endif
#ifdef MODULES_TIMER
bigcall Timer_Init
#endif
#ifdef MODULES_XRAM
bigcall XRAM_Init
#endif
#ifdef MODULES_LED
ldi zl, LOW(ledA3Flash)
ldi zh, HIGH(ledA3Flash)
ldi yl, LOW(ledA3Sram)
ldi yh, HIGH(ledA3Sram)
bigcall Led_Init
#endif
#ifdef MODULES_LED_SIMPLE
bigcall LedSimple_Init
#endif
#ifdef MODULES_LED_SIGNAL
bigcall LedSignal_Init
#endif
#ifdef MODULES_LED_ACTIVITY
bigcall LedActivity_Init
#endif
#ifdef MODULES_BEEPER_SIMPLE
bigcall BeeperSimple_Init
#endif
#ifdef MODULES_COM
bigcall Com2_Init ; init COM module
bigcall CPRO_Init ; init COM protocol module
#endif
#ifdef MODULES_NETWORK
bigcall NET_Init
#endif
#ifdef MODULES_UART_BITBANG
bigcall UART_BitBang_Init
#endif
#ifdef MODULES_UART_HW
bigcall NET_Uart_Init
#endif
#ifdef MODULES_TTYONUART1
bigcall TtyOnUart1_Init
#endif
#ifdef MODULES_UARTFD0
bigcall UARTFD0_Init
#endif
#ifdef MODULES_UARTFD1
bigcall UARTFD1_Init
#endif
#ifdef MODULES_COMONUART0
bigcall ComOnUart0_Init
#endif
#ifdef MODULES_COMONUART1
bigcall ComOnUart1_Init
#endif
#ifdef MODULES_COM2W
bigcall COM2W_Init
#endif
#ifdef MODULES_COM2W0
bigcall COM2W0_Init
#endif
#ifdef MODULES_COM2W1
bigcall COM2W1_Init
#endif
#ifdef MODULES_COM2WN
bigcall COM2WN_Init
#endif
#ifdef MODULES_COM2WI
bigcall COM2WI_Init
#endif
#ifdef MODULES_MOTION
bigcall Motion_Init
#endif
#ifdef MODULES_TWI_MASTER
bigcall TWI_Master_Init
#endif
#ifdef MODULES_OWI_MASTER
bigcall OwiMaster_Init
#endif
#ifdef MODULES_SPI_HW
bigcall SPIHW_Init
#endif
#ifdef MODULES_LCD
bigcall LCD_Init
#endif
#ifdef MODULES_BMP280
bigcall BMP280_Init
#endif
#ifdef MODULES_SI7021
bigcall SI7021_Init
#endif
#ifdef MODULES_SGP30
bigcall SGP30_Init
#endif
#ifdef MODULES_SGP40
bigcall SGP40_Init
#endif
#ifdef MODULES_DS18B20
bigcall Ds18b20_Init
#endif
#ifdef MODULES_STATS
bigcall Stats_Init
#endif
#ifdef MODULES_CNY70
bigcall CNY70_Init
#endif
#ifdef MODULES_REED
bigcall REED_Init
#endif
#ifdef MODULES_SK6812
bigcall SK6812_Init
#endif
#ifdef MODULES_MOTION_LIGHT
bigcall MotionLight_Init
#endif
#ifdef MODULES_TCRT1000
bigcall TCRT1K_Init
#endif
#ifdef MODULES_CCS811
bigcall CCS811_Init
#endif
#ifdef MODULES_ILI9341
bigcall ILI9341_Init
#endif
#ifdef MODULES_XPT2046
bigcall XPT2046_Init
#endif
#ifdef MODULES_BRIGHTNESS
bigcall Brightness_Init
#endif
#ifdef MODULES_DS3231
bigcall Ds3231_Init
#endif
; done
ret
; @end
#endif

View File

@@ -0,0 +1,60 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_MSG_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_MSG_ASM
; ***************************************************************************
; code
.cseg
modulesOnPacketReceived:
#ifdef MODULES_SK6812
bigcall SK6812_OnPacketReceived
#endif
#ifdef MODULES_LED_SIMPLE
#ifdef MODULES_NETWORK
bigcall LedSimple_OnPacketReceived
#endif
#endif
#ifdef MODULES_BEEPER_SIMPLE
#ifdef MODULES_NETWORK
bigcall BeeperSimple_OnPacketReceived
#endif
#endif
#ifdef MODULES_DS3231
#ifdef MODULES_NETWORK
bigcall Ds3231_OnPacketReceived
#endif
#endif
#ifdef MODULES_DS3231
#ifdef MODULES_NETWORK
bigcall Ds3231_OnPacketReceived
#endif
#endif
; add more here
ret
; @end
#endif

View File

@@ -0,0 +1,123 @@
; ***************************************************************************
; copyright : (C) 2026 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
#ifndef AQH_AVR_DEVICES_ALL_MODULES_RUN_ASM
#define AQH_AVR_DEVICES_ALL_MODULES_RUN_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine modulesRun
;
; Call run functions of the used modules. Add your routine calls here.
;
; @return CFLAG set: at least one RUN routine returned CFLAG set
; @clobbers all
modulesRun:
clr r16
push r16
bigcall BaseTimer_Run
pop r16
sbci r16, 0
#ifdef MODULES_TTYONUART1
push r16
bigcall TtyOnUart1_Run
pop r16
#endif
#ifdef MODULES_UARTFD0
push r16
bigcall UARTFD0_Run
pop r16
sbci r16, 0
#endif
#ifdef MODULES_UARTFD1
push r16
bigcall UARTFD1_Run
pop r16
sbci r16, 0
#endif
#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_COM2W
push r16
bigcall COM2W_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
#ifdef MODULES_COM2WI
push r16
bigcall COM2WI_Run
pop r16
sbci r16, 0
#endif
; add more modules here
; check for repeat request
tst r16
clc
breq modulesRun_end
sec
modulesRun_end:
ret
; @end
#endif