Repository navigation
Expand file tree
/
Copy pathOledDisplay.cpp
More file actions
executable file
·116 lines (97 loc) · 2.78 KB
/
Copy pathOledDisplay.cpp
File metadata and controls
executable file
·116 lines (97 loc) · 2.78 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <Arduino.h>
#include <Wire.h>
#include <SSD1306Wire.h>
#include <OLEDDisplayUi.h>
#include "OledDisplay.h"
#include "images.h"
#include "WifiSetup.h"
SSD1306Wire display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL
OLEDDisplayUi slide (&display);
const char *SSID = getSsid();
const char *PASSWORD = getPassword();
void slide1(OLEDDisplay *display,OLEDDisplayUiState *state,int16_t x,int16_t y)
{
display->drawXbm(42 + x, 0 + y, LogoWidth, LogoHeight, FingerPrintLogo);
display->setFont(ArialMT_Plain_10);
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->drawString(64 + x, 45 + y, "ATTENDANCE SYSTEM");
}
void slide2(OLEDDisplay *display,OLEDDisplayUiState *state,int16_t x,int16_t y)
{
display->setFont(ArialMT_Plain_16);
display->setTextAlignment(TEXT_ALIGN_LEFT);
display->drawString(0 + x, 0 + y, "WiFi ssid:");
display->drawString(0 + x, 14 + y, SSID);
display->drawString(0 + x, 30 + y, "Password:");
display->drawString(0 + x, 44 + y, PASSWORD);
}
void slide3(OLEDDisplay *display,OLEDDisplayUiState *state,int16_t x,int16_t y)
{
display->setFont(ArialMT_Plain_16);
display->setTextAlignment(TEXT_ALIGN_CENTER);
display->drawString(64 + x, 14 + y, "IP Address:");
display->drawString(64 + x, 30 + y, "192.168.4.1");
}
FrameCallback slides[] =
{
slide1,
slide2,
slide3
};
int slideCount = 3;
void displayInit()
{
display.init();
display.flipScreenVertically();
}
void slideshowInit()
{
slide.setTargetFPS(60);
slide.setTimePerFrame(10000);
slide.setActiveSymbol(activeSymbol);
slide.setInactiveSymbol(inactiveSymbol);
slide.setIndicatorPosition(BOTTOM);
slide.setIndicatorDirection(LEFT_RIGHT);
slide.setFrameAnimation(SLIDE_LEFT);
slide.setFrames(slides, slideCount);
slide.init();
display.flipScreenVertically();
}
void updateSlide()
{
slide.update();
}
void displayInfo(const char* message)
{
display.clear();
display.setFont(ArialMT_Plain_16);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawStringMaxWidth(0, 0, 127, message);
display.display();
}
void displayPlaceFinger()
{
displayInfo("Place your finger on the fingerprint sensor.");
}
void displayRemoveFinger()
{
displayInfo("Remove your finger from the fingerprint sensor");
}
void displaySuccessXbmWithInfo(const char* info)
{
display.clear();
display.drawXbm(46, 0, successWidth, successHeight, fingerprintSuccess);
display.setFont(ArialMT_Plain_16);
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.drawStringMaxWidth(64, 34, 128, info);
display.display();
}
void displayErrorXbmWithInfo(const char* info)
{
display.clear();
display.drawXbm(46, 0, errorWidth, errorHeight, fingerprintError);
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.drawStringMaxWidth(64, 34, 128, info);
display.display();
}