Files
aqhomecontrol/avr/apps/reportsensors/main.asm
2025-05-01 00:53:29 +02:00

96 lines
2.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:
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_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_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
; @end