A library for SPI control of adafruit's neopixel ring and addressable LEDs.
Dependents: TI_NEOPIXEL_SPI_SAMPLE
TI_NEOPIXEL_SPI.h@4:70bc3528e07e, 2020-01-02 (annotated)
- Committer:
- tichise
- Date:
- Thu Jan 02 14:22:55 2020 +0000
- Revision:
- 4:70bc3528e07e
- Parent:
- 3:f0859c280204
add LED pattern
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 | 3:f0859c280204 | 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 | 4:70bc3528e07e | 27 | void chase2(int count, int bufferCount, rgbColor c1, rgbColor c2); |
tichise | 4:70bc3528e07e | 28 | void chaseReverse(int count, int bufferCount, rgbColor c1, rgbColor c2); |
tichise | 4:70bc3528e07e | 29 | |
tichise | 4:70bc3528e07e | 30 | void chaseRainbow(int count, int bufferCount); |
tichise | 0:c28aa7d4f97e | 31 | void circleRainbow(int count); |
tichise | 4:70bc3528e07e | 32 | |
tichise | 4:70bc3528e07e | 33 | void moon(int count, int startIndex, int stopIndex, rgbColor c1, rgbColor c2); |
tichise | 4:70bc3528e07e | 34 | |
tichise | 0:c28aa7d4f97e | 35 | rgbColor convertHsvToRgb(float h, float s, float v); |
tichise | 0:c28aa7d4f97e | 36 | |
tichise | 0:c28aa7d4f97e | 37 | private: |
tichise | 3:f0859c280204 | 38 | NeoPixelOut _neoPixel; |
tichise | 0:c28aa7d4f97e | 39 | }; |
tichise | 0:c28aa7d4f97e | 40 | |
tichise | 0:c28aa7d4f97e | 41 | #endif |