From 66bc71b2bd6ae6597fab29d49595d4b981f64a15 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Thu, 26 Mar 2026 21:07:22 +0100 Subject: [PATCH] sk6812: minor reorganizing. works now with newer BTF LED stripes. --- avr/modules/sk6812/io.asm | 119 +------------------------------ avr/modules/sk6812/io0.asm | 118 +++++++++++++++++++++++++++++++ avr/modules/sk6812/io1.asm | 135 ++++++++++++++++++++++++++++++++++++ avr/modules/sk6812/main.asm | 64 ++--------------- 4 files changed, 261 insertions(+), 175 deletions(-) create mode 100644 avr/modules/sk6812/io0.asm create mode 100644 avr/modules/sk6812/io1.asm diff --git a/avr/modules/sk6812/io.asm b/avr/modules/sk6812/io.asm index bf39ad8..3e9e4d1 100644 --- a/avr/modules/sk6812/io.asm +++ b/avr/modules/sk6812/io.asm @@ -11,121 +11,6 @@ sk6812JumpTableSendByte: - rjmp sk6812SendByte0 - rjmp sk6812SendByte1 - - - - -; *************************************************************************** -; type 0 - - -.macro SK6812_SENDBIT0 -sk6812SendBit: ; 0 1 - rol r16 ; +1 +1 - brcs sk6812SendBit_send1 ; +1 +2 - ; send 0 - nop ; +1 - sbi SK6812_PORT, SK6812_PINNUM ; +2 - nop ; +1 - nop ; +1 - cbi SK6812_PORT, SK6812_PINNUM ; +2 -; nop ; +1 - nop ; +1 - rjmp sk6812SendBit_end ; +2 -sk6812SendBit_send1: - ; send 1 - sbi SK6812_PORT, SK6812_PINNUM ; +2 - nop ; +1 - nop ; +1 - nop ; +1 - cbi SK6812_PORT, SK6812_PINNUM ; +2 - nop ; +1 - nop ; +1 - nop ; +1 -sk6812SendBit_end: ; 13 13 -.endmacro - - - -; --------------------------------------------------------------------------- -; @routine sk6812SendByte0 -; -; Sends a byte to the LED strip -; @param r16 byte -; @clobbers r16 (r24, r25) - -sk6812SendByte0: - SK6812_SENDBIT0 - SK6812_SENDBIT0 - SK6812_SENDBIT0 - SK6812_SENDBIT0 - - SK6812_SENDBIT0 - SK6812_SENDBIT0 - SK6812_SENDBIT0 - SK6812_SENDBIT0 - ret -; @end - - - - - -; *************************************************************************** -; type 1 - - -.macro SK6812_SENDBIT1 - lsl r16 ; +1 - brcs l_sendOne ; +1 if false, +2 if branch taken - ; send ZERO - nop ; +1 - out SK6812_PORT, r25 ; +1 HIGH - nop ; +1 - nop ; +1 - nop - out SK6812_PORT, r24 ; +1 - nop ; +1 - rjmp l_end ; +2 -l_sendOne: - out SK6812_PORT, r25 ; +1 HIGH - nop ; +1 - nop ; +1 - nop ; +1 - nop ; +1 - nop ; +1 - out SK6812_PORT, r24 ; +1 - nop ; +1 -l_end: -.endmacro - - - -; --------------------------------------------------------------------------- -; @routine sk6812SendByte1 -; -; Sends a byte to the LED strip -; @param r16 byte -; @clobbers r16, r24, r25 - -sk6812SendByte1: - ldi r24, 0 - ldi r25, (1<