avr: add MODE variable to sk6812 module.

this allows for better control over led strips.

Modes:
- AUTO: allow other modules to switch LED strip
- OFF:  force LED strip off
- ON:   force LED strip on
This commit is contained in:
Martin Preuss
2025-10-01 23:24:50 +02:00
parent dafe32792a
commit 81e9078b80
6 changed files with 89 additions and 24 deletions

View File

@@ -30,6 +30,8 @@ SK6812_OnPacketReceived_set:
breq SK6812_OnPacketReceived_setNumLeds
cpi r17, VALUE_ID_LED_STATE
breq SK6812_OnPacketReceived_setState
cpi r17, VALUE_ID_LED_MODE
breq SK6812_OnPacketReceived_setMode
clc
ret
SK6812_OnPacketReceived_setRGBW:
@@ -50,7 +52,15 @@ SK6812_OnPacketReceived_setState:
pop r24
pop r17
rjmp SK6812_OnPacketReceived_sendAck
SK6812_OnPacketReceived_setMode:
push r17
push r24
push r25
rcall SK6812_SetMode ; value is in R18 (r16, r17, r18, r19, r20, r21, r23, r24, r25)
pop r25
pop r24
pop r17
rjmp SK6812_OnPacketReceived_sendAck
SK6812_OnPacketReceived_setNumLeds:
sts sk6812NumLeds, r18
SK6812_OnPacketReceived_sendAck: