This library lets you control the addressable RGB LED strips from Pololu Robotics. Forked to add selectable colour order (Support RGB or GRB Leds)

Fork of PololuLedStrip by David Grayson

Files at this revision

API Documentation at this revision

Comitter:
DavidEGrayson
Date:
Wed Nov 13 21:16:24 2013 +0000
Parent:
19:46d7ab0ba3e7
Child:
21:87fd6273e0ff
Commit message:
Swapped the order of red and green so it will work with the new WS2812B strips.

Changed in this revision

led_strip_write_color.s Show annotated file Show diff for this revision Revisions of this file
--- a/led_strip_write_color.s	Wed Oct 09 01:13:49 2013 +0000
+++ b/led_strip_write_color.s	Wed Nov 13 21:16:24 2013 +0000
@@ -21,22 +21,21 @@
     ; Additionally, we use these registers:
     ;   R4:  temporary register
     ;   R5:  temporary register
-    ;   R6: shift register that holds the 24-bit color
+    ;   R6:  shift register that holds the 24-bit color
     ;   R7:  the number of bits we still need to send
     ;   R13: Link Register, holds return addresses.
 
     ; Push those registers so we can restore them later.
     push {r4, r5, r6, r7, lr}
 
+    ldrb r6, [r0, #1]  ; Load green.
+    lsls r6, r6, #24   ; Put green in MSB of r6.
     ldrb r4, [r0, #0]  ; Load red.
-    lsls r4, r4, #24
-    mov r6, r4         ; Put red in MSB of r6.
-    ldrb r4, [r0, #1]  ; Load green.
     lsls r4, r4, #16
-    orrs r6, r6, r4    ; Put green in r6.
+    orrs r6, r6, r4    ; Put red in r6.
     ldrb r4, [r0, #2]  ; Load blue.
     lsls r4, r4, #8
-    orrs r6, r6, r4    ; Put blue in MSB of r6.
+    orrs r6, r6, r4    ; Put blue in LSB of r6.
    
     ; On the Cortex M0 we simply did:
     ;    ldr r6, [r0]       ; Read the color.  Now we have:     xxBbGgRr