Files
aqhomecontrol/avr/devices/all/modules.asm
2025-05-14 01:49:23 +02:00

209 lines
3.3 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:
rcall BaseTimer_Init ; unconditionally call this
#ifdef MODULES_CLOCK
rcall Clock_Init
#endif
#ifdef MODULES_TIMER
rcall Timer_Init
#endif
#ifdef MODULES_LED
ldi zl, LOW(ledA3Flash)
ldi zh, HIGH(ledA3Flash)
ldi yl, LOW(ledA3Sram)
ldi yh, HIGH(ledA3Sram)
rcall Led_Init
#endif
#ifdef MODULES_LED_SIMPLE
rcall LedSimple_Init
#endif
#ifdef MODULES_COM
rcall Com2_Init ; init COM module
rcall CPRO_Init ; init COM protocol module
#endif
#ifdef MODULES_NETWORK
rcall NET_Init
#endif
#ifdef MODULES_UART_BITBANG
rcall UART_BitBang_Init
#endif
#ifdef MODULES_TTYONUART1
rcall TtyOnUart1_Init
#endif
#ifdef MODULES_COMONUART0
rcall ComOnUart0_Init
#endif
#ifdef MODULES_MOTION
rcall Motion_Init
#endif
#ifdef MODULES_TWI_MASTER
rcall TWI_Master_Init
#endif
#ifdef MODULES_OWI_MASTER
rcall OwiMaster_Init
#endif
#ifdef MODULES_LCD
rcall LCD_Init
#endif
#ifdef MODULES_BMP280
rcall BMP280_Init
#endif
#ifdef MODULES_SI7021
rcall SI7021_Init
#endif
#ifdef MODULES_DS18B20
rcall Ds18b20_Init
#endif
#ifdef MODULES_STATS
rcall Stats_Init
#endif
#ifdef MODULES_CNY70
rcall CNY70_Init
#endif
#ifdef MODULES_REED
rcall REED_Init
#endif
#ifdef MODULES_SK6812
rcall SK6812_Init
#endif
#ifdef MODULES_MOTION_LIGHT
rcall MotionLight_Init
#endif
#ifdef MODULES_TCRT1000
rcall TCRT1K_Init
#endif
#ifdef MODULES_CCS811
rcall CCS811_Init
#endif
; done
ret
; @end
; ---------------------------------------------------------------------------
; runModules
;
; Call run functions of the used modules. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
runModules:
rcall BaseTimer_Run
#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
rcall Com2_Run
pop r16
brcc runModules_ComEnd
dec r16
brne runModules_Com
runModules_ComEnd:
#endif
#ifdef MODULES_TTYONUART1
rcall TtyOnUart1_Run
#endif
#ifdef MODULES_COMONUART0
rcall ComOnUart0_Run
#endif
#ifdef MODULES_STATS
rcall Stats_Run
#endif
#ifdef MODULES_REED
rcall REED_Run
#endif
#ifdef MODULES_CNY70
rcall CNY70_Run
#endif
#ifdef MODULES_MOTION_LIGHT
; rcall MotionLight_Run
#endif
#ifdef MODULES_TCRT1000
; rcall TCRT1K_Run
#endif
; add more modules here
ret
mainModulesOnPacketReceived:
#ifdef MODULES_SK6812
rcall SK6812_OnPacketReceived
#endif
#ifdef MODULES_LED_SIMPLE
rcall LedSimple_OnPacketReceived
#endif
; add more here
ret
; @end