nucleo version
Fork of PololuLedStrip by
Diff: led_strip_write_color.s
- Revision:
- 20:656bbcb64e3b
- Parent:
- 19:46d7ab0ba3e7
- Child:
- 21:87fd6273e0ff
--- 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