Reconsidered input pin and NC pin for SPI. Modified several functions interface and its contents.

Dependents:   WS2812_out_of_specification_demo

Committer:
chris
Date:
Sat Jul 26 23:08:04 2014 +0000
Revision:
0:be22a9d4df5f
Child:
1:c278c3d136bb
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chris 0:be22a9d4df5f 1 /* Copyright (c) 2012 cstyles, MIT License
chris 0:be22a9d4df5f 2 *
chris 0:be22a9d4df5f 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
chris 0:be22a9d4df5f 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
chris 0:be22a9d4df5f 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
chris 0:be22a9d4df5f 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
chris 0:be22a9d4df5f 7 * furnished to do so, subject to the following conditions:
chris 0:be22a9d4df5f 8 *
chris 0:be22a9d4df5f 9 * The above copyright notice and this permission notice shall be included in all copies or
chris 0:be22a9d4df5f 10 * substantial portions of the Software.
chris 0:be22a9d4df5f 11 *
chris 0:be22a9d4df5f 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
chris 0:be22a9d4df5f 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
chris 0:be22a9d4df5f 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
chris 0:be22a9d4df5f 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
chris 0:be22a9d4df5f 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
chris 0:be22a9d4df5f 17 */
chris 0:be22a9d4df5f 18
chris 0:be22a9d4df5f 19 #ifndef WS2812_H
chris 0:be22a9d4df5f 20 #define WS2812_H
chris 0:be22a9d4df5f 21
chris 0:be22a9d4df5f 22 #include "mbed.h"
chris 0:be22a9d4df5f 23
chris 0:be22a9d4df5f 24 #define WS1 0x38
chris 0:be22a9d4df5f 25 #define WS0 0x30
chris 0:be22a9d4df5f 26 #define SPICLK 5000000
chris 0:be22a9d4df5f 27 #define SPIBPF 6
chris 0:be22a9d4df5f 28
chris 0:be22a9d4df5f 29 //!Library for the WS2812 RGB LED with integrated controller
chris 0:be22a9d4df5f 30 /*!
chris 0:be22a9d4df5f 31 The WS2812 is controller that is built into a range of LEDs
chris 0:be22a9d4df5f 32 */
chris 0:be22a9d4df5f 33 class WS2812
chris 0:be22a9d4df5f 34 {
chris 0:be22a9d4df5f 35 public:
chris 0:be22a9d4df5f 36 //!Creates an instance of the class.
chris 0:be22a9d4df5f 37 /*!
chris 0:be22a9d4df5f 38 Connect WS2812 address addr using SPI MOSI pins
chris 0:be22a9d4df5f 39 */
chris 0:be22a9d4df5f 40 WS2812(PinName d, int size);
chris 0:be22a9d4df5f 41
chris 0:be22a9d4df5f 42 /*!
chris 0:be22a9d4df5f 43 Destroys instance.
chris 0:be22a9d4df5f 44 */
chris 0:be22a9d4df5f 45 ~WS2812();
chris 0:be22a9d4df5f 46
chris 0:be22a9d4df5f 47 //!Reads the current temperature.
chris 0:be22a9d4df5f 48 /*!
chris 0:be22a9d4df5f 49 Reads the temperature register of the LM75B and converts it to a useable value.
chris 0:be22a9d4df5f 50 */
chris 0:be22a9d4df5f 51 void update (int buf[]);
chris 0:be22a9d4df5f 52 void setAll (int color);
chris 0:be22a9d4df5f 53 void useII (int d);
chris 0:be22a9d4df5f 54 void setII (unsigned char d);
chris 0:be22a9d4df5f 55
chris 0:be22a9d4df5f 56
chris 0:be22a9d4df5f 57 private:
chris 0:be22a9d4df5f 58
chris 0:be22a9d4df5f 59 int __size;
chris 0:be22a9d4df5f 60 unsigned char __II;
chris 0:be22a9d4df5f 61 int __use_II;
chris 0:be22a9d4df5f 62 SPI __spi;
chris 0:be22a9d4df5f 63
chris 0:be22a9d4df5f 64 void __write (int color);
chris 0:be22a9d4df5f 65
chris 0:be22a9d4df5f 66
chris 0:be22a9d4df5f 67 };
chris 0:be22a9d4df5f 68
chris 0:be22a9d4df5f 69 #endif