avr: send firmware version in FLASH_READY and DEVICE messages.

This commit is contained in:
Martin Preuss
2024-09-05 18:50:43 +02:00
parent cb6e21715a
commit eec544d1b8
2 changed files with 10 additions and 10 deletions

View File

@@ -26,21 +26,21 @@
; REGS: R3, R4, R16, R17, R18, X (R19, R20, R21)
CPRO_WriteDevice:
ldi r17, COM2_PAYLOAD_FLAGS_UID | (8<<COM2_PAYLOAD_FLAGS_SHIFT_NUM)
ldi r17, COM2_PAYLOAD_FLAGS_UID | (12<<COM2_PAYLOAD_FLAGS_SHIFT_NUM)
ldi r18, CPRO_CMD_DEVICE
rcall COM2_BeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
push yh
push yl
ldi zh, HIGH(devInfoBlock*2) ; 6-13: devInfoBlock
ldi zh, HIGH(devInfoBlock*2) ; 6-17: devInfoBlock
ldi zl, LOW(devInfoBlock*2)
ldi r18, 8
ldi r18, 12
rcall Utils_CopyFromFlash ; (R17, R18, X, Y)
pop yl
pop yh
sbiw xh:xl, 16 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload)
sbiw xh:xl, 20 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload)
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 17 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload, 1 byte crc)
sbiw xh:xl, 21 ; go back to beginning of message (1 byte dst addr, 1 byte length, 14 bytes payload, 1 byte crc)
ret