A library for SPI control of adafruit's neopixel ring and addressable LEDs.
Dependents: TI_NEOPIXEL_SPI_SAMPLE
TI_NEOPIXEL_SPI.h@2:0148ac5c90fa, 2019-07-28 (annotated)
- Committer:
- tichise
- Date:
- Sun Jul 28 00:13:03 2019 +0000
- Revision:
- 2:0148ac5c90fa
- Parent:
- 0:c28aa7d4f97e
- Child:
- 3:f0859c280204
- Child:
- 5:69bb2a2fa11f
Compatible with large rings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tichise | 0:c28aa7d4f97e | 1 | #ifndef MBED_TI_NEOPIXEL_SPI_H |
tichise | 0:c28aa7d4f97e | 2 | #define MBED_TI_NEOPIXEL_SPI_H |
tichise | 0:c28aa7d4f97e | 3 | |
tichise | 0:c28aa7d4f97e | 4 | #include "mbed.h" |
tichise | 0:c28aa7d4f97e | 5 | #include "neopixel.h" |
tichise | 0:c28aa7d4f97e | 6 | |
tichise | 0:c28aa7d4f97e | 7 | typedef struct rgbColor |
tichise | 0:c28aa7d4f97e | 8 | { |
tichise | 0:c28aa7d4f97e | 9 | uint8_t red; |
tichise | 0:c28aa7d4f97e | 10 | uint8_t green; |
tichise | 0:c28aa7d4f97e | 11 | uint8_t blue; |
tichise | 0:c28aa7d4f97e | 12 | } rgbColor; |
tichise | 0:c28aa7d4f97e | 13 | |
tichise | 0:c28aa7d4f97e | 14 | class TI_NEOPIXEL_SPI |
tichise | 0:c28aa7d4f97e | 15 | { |
tichise | 0:c28aa7d4f97e | 16 | public: |
tichise | 0:c28aa7d4f97e | 17 | TI_NEOPIXEL_SPI(PinName input); |
tichise | 2:0148ac5c90fa | 18 | |
tichise | 0:c28aa7d4f97e | 19 | void switchLightOff(int count); |
tichise | 2:0148ac5c90fa | 20 | void switchLightOn(int count, int startCount, int endCount, rgbColor rgbColor); |
tichise | 0:c28aa7d4f97e | 21 | |
tichise | 2:0148ac5c90fa | 22 | void changeColor(int count, int startCount, int endCount, rgbColor rgbColor); |
tichise | 2:0148ac5c90fa | 23 | void changePointColor(int count, int topIndex, int endIndex, rgbColor topColor, rgbColor bottomColor); |
tichise | 0:c28aa7d4f97e | 24 | |
tichise | 2:0148ac5c90fa | 25 | void circle(int count, int startCount, int endCount, rgbColor rgbColor); |
tichise | 0:c28aa7d4f97e | 26 | void chase(int count, int bufferCount, rgbColor c1, rgbColor c2); |
tichise | 2:0148ac5c90fa | 27 | void chaseRainbow(int count); |
tichise | 0:c28aa7d4f97e | 28 | void circleRainbow(int count); |
tichise | 0:c28aa7d4f97e | 29 | rgbColor convertHsvToRgb(float h, float s, float v); |
tichise | 0:c28aa7d4f97e | 30 | |
tichise | 0:c28aa7d4f97e | 31 | private: |
tichise | 0:c28aa7d4f97e | 32 | neopixel::PixelArray _ledStrip; |
tichise | 0:c28aa7d4f97e | 33 | }; |
tichise | 0:c28aa7d4f97e | 34 | |
tichise | 0:c28aa7d4f97e | 35 | #endif |