148 lines
3.2 KiB
NASM
148 lines
3.2 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. *
|
|
; ***************************************************************************
|
|
|
|
|
|
; ***************************************************************************
|
|
; defines
|
|
|
|
.equ APP_REPORT_SENSORS_INTERVAL_SECS = 60
|
|
|
|
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
.cseg
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine AppReportSensors_Init @global
|
|
;
|
|
; @clobbers r16
|
|
|
|
AppReportSensors_Init:
|
|
clr r16
|
|
sts reportSensorTimer, r16
|
|
sec
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine AppReportSensors_Fini @global
|
|
;
|
|
|
|
AppReportSensors_Fini:
|
|
; nothing to do
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine AppReportSensors_OnEverySecond @global
|
|
;
|
|
|
|
AppReportSensors_OnEverySecond:
|
|
in r15, SREG
|
|
push r15
|
|
cli
|
|
rcall AppReportSensors_OnEverySecond_noIrqs
|
|
out SREG, r15
|
|
ret
|
|
AppReportSensors_OnEverySecond_noIrqs:
|
|
lds r16, reportSensorTimer
|
|
inc r16
|
|
cpi r16, APP_REPORT_SENSORS_INTERVAL_SECS
|
|
brcs AppReportSensors_OnEverySecond_store
|
|
clr r16
|
|
AppReportSensors_OnEverySecond_store:
|
|
sts reportSensorTimer, r16
|
|
|
|
#ifdef MODULES_SGP30
|
|
; push r16
|
|
; rcall SGP30_Measure
|
|
; pop r16
|
|
#endif
|
|
|
|
#ifdef MODULES_SI7021
|
|
cpi r16, 1
|
|
breq AppReportSensors_OnEverySecond_measureValue1
|
|
cpi r16, 19
|
|
breq AppReportSensors_OnEverySecond_measureValue2
|
|
cpi r16, 39
|
|
breq AppReportSensors_OnEverySecond_sendValue1
|
|
cpi r16, 49
|
|
breq AppReportSensors_OnEverySecond_sendValue2
|
|
#endif
|
|
|
|
#ifdef MODULES_SGP40
|
|
cpi r16, 27
|
|
breq AppReportSensors_OnEverySecond_measureValue4
|
|
cpi r16, 55
|
|
breq AppReportSensors_OnEverySecond_sendValue4
|
|
#endif
|
|
|
|
#ifdef MODULES_SGP30
|
|
cpi r16, 29
|
|
breq AppReportSensors_OnEverySecond_measureValue5
|
|
cpi r16, 57
|
|
breq AppReportSensors_OnEverySecond_sendValue5
|
|
cpi r16, 59
|
|
breq AppReportSensors_OnEverySecond_sendValue6
|
|
#endif
|
|
|
|
#ifdef MODULES_DS18B20
|
|
cpi r16, 9
|
|
breq AppReportSensors_OnEverySecond_sendValue3
|
|
#endif
|
|
|
|
ret
|
|
|
|
#ifdef MODULES_SI7021
|
|
AppReportSensors_OnEverySecond_measureValue1:
|
|
rjmp SI7021_MeasureTemp
|
|
AppReportSensors_OnEverySecond_measureValue2:
|
|
rjmp SI7021_MeasureHumidity
|
|
AppReportSensors_OnEverySecond_sendValue1:
|
|
rjmp SI7021_SendTemperature
|
|
AppReportSensors_OnEverySecond_sendValue2:
|
|
rjmp SI7021_SendHumidity
|
|
#endif
|
|
|
|
#ifdef MODULES_DS18B20
|
|
AppReportSensors_OnEverySecond_sendValue3:
|
|
rjmp Ds18b20_SendTemperature
|
|
#endif
|
|
|
|
#ifdef MODULES_SGP40
|
|
AppReportSensors_OnEverySecond_measureValue4:
|
|
rjmp SGP40_MeasureRawSignal
|
|
AppReportSensors_OnEverySecond_sendValue4:
|
|
rjmp SGP40_SendTVOC
|
|
#endif
|
|
|
|
#ifdef MODULES_SGP30
|
|
AppReportSensors_OnEverySecond_measureValue5:
|
|
rjmp SGP30_Measure
|
|
AppReportSensors_OnEverySecond_sendValue5:
|
|
rjmp SGP30_SendTVOC
|
|
ret
|
|
AppReportSensors_OnEverySecond_sendValue6:
|
|
rjmp SGP30_SendCO2
|
|
#endif
|
|
|
|
; @end
|
|
|
|
|
|
|