avr: added routine CPRO_ReadValue

This commit is contained in:
Martin Preuss
2024-11-03 15:33:56 +01:00
parent 51a585740d
commit 630dc2cecb

View File

@@ -16,6 +16,35 @@
.cseg
; ---------------------------------------------------------------------------
; @routine CPRO_ReadValue @global
; Read a REPORT_VALUE/SET_VALUE message.
;
; @param X buffer to read from
; @return R17 value id
; @return R19:R18 value
; @return R21:R20 denom (e.g. 100, meaning value must be divided by 100)
; @return R22 source address
; @return R23 command
CPRO_ReadValue:
adiw xh:xl, 2
ld r23, X+ ; command
ld r22, X+ ; src address
adiw xh:xl, 6 ; skip uid, msg id
ld r17, X
adiw xh:xl, 2 ; skip value id, value type
ld r18, X+
ld r19, X+
ld r20, X+
ld r21, X+
sbiw xh:xl, 16 ; back to msg begin
ret
; @end
; ---------------------------------------------------------------------------
; @routine CPRO_WriteReportValue @global
; Write a REPORT_VALUE packet.