finished basic new structure.
This commit is contained in:
58
avr/modules/comproto/msg_value.asm
Normal file
58
avr/modules/comproto/msg_value.asm
Normal file
@@ -0,0 +1,58 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2023 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Write a VALUE packet.
|
||||
;
|
||||
; IN:
|
||||
; - R16: destination address
|
||||
; - R17: value id
|
||||
; - R19:R18: value
|
||||
; - R21:R20: denom (e.g. 100, meaning value must be divided by 100)
|
||||
; - R22: value type
|
||||
; - X : buffer to write to
|
||||
; OUT:
|
||||
; - CFLAG: set if okay, clear otherwise
|
||||
; MODIFIED REGS: R6, R7, R8, R9, R10, R11, R12, R16, R17, X, Y (R3, R4, R15, R16, R17, R18, R19, R20, R21)
|
||||
|
||||
CPRO_WriteValue:
|
||||
mov r7, r17
|
||||
mov r8, r18
|
||||
mov r9, r19
|
||||
mov r10, r20
|
||||
mov r11, r21
|
||||
mov r12, r22
|
||||
|
||||
ldi r17, COM2_PAYLOAD_FLAGS_UID | (6<<COM2_PAYLOAD_FLAGS_SHIFT_NUM)
|
||||
ldi r18, CPRO_CMD_VALUE
|
||||
push xh
|
||||
push xl
|
||||
rcall COM2_BeginMsgWithVariablePayload ; R3, R4, R16, R17, R18, R19, R20, R21, X
|
||||
st X+, r7 ; 6: value id
|
||||
st X+, r12 ; 7: value type
|
||||
st X+, r8 ; 8: low value
|
||||
st X+, r9 ; 9: high value
|
||||
st X+, r10 ; 10: low denom
|
||||
st X+, r11 ; 11: high denom
|
||||
pop xl
|
||||
pop xh
|
||||
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||
ret
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user