ESP_IOT v2.5
IOT ESP Coding
M5Display.cpp
Go to the documentation of this file.
1#include "../../Defines.h"
2#include "M5Display.h"
3
4#ifdef M5UNIFIED
6{
7 SerialDebug.println("setup_M5Display");
8}
9#else
10#include "LED_DisPlay.h"
11//! the LED DIsplay Object
12LED_DisPlay _dis;
13boolean _M5DisplaySetup = false;
14
15void setup_M5Display()
16{
17 SerialDebug.println("setup_M5Display");
18 _dis.begin();
19 _dis.setTaskName("LEDs");
20 _dis.setTaskPriority(2);
21 _dis.setCore(1);
22 _dis.start();
23
24 _M5DisplaySetup = true;
25
26}
27
28char *colorName(CRGB Color)
29{
30 if (Color == L_RED)
31 return (char*)"L_RED";
32 else if (Color == L_GREEN)
33 return (char*)"L_GREEN";
34 else if (Color == L_BLUE)
35 return (char*)"L_BLUE";
36 else if (Color == L_WHITE)
37 return (char*)"L_WHITE";
38 else if (Color == L_YELLOW)
39 return (char*)"L_YELLOW";
40 else
41 return (char*)"UNKNOWN";
42}
43
44void animation(uint8_t *buffptr, uint8_t amspeed, uint8_t ammode, int64_t amcount )
45{
46 _dis.animation(buffptr, amspeed, ammode, amcount);
47}
48void displaybuff(uint8_t *buffptr, int8_t offsetx, int8_t offsety )
49{
50 _dis.displaybuff(buffptr, offsetx, offsety);
51}
52void setBrightness(uint8_t brightness)
53{
54 _dis.setBrightness(brightness);
55}
56void drawpix(uint8_t xpos, uint8_t ypos, CRGB Color)
57{
58 _dis.drawpix(xpos, ypos, Color);
59}
60void drawpix(uint8_t Number, CRGB Color)
61{
62 SerialDebug.printf("drawpix(%s)\n", colorName(Color));
63 _dis.drawpix(Number, Color);
64}
65void clear()
66{
67 if (_M5DisplaySetup)
68 _dis.clear();
69}
70
71void fillpix(CRGB Color)
72{
73 SerialDebug.printf("atom.fillPix %s\n", colorName(Color));
74 if (_M5DisplaySetup)
75 _dis.fillpix(Color);
76 else
77 SerialDebug.printf("***atom.fillPix NOT Setup yet");
78
79}
80
81long _randomColorIndex = 0;
82#define MAX_COLORS 5
83//! 7.24.25 return a (semi) random color
84CRGB getRandomColor()
85{
87 switch (_randomColorIndex)
88 {
89 case 0: return L_RED;
90 case 1: return L_GREEN;
91 case 2: return L_BLUE;
92 case 3: return L_WHITE;
93 default:
94 case 4: return L_YELLOW;
95
96 }
97}
98
99#endif // USE_FAST_LED
void setup_M5Display()
the setup() no loop()
Definition: M5Display.cpp:5
long _randomColorIndex
these are the constanst for the colors
#define MAX_COLORS
ColorsUnified getRandomColor()
7.24.25 return a (semi) random color