-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmariobros-clock.ino
68 lines (52 loc) · 1.45 KB
/
mariobros-clock.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include "Clockface.h"
#include "WiFiConnect.h"
#include "CWDateTime.h"
MatrixPanel_I2S_DMA *dma_display = nullptr;
WiFiConnect wifi;
CWDateTime cwDateTime;
Clockface *clockface;
uint16_t myBLACK = dma_display->color565(0, 0, 0);
uint16_t myWHITE = dma_display->color565(255, 255, 255);
uint16_t myBLUE = dma_display->color565(0, 0, 255);
byte displayBright = 32;
void displaySetup() {
HUB75_I2S_CFG mxconfig(
64, // module width
64, // module height
1 // Chain length
);
mxconfig.gpio.e = 18;
mxconfig.clkphase = false;
#if HUB75_BLUE_GREEN_SWAP
// Swap Blue and Green pins because the panel is RBG instead of RGB.
mxconfig.gpio.b1 = 26;
mxconfig.gpio.b2 = 12;
mxconfig.gpio.g1 = 27;
mxconfig.gpio.g2 = 13;
#endif
// Display Setup
dma_display = new MatrixPanel_I2S_DMA(mxconfig);
dma_display->begin();
dma_display->setBrightness8(displayBright);
dma_display->clearScreen();
dma_display->fillScreen(myBLACK);
}
void setup() {
Serial.begin(115200);
displaySetup();
clockface = new Clockface(dma_display);
dma_display->setTextSize(1);
dma_display->setTextColor(myWHITE);
dma_display->setCursor(5, 0);
dma_display->println("CLOCKWISE");
dma_display->setTextColor(myBLUE);
dma_display->setCursor(0, 32);
dma_display->print("connecting...");
wifi.connect();
cwDateTime.begin();
clockface->setup(&cwDateTime);
}
void loop() {
clockface->update();
}