Files
aqhomecontrol/avr/devices/all/modules.asm
2025-08-25 10:22:50 +02:00

316 lines
4.6 KiB
NASM

; ***************************************************************************
; copyright : (C) 2025 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. *
; ***************************************************************************
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @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
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_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_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_BRIGHTNESS
bigcall Brightness_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
; 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
; add more here
ret
; @end