avr: added apps and missing files.

This commit is contained in:
Martin Preuss
2025-05-01 00:53:29 +02:00
parent 7edaed601b
commit 8008819989
12 changed files with 296 additions and 6 deletions

View File

@@ -6,6 +6,8 @@
door
motion
network
reportsensors
stats
</subdirs>
<extradist>

15
avr/apps/door/0BUILD Normal file
View File

@@ -0,0 +1,15 @@
<?xml?>
<gwbuild>
<subdirs>
</subdirs>
<extradist>
main.asm
</extradist>
</gwbuild>

View File

@@ -42,8 +42,9 @@ AppDoor_Init:
ldi yl, LOW(appDoorKeepupData)
ldi yh, HIGH(appDoorKeepupData)
rcall FilterKeepUp_Init
ldi r16, APP_DOOR_KEEPUPTIME
std Y+FILTER_KEEPUP_OFFS_RESTARTVALUE, r16
ldi r16, LOW(APP_DOOR_KEEPUPTIME)
ldi r17, HIGH(APP_DOOR_KEEPUPTIME)
rcall FilterKeepUp_SetRestartValue
ldi yl, LOW(appDoorValSchedData)
ldi yh, HIGH(appDoorValSchedData)
@@ -106,7 +107,7 @@ appDoorSendValue:
appDoorSendValue_send:
ldi r17, VALUE_ID_TCRT1K ; VALUE ID
ldi r22, AQHOME_VALUETYPE_DOOR ; VALUE TYPE
rjmp Main_Send8BitValue
rjmp Main_Send8BitValueReport
; @end

15
avr/apps/motion/0BUILD Normal file
View File

@@ -0,0 +1,15 @@
<?xml?>
<gwbuild>
<subdirs>
</subdirs>
<extradist>
main.asm
</extradist>
</gwbuild>

View File

@@ -41,8 +41,9 @@ AppMotion_Init:
ldi yl, LOW(appMotionKeepupData)
ldi yh, HIGH(appMotionKeepupData)
rcall FilterKeepUp_Init
ldi r16, APP_MOTION_KEEPUPTIME
std Y+FILTER_KEEPUP_OFFS_RESTARTVALUE, r16
ldi r16, LOW(APP_MOTION_KEEPUPTIME)
ldi r17, HIGH(APP_MOTION_KEEPUPTIME)
rcall FilterKeepUp_SetRestartValue
ldi yl, LOW(appMotionValSchedData)
ldi yh, HIGH(appMotionValSchedData)
@@ -99,7 +100,7 @@ appMotionSendValue:
ldi r17, VALUE_ID_MOTION ; VALUE ID
ldi r22, AQHOME_VALUETYPE_MOTION ; VALUE TYPE
rjmp Main_Send8BitValue
rjmp Main_Send8BitValueReport
; @end

16
avr/apps/network/0BUILD Normal file
View File

@@ -0,0 +1,16 @@
<?xml?>
<gwbuild>
<subdirs>
</subdirs>
<extradist>
main.asm
stats.asm
</extradist>
</gwbuild>

View File

@@ -0,0 +1,16 @@
<?xml?>
<gwbuild>
<subdirs>
</subdirs>
<extradist>
data.asm
main.asm
</extradist>
</gwbuild>

View File

@@ -0,0 +1,16 @@
; ***************************************************************************
; 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. *
; ***************************************************************************
.dseg
reportSensorTimer: .byte 1 ; seconds counter

View File

@@ -0,0 +1,95 @@
; ***************************************************************************
; 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

16
avr/apps/stats/0BUILD Normal file
View File

@@ -0,0 +1,16 @@
<?xml?>
<gwbuild>
<subdirs>
</subdirs>
<extradist>
data.asm
main.asm
</extradist>
</gwbuild>

16
avr/apps/stats/data.asm Normal file
View File

@@ -0,0 +1,16 @@
; ***************************************************************************
; 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. *
; ***************************************************************************
.dseg
appStatsTimer: .byte 1 ; minutes counter

81
avr/apps/stats/main.asm Normal file
View File

@@ -0,0 +1,81 @@
; ***************************************************************************
; 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_STATS_INTERVAL_MINS = 10
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine AppStats_Init @global
;
; @clobbers r16
AppStats_Init:
clr r16
sts appStatsTimer, r16
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine AppStats_Fini @global
;
AppStats_Fini:
; nothing to do
ret
; @end
; ---------------------------------------------------------------------------
; @routine AppStats_OnEveryMinute @global
;
AppStats_OnEveryMinute:
lds r16, appStatsTimer
inc r16
cpi r16, APP_STATS_INTERVAL_MINS
brcs AppStats_OnEveryMinute_store
clr r16
AppStats_OnEveryMinute_store:
sts appStatsTimer, r16
ldi yl, LOW(netInterfaceData)
ldi yh, HIGH(netInterfaceData)
cpi r16, 1
breq AppStats_OnEveryMinute_sendDevice
cpi r16, 2
breq AppStats_OnEveryMinute_sendTxdStats
cpi r16, 3
breq AppStats_OnEveryMinute_sendRxdStats
ret
AppStats_OnEveryMinute_sendTxdStats:
rjmp AppNetwork_SendTxdStats
AppStats_OnEveryMinute_sendRxdStats:
rjmp AppNetwork_SendRxdStats
AppStats_OnEveryMinute_sendDevice:
rjmp AppNetwork_SendDevice
; @end