Luka Brajovic
/
ws2801B
Testing WS2801
Fork of ws2801 by
Diff: ws2801.h
- Revision:
- 3:2b362d164405
- Parent:
- 2:a147efe1f3a8
- Child:
- 4:5e71151b8ad7
--- a/ws2801.h Tue Jun 14 19:39:18 2011 +0000 +++ b/ws2801.h Sat Jun 18 00:33:14 2011 +0000 @@ -1,3 +1,28 @@ + /** +* +*Copyright (c) 2011 Thomas Olsson. +* +*Permission is hereby granted, free of charge, to any person obtaining a copy +*of this software and associated documentation files (the "Software"), to deal +*in the Software without restriction, including without limitation the rights +*to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +*copies of the Software, and to permit persons to whom the Software is +*furnished to do so, subject to the following conditions: +* +*The above copyright notice and this permission notice shall be included in +*all copies or substantial portions of the Software. +* +*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +*IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +*FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +*AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +*LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +*OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +*THE SOFTWARE. +* +* +*/ + #ifndef WS2801_H #define WS2801_H @@ -5,7 +30,14 @@ #include "HTML_color.h" -/** WS2801 class, controlling LED strips or arrays +/** WS2801 class, controlling LED strips or arrays like this http://www.sparkfun.com/products/10312 +* +* the WS2801 IC's are 5V but works well connected directly to mbed IO pins. +* +* You need a 5V power supply capable of about 2A to light up a 32 led strip, do NOT power from mbed(usb). +* +* the required reset delay is a blocking wait(), it can be lowered (or set to 0) if you want to use the +* time for executing code instead, data sheet says 500us but i found it need at least 800us. * * Example: * @code @@ -19,49 +51,43 @@ public: /** Create a new ws2801 object * - * More details about the function goes here - * and here - * + * * @param CKI clock pin * @param SDI data pin - * @param STRIP_LENGTH number of ws2801 IC's i strip or array - * @param reset_delay delay in us to allow latching data + * @param STRIP_LENGTH number of ws2801 IC's i strip or array defaults to 32 + * @param reset_delay delay in us to allow latching data defaults to 800 * @returns nothing */ ws2801(PinName CKI, PinName SDI, int STRIP_LENGTH = 32, int reset_delay = 800); /** write RGB color data to strip or array * - * More details about the function goes here - * and here + * color data for each LED is 3 bytes int the order of rrggbb. + * array must have STRIP_LENGTH number of elements * - * @param strip_colors array of color data, size must be 24xSTRIP_LENGHT bits + * @param strip_colors array of color data */ void post(int *strip_colors); /** clears the array or strip (all off) - * - * More details about the function goes here - * and here - * */ void clear(void); - /** dimms the entire array + /** set level of the entire array 0-100% * - * More details about the function goes here - * and here + * at low levels the colors may change because R,G or B + * reaches 0. * * @param level level in percent * @returns current level */ - int setlevel(int level=100); - /** set reset/write delay + int level(int level=0); + /** get/set reset/write delay * - * More details about the function goes here - * and here + * mainly for experimenting with reset values without recompiling, + * leave at default to begin with & then lower to get faster execution. * * @param delay delay in us * @returns delay in us */ - int setdelay(int reset_delay=800); + int delay(uint32_t reset_delay=800); private: DigitalOut _CKI;