add functions to remotely set LED timing.
This commit is contained in:
@@ -78,17 +78,13 @@ LedSimple_Every100ms_setTimer:
|
||||
; @routine LedSimple_SetDefaultTiming @global
|
||||
;
|
||||
; Set default timing for LED.
|
||||
; @clobbers r16
|
||||
; @clobbers R18, R19
|
||||
;
|
||||
|
||||
LedSimple_SetDefaultTiming:
|
||||
ldi r16, LED_SIMPLE_ONTIME
|
||||
sts ledSimpleOnTime, r16
|
||||
sts ledSimpleTimer, r16
|
||||
ldi r16, LED_SIMPLE_OFFTIME
|
||||
sts ledSimpleOffTime, r16
|
||||
cbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; on
|
||||
ret
|
||||
ldi r18, LED_SIMPLE_ONTIME
|
||||
ldi r19, LED_SIMPLE_OFFTIME
|
||||
rjmp LedSimple_SetTiming
|
||||
; @end
|
||||
|
||||
|
||||
@@ -97,15 +93,30 @@ LedSimple_SetDefaultTiming:
|
||||
; @routine LedSimple_SetFastTiming @global
|
||||
;
|
||||
; Set fast blinking timing for LED. Switch LED on.
|
||||
; @clobbers r16
|
||||
; @clobbers R18, R19
|
||||
;
|
||||
|
||||
LedSimple_SetFastTiming:
|
||||
ldi r16, 5
|
||||
sts ledSimpleOnTime, r16
|
||||
sts ledSimpleTimer, r16
|
||||
ldi r16, 3
|
||||
sts ledSimpleOffTime, r16
|
||||
ldi r18, 5
|
||||
ldi r19, 3
|
||||
rjmp LedSimple_SetTiming
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine LedSimple_SetTiming @global
|
||||
;
|
||||
; Set blinking timing for LED. Switch LED on.
|
||||
; @param r18 ontime (in 1/10s)
|
||||
; @param r19 offtime (in 1/10s)
|
||||
; @clobbers none
|
||||
;
|
||||
|
||||
LedSimple_SetTiming:
|
||||
sts ledSimpleOnTime, r18
|
||||
sts ledSimpleTimer, r18
|
||||
sts ledSimpleOffTime, r19
|
||||
cbi LED_SIMPLE_PORT, LED_SIMPLE_PINNUM ; on
|
||||
ret
|
||||
; @end
|
||||
|
||||
46
avr/modules/led_simple/recv.asm
Normal file
46
avr/modules/led_simple/recv.asm
Normal file
@@ -0,0 +1,46 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2025 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 LedSimple_OnPacketReceived @global
|
||||
;
|
||||
; @clobbers any, -X
|
||||
|
||||
LedSimple_OnPacketReceived:
|
||||
adiw xh:xl, NETMSG_OFFS_CMD ; command
|
||||
ld r16, X
|
||||
sbiw xh:xl, NETMSG_OFFS_CMD
|
||||
cpi r16, NETMSG_CMD_VALUE_SET
|
||||
breq LedSimple_OnPacketReceived_set
|
||||
clc ; unexpected msg
|
||||
ret
|
||||
LedSimple_OnPacketReceived_set:
|
||||
rcall NETMSG_ValueRead ; (none)
|
||||
cpi r17, VALUE_ID_LEDSIMPLE_TIMING
|
||||
breq LedSimple_OnPacketReceived_setTiming
|
||||
clc
|
||||
ret
|
||||
LedSimple_OnPacketReceived_setTiming:
|
||||
tst r18
|
||||
breq LedSimple_OnPacketReceived_setDefaultTiming
|
||||
rcall LedSimple_SetTiming
|
||||
rjmp LedSimple_OnPacketReceived_sendAck
|
||||
LedSimple_OnPacketReceived_setDefaultTiming:
|
||||
rcall LedSimple_SetDefaultTiming
|
||||
LedSimple_OnPacketReceived_sendAck:
|
||||
push xl
|
||||
push xh
|
||||
ldi r23, NETMSG_CMD_VALUE_SET_ACK
|
||||
rcall Main_SendValueResponse
|
||||
pop xh
|
||||
pop xl
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
Reference in New Issue
Block a user