avr: more code sharing.

This commit is contained in:
Martin Preuss
2026-08-07 00:42:45 +02:00
parent 44044e9bba
commit 7bae2072aa
3 changed files with 145 additions and 98 deletions

View File

@@ -82,54 +82,13 @@ AppReportSensors_OnEverySecond_store:
appReportSensorsWalkTable:
ldi zl, LOW(appReportSensorsTable*2)
ldi zh, HIGH(appReportSensorsTable*2)
lds r22, reportSensorTimer
appReportSensorsWalkTable_loop:
lpm r16, Z+
adiw zh:zl, 1
lpm r18, Z+
lpm r19, Z+
mov r17, r18 ; routine==0?
or r17, r19
breq appReportSensorsWalkTable_loopEnd ; yes, end of table
tst r16 ; timer==0?
breq appReportSensorsWalkTable_loopCall ; yes, match any value
cp r22, r16
brne appReportSensorsWalkTable_loopNext ; skip
appReportSensorsWalkTable_loopCall:
push r22
push zl
push zh
push yl
push yh
rcall appReportSensorsCallR19R18
pop yh
pop yl
pop zh
pop zl
pop r22
appReportSensorsWalkTable_loopNext:
rjmp appReportSensorsWalkTable_loop
appReportSensorsWalkTable_loopEnd:
lds r16, reportSensorTimer
bigcall WalkTable
ret
; @end
; ---------------------------------------------------------------------------
; @routine appReportSensorsCallR19R18
; Call route at address r19:r18
appReportSensorsCallR19R18:
push r18
push r19
ret
; @end
#ifdef MODULES_SI7021
appReportSensorsSi7021MeasureValue1:
rjmp SI7021_MeasureTemp