Library for the WS2812 LED Driver. Uses bit banging and nops for precise timing. Number of nops executed are configurable at run time.
leds.h@3:31c18f8b2ddf, 2020-06-24 (annotated)
- Committer:
- turumputum
- Date:
- Wed Jun 24 12:41:31 2020 +0000
- Revision:
- 3:31c18f8b2ddf
good for me
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
turumputum | 3:31c18f8b2ddf | 1 | #include "mbed.h" |
turumputum | 3:31c18f8b2ddf | 2 | #include "PixelArray.h" |
turumputum | 3:31c18f8b2ddf | 3 | #include "WS2812.h" |
turumputum | 3:31c18f8b2ddf | 4 | #include "config.h" |
turumputum | 3:31c18f8b2ddf | 5 | |
turumputum | 3:31c18f8b2ddf | 6 | #define LedOff 0 |
turumputum | 3:31c18f8b2ddf | 7 | #define LedWait 1 |
turumputum | 3:31c18f8b2ddf | 8 | #define LedOn 3 |
turumputum | 3:31c18f8b2ddf | 9 | #define LedBlink 4 |
turumputum | 3:31c18f8b2ddf | 10 | #define LedRun 5 |
turumputum | 3:31c18f8b2ddf | 11 | |
turumputum | 3:31c18f8b2ddf | 12 | |
turumputum | 3:31c18f8b2ddf | 13 | class LedGroupInside |
turumputum | 3:31c18f8b2ddf | 14 | { |
turumputum | 3:31c18f8b2ddf | 15 | public: |
turumputum | 3:31c18f8b2ddf | 16 | LedGroupInside(PinName pin, int placeInTable, int size); |
turumputum | 3:31c18f8b2ddf | 17 | //~LedGroup(); |
turumputum | 3:31c18f8b2ddf | 18 | void light(int mode, int gS); |
turumputum | 3:31c18f8b2ddf | 19 | private: |
turumputum | 3:31c18f8b2ddf | 20 | PinName __outPin; |
turumputum | 3:31c18f8b2ddf | 21 | int __mode; |
turumputum | 3:31c18f8b2ddf | 22 | int __placeInTable; |
turumputum | 3:31c18f8b2ddf | 23 | int __size; |
turumputum | 3:31c18f8b2ddf | 24 | PixelArray __pa; |
turumputum | 3:31c18f8b2ddf | 25 | WS2812 __leds; |
turumputum | 3:31c18f8b2ddf | 26 | }; |
turumputum | 3:31c18f8b2ddf | 27 | |
turumputum | 3:31c18f8b2ddf | 28 | |
turumputum | 3:31c18f8b2ddf | 29 | int color_set(uint8_t red,uint8_t green, uint8_t blue); |
turumputum | 3:31c18f8b2ddf | 30 | void startUp_Led(); |
turumputum | 3:31c18f8b2ddf | 31 | void fadeEffect(); |
turumputum | 3:31c18f8b2ddf | 32 | void lightLeds(int gS); |