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
Diff: led_strip_write_color.s
- Revision:
- 8:1578776ceac5
- Parent:
- 7:9a088f042ee0
- Child:
- 9:6ffb85d69eaf
--- a/led_strip_write_color.s Fri Mar 01 01:16:48 2013 +0000 +++ b/led_strip_write_color.s Fri Mar 01 02:05:21 2013 +0000 @@ -22,20 +22,20 @@ ; Additionally, we use these registers: ; R4: temporary register ; R5: temporary register + ; R6: shift register that holds the 24-bit color ; R7: the number of bits we still need to send - ; R12: shift register that holds the 24-bit color ; R13: Link Register, holds return addresses. - push {r4, r5, r12, r7, lr} ; Push those registers so we can restore them later. + push {r4, r5, r6, r7, lr} ; Push those registers so we can restore them later. - ldr r12, [r0] ; Read the color. Now we have: xxBbGgRr - rbit r12, r12 ; Reverse the order of the bits: rRgGbBxx - rev r12, r12 ; Reverse the order of the bytes: xxbBgGrR + ldr r6, [r0] ; Read the color. Now we have: xxBbGgRr + rbit r6, r6 ; Reverse the order of the bits: rRgGbBxx + rev r6, r6 ; Reverse the order of the bytes: xxbBgGrR mov r7, #24 ; Initialize the loop counter register. send_led_strip_bit str r3, [r1] ; Drive the line high. - rrxs r12, r12 ; Rotate right through carry. + rrxs r6, r6 ; Rotate right through carry. delay #0 @@ -53,7 +53,7 @@ bne send_led_strip_bit ; Send another bit if we have not reached zero. led_strip_asm_end - pop {r4, r5, r12, r7, lr} + pop {r4, r5, r6, r7, lr} bx lr