avr: use REED_OnPacketReceived and MotionLight_OnPacketReceived.
This commit is contained in:
@@ -309,71 +309,25 @@ onPacketReceived:
|
|||||||
brcs onPacketReceived_end
|
brcs onPacketReceived_end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MODULES_SK6812
|
||||||
|
rcall SK6812_OnPacketReceived
|
||||||
|
brcs onPacketReceived_end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MODULES_REED
|
||||||
|
rcall REED_OnPacketReceived
|
||||||
|
brcs onPacketReceived_end
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MODULES_COM
|
#ifdef MODULES_COM
|
||||||
rcall CPRO_OnPacketReceived
|
rcall CPRO_OnPacketReceived
|
||||||
brcs onPacketReceived_end
|
brcs onPacketReceived_end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cpi r16, CPRO_CMD_VALUE_SET
|
|
||||||
clc
|
clc
|
||||||
brne onPacketReceived_end
|
|
||||||
rjmp onSetValueReceived
|
|
||||||
onPacketReceived_end:
|
onPacketReceived_end:
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onSetValueReceived:
|
|
||||||
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUEID
|
|
||||||
ld r16, X
|
|
||||||
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUEID
|
|
||||||
|
|
||||||
#ifdef MODULES_SK6812
|
|
||||||
cpi r16, VALUE_ID_LED_RGBW_VALUE
|
|
||||||
brne onSetValueReceived_l1
|
|
||||||
rjmp onSetRgbwValue
|
|
||||||
onSetValueReceived_l1:
|
|
||||||
cpi r16, VALUE_ID_LED_NUMLEDS
|
|
||||||
brne onSetValueReceived_l2
|
|
||||||
rjmp onSetNumLeds
|
|
||||||
#endif
|
|
||||||
onSetValueReceived_l2:
|
|
||||||
ldi r16, CPRO_CMD_VALUE_SET_NACK
|
|
||||||
rcall CPRO_SendSetValueResponse
|
|
||||||
clc
|
|
||||||
onSetValueReceived_end:
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_SK6812
|
|
||||||
onSetRgbwValue:
|
|
||||||
; get new value
|
|
||||||
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
|
|
||||||
ld r18, X+ ; R
|
|
||||||
ld r19, X+ ; G
|
|
||||||
ld r20, X+ ; B
|
|
||||||
ld r21, X+ ; W
|
|
||||||
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE+4
|
|
||||||
rcall SK6812_SetAllColor
|
|
||||||
; send ACK
|
|
||||||
ldi r16, CPRO_CMD_VALUE_SET_ACK
|
|
||||||
rcall CPRO_SendSetValueResponse
|
|
||||||
sec
|
|
||||||
ret
|
|
||||||
|
|
||||||
onSetNumLeds:
|
|
||||||
; get new value
|
|
||||||
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
|
|
||||||
ld r16, X ; number of leds
|
|
||||||
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
|
|
||||||
sts sk6812NumLeds, r16
|
|
||||||
; send ACK
|
|
||||||
ldi r16, CPRO_CMD_VALUE_SET_ACK
|
|
||||||
rcall CPRO_SendSetValueResponse
|
|
||||||
sec
|
|
||||||
ret
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -434,52 +434,29 @@ onEvery100ms:
|
|||||||
; @clobbers all
|
; @clobbers all
|
||||||
|
|
||||||
onPacketReceived:
|
onPacketReceived:
|
||||||
; get msg code
|
#ifdef MODULES_MOTION_LIGHT
|
||||||
adiw xh:xl, COM2_MSG_OFFS_CMD
|
rcall MotionLight_OnPacketReceived
|
||||||
ld r16, x
|
brcs onPacketReceived_end
|
||||||
sbiw xh:xl, COM2_MSG_OFFS_CMD
|
#endif
|
||||||
|
|
||||||
cpi r16, CPRO_CMD_VALUE_SET
|
#ifdef MODULES_SK6812
|
||||||
brne onPacketReceived_l1
|
rcall SK6812_OnPacketReceived
|
||||||
; msg code is CPRO_CMD_VALUE_SET
|
brcs onPacketReceived_end
|
||||||
rjmp onSetValueReceived
|
#endif
|
||||||
|
|
||||||
onPacketReceived_l1:
|
#ifdef MODULES_REED
|
||||||
rjmp CPRO_OnPacketReceived
|
rcall REED_OnPacketReceived
|
||||||
|
brcs onPacketReceived_end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MODULES_COM
|
||||||
|
rcall CPRO_OnPacketReceived
|
||||||
|
brcs onPacketReceived_end
|
||||||
|
#endif
|
||||||
|
|
||||||
|
clc
|
||||||
|
onPacketReceived_end:
|
||||||
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onSetValueReceived:
|
|
||||||
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUEID
|
|
||||||
ld r16, X
|
|
||||||
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUEID
|
|
||||||
cpi r16, VALUE_ID_REED_CONF
|
|
||||||
brne onSetValueReceived_l1
|
|
||||||
#ifdef MODULES_REED
|
|
||||||
rjmp onSetReedConf
|
|
||||||
#else
|
|
||||||
ret
|
|
||||||
#endif
|
|
||||||
onSetValueReceived_l1:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULES_REED
|
|
||||||
onSetReedConf:
|
|
||||||
; get new value
|
|
||||||
adiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
|
|
||||||
ld r16, X
|
|
||||||
sbiw xh:xl, CPRO_PACKET_VALUE_OFFS_VALUE
|
|
||||||
; set config
|
|
||||||
rcall REED_SetConfig
|
|
||||||
; send ACK
|
|
||||||
ldi r16, CPRO_CMD_VALUE_SET_ACK
|
|
||||||
rcall CPRO_SendSetValueResponse
|
|
||||||
sec
|
|
||||||
ret
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user