ESP_IOT v2.5
IOT ESP Coding
LED_DisPlay.h
Go to the documentation of this file.
1#ifndef LED_DISPLAY_H_
2#define LED_DISPLAY_H_
3#include "../../Defines.h"
4
5#ifdef USE_FAST_LED
6/**
7 * Code is from M5Atom.h object, but refactored to be it's own object
8 */
9#include <FastLED.h>
10#include "Task.h"
11#include <freertos/FreeRTOS.h>
12#include <freertos/task.h>
13
14#define NUM_LEDS 25
15//#define DATA_PIN 27
16
17class LED_DisPlay : public Task
18{
19private:
20 CRGB _ledbuff[NUM_LEDS];
21 uint8_t _numberled;
22
23 uint8_t _mode;
24 uint16_t _am_speed;
25 uint8_t _am_mode;
26 int32_t _count_x, _count_y;
27 int32_t _am_count = -1;
28 uint8_t *_am_buffptr;
29 uint16_t _yRows = 5;
30 uint16_t _xColumns = 6;
31
32 SemaphoreHandle_t _xSemaphore = NULL;
33
34public:
35 enum
36 {
37 kStatic = 0,
38 kAnimation_run,
39 kAnimation_stop,
40 kAnimation_frush,
41 } Dismode;
42 enum
43 {
44 kMoveRight = 0x01,
45 kMoveLeft = 0x02,
46 kMoveTop = 0x04,
47 kMoveBottom = 0x08,
48 } Am_mode;
49
50 uint8_t Brightness = 40;
51
52
53 /* data */
54public:
55 LED_DisPlay();
56 ~LED_DisPlay();
57
58 void begin(uint8_t LEDNumber = NUM_LEDS);
59 void run(void *data);
60
61 void animation(uint8_t *buffptr, uint8_t amspeed, uint8_t ammode, int64_t amcount = -1);
62 void displaybuff(uint8_t *buffptr, int32_t offsetx = 0, int32_t offsety = 0);
63
64 void setBrightness(uint8_t brightness);
65 void drawpix(uint8_t xpos, uint8_t ypos, CRGB Color);
66 void drawpix(uint8_t Number, CRGB Color);
67 void fillpix(CRGB Color);
68 void clear();
69 boolean animationrunning();
70 void setWidthHeight(uint16_t xColumns, uint16_t yRows);
71
72private:
73 void _displaybuff(uint8_t *buffptr, int32_t offsetx = 0, int32_t offsety = 0);
74};
75
76
77#endif //USE_FAST_LED
78
79#endif //_LED_DISPLAY_H_