-
Notifications
You must be signed in to change notification settings - Fork 1
/
RingClock.h
43 lines (39 loc) · 928 Bytes
/
RingClock.h
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
#ifndef RING_CLOCK_H
#define RING_CLOCK_H
#include "application.h"
#include "Time.h"
#include "ClockPattern.h"
#include "PatternCreator.h"
class RingClock {
public:
RingClock(
unsigned long leds[][3],
unsigned int ledCount,
unsigned int displayedHours,
PatternCreator patterns[],
unsigned int patternCount
);
~RingClock();
void init();
void tick();
unsigned long (*leds)[3];
unsigned int ledCount;
unsigned int displayedHours;
unsigned int ledsPerHour;
clock_time_t now;
clock_time_t last;
private:
void selectRandomPattern();
unsigned int patternCount;
PatternCreator * patternCreators;
ClockPattern * currentPattern;
bool initializing = true;
bool calculating = false;
bool ready = false;
bool firstRun = true;
int lastSecond = 0;
unsigned long lastMilliseconds = 0;
unsigned long millisecondsOffset = 0;
float lostMillisecondsMultiplicator = 1.0;
};
#endif