This is a simple controller for the ws2801 that I got working on my stm32f401re board, but it should generalize. It's meant to take a line of digits over serial to represent the state of the strip.
Dependencies: mbed-rtos mbed ws2801
Diff: main.cpp
- Revision:
- 2:032f1776f8bd
- Parent:
- 1:0634ad3920b7
--- a/main.cpp Mon Jan 26 03:44:39 2015 +0000 +++ b/main.cpp Mon Jan 26 03:46:49 2015 +0000 @@ -22,10 +22,10 @@ if (in != '\n' && in != '\r') { reading = true; if ( (c_len % 3) == 0 ) { - led_buffer[ c_len / 3 ] = (in - 48) * 0x220000; + led_buffer[ c_len / 3 ] = (in - 48) * 0x240000; } else { - led_buffer[ c_len / 3 ] += (in - 48) * (0x220000 >> (8 * (c_len % 3))); + led_buffer[ c_len / 3 ] += (in - 48) * (0x240000 >> (8 * (c_len % 3))); } c_len++;