Files
aqhomecontrol/avr/modules/beeper_simple/recv.asm
2026-02-02 21:20:25 +01:00

42 lines
1.3 KiB
NASM

; ***************************************************************************
; copyright : (C) 2026 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. *
; ***************************************************************************
; ---------------------------------------------------------------------------
; @routine BeeperSimple_OnPacketReceived @global
;
; @clobbers any, -X
BeeperSimple_OnPacketReceived:
adiw xh:xl, NETMSG_OFFS_CMD ; command
ld r16, X
sbiw xh:xl, NETMSG_OFFS_CMD
cpi r16, NETMSG_CMD_VALUE_SET
breq BeeperSimple_OnPacketReceived_set
clc ; unexpected msg
ret
BeeperSimple_OnPacketReceived_set:
rcall NETMSG_ValueRead ; (none)
cpi r17, VALUE_ID_BEEPERSIMPLE_TIMING
breq BeeperSimple_OnPacketReceived_setTiming
clc
ret
BeeperSimple_OnPacketReceived_setTiming:
rcall BeeperSimple_SetTiming
BeeperSimple_OnPacketReceived_sendAck:
push xl
push xh
ldi r23, NETMSG_CMD_VALUE_SET_ACK
bigcall Main_SendValueResponse
pop xh
pop xl
sec
ret
; @end