This repository was archived by the owner on Jan 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIHandler.h
More file actions
50 lines (41 loc) · 1.43 KB
/
UIHandler.h
File metadata and controls
50 lines (41 loc) · 1.43 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
#ifndef UIHANDLER_H
#define UIHANDLER_H
#include <LCD_I2C.h>
#include "State.h"
#include "TimerHandler.h"
#include "StateHandler.h"
class UIHandler {
const int LCD_COLUMNS = 16;
const int LCD_ROWS = 2;
const int LCD_ADDRESS = 0x27;
LCD_I2C* lcd;
const unsigned int BLINK_DELAY = 500;
const int HOUR_FORMAT_SIZE = 5 + 1;
const int MIN_FORMAT_SIZE = 5 + 1;
const int SEC_FORMAT_SIZE = 5 + 1;
const int FORMAT_SIZE = HOUR_FORMAT_SIZE + MIN_FORMAT_SIZE + SEC_FORMAT_SIZE + 2 + 1;
// NOTE: arbitrary values, just don't make them 0 so there'll be a trigger to change the UI
unsigned long lastTarget = 420;
unsigned long lastPassed = 2121;
unsigned long lastBlink = 0;
bool wasBlink = true;
bool ifVisibleChange(unsigned long*, unsigned long*, bool);
bool isBlinkNeeded();
unsigned long timeToHour(unsigned long*);
unsigned long timeToMin(unsigned long*);
unsigned long timeToSec(unsigned long*);
char* getFormat(bool, int, int, char*);
char* getHourFormat(bool, char*);
char* getMinFormat(bool, char*);
char* getSecFormat(bool, char*);
char* getTimeFormat(bool, bool, bool, char*);
char* getTimeText(unsigned long*, bool, bool, bool, char*);
char* timeToText(unsigned long*, char*, bool, bool, bool);
bool handleBlink(bool, bool, bool);
void printTime(unsigned long*, bool, bool, bool);
public:
// NOTE: on avr/arduino(?) beginning stuff like this in a constructor breaks...
void begin();
void tick(StateHandler*);
};
#endif