sk6812: read and write led strip type.

This commit is contained in:
Martin Preuss
2026-03-25 20:45:50 +01:00
parent 946fdfe39e
commit 0c810a7842

View File

@@ -432,8 +432,10 @@ sk6812WriteConfToEeprom:
push r15 push r15
in r15, SREG in r15, SREG
cli cli
ldi xl, LOW(EEPROM_OFFS_SK6812_RGBW) ldi xl, LOW(EEPROM_OFFS_SK6812_RGBW)
ldi xh, HIGH(EEPROM_OFFS_SK6812_RGBW) ldi xh, HIGH(EEPROM_OFFS_SK6812_RGBW)
lds r16, sk6812RGBW lds r16, sk6812RGBW
rcall Eeprom_WriteByteIfChanged ; (R17) rcall Eeprom_WriteByteIfChanged ; (R17)
adiw xh:xl, 1 adiw xh:xl, 1
@@ -445,6 +447,10 @@ sk6812WriteConfToEeprom:
adiw xh:xl, 1 adiw xh:xl, 1
lds r16, sk6812RGBW+3 lds r16, sk6812RGBW+3
rcall Eeprom_WriteByteIfChanged ; (R17) rcall Eeprom_WriteByteIfChanged ; (R17)
adiw xh:xl, 1
lds r16, sk6812Type
rcall Eeprom_WriteByteIfChanged ; (R17)
out SREG, r15 out SREG, r15
pop r15 pop r15
ret ret
@@ -481,7 +487,16 @@ sk6812ReadConfFromEeprom:
rcall Eeprom_ReadByte rcall Eeprom_ReadByte
brcc sk6812ReadConfFromEeprom_default brcc sk6812ReadConfFromEeprom_default
mov r21, r16 mov r21, r16
adiw xh:xl, 1
; read type
rcall Eeprom_ReadByte
brcc sk6812ReadConfFromEeprom_default
cpi r16, SK6812_TYPE_NUM
brcc sk6812ReadConfFromEeprom_checkColor
sts sk6812Type, r16
sk6812ReadConfFromEeprom_checkColor:
mov r16, r18 mov r16, r18
and r16, r19 and r16, r19
and r16, r20 and r16, r20