Files
aqhomecontrol/avr/devices/all/modules.asm
2025-06-29 22:32:43 +02:00

253 lines
3.9 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_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_COMONUART0
bigcall ComOnUart0_Init
#endif
#ifdef MODULES_COMONUART1
bigcall ComOnUart1_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.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
runModules:
bigcall 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
bigcall Com2_Run
pop r16
brcc runModules_ComEnd
dec r16
brne runModules_Com
runModules_ComEnd:
#endif
#ifdef MODULES_TTYONUART1
bigcall TtyOnUart1_Run
#endif
#ifdef MODULES_COMONUART0
bigcall ComOnUart0_Run
#endif
#ifdef MODULES_COMONUART1
bigcall ComOnUart1_Run
#endif
#ifdef MODULES_STATS
bigcall Stats_Run
#endif
#ifdef MODULES_REED
bigcall REED_Run
#endif
#ifdef MODULES_CNY70
bigcall 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
bigcall SK6812_OnPacketReceived
#endif
#ifdef MODULES_LED_SIMPLE
#ifdef MODULES_NETWORK
bigcall LedSimple_OnPacketReceived
#endif
#endif
; add more here
ret
; @end