diff --git a/avr/modules/comproto/msg_value.asm b/avr/modules/comproto/msg_value.asm index 211452f..ab9ee32 100644 --- a/avr/modules/comproto/msg_value.asm +++ b/avr/modules/comproto/msg_value.asm @@ -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.