forked from Rich-Nelson/day-cycle-clock-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayOutput.h
98 lines (78 loc) · 2.31 KB
/
DisplayOutput.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
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
#ifndef do
#define do
#if (ARDUINO >=100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Servo.h>
#include "FastLED.h"
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <TFT_ILI9163C.h>
//#define DEBUG
#define SERVO_PIN 3
#define NUM_LEDS 45
#define NUM_ROWS 3
#define LED_PIN 6
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define __CS 8
#define __DC 9
#define __A0 10
#define BLACK 0x0000
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
enum MoonPhases {
NEW_MOON,
WAXING_CRESCENT,
FIRST_QUARTER,
WAXING_GIBBOUS,
FULL_MOON,
WANING_GIBBOUS,
THIRD_QUARTER,
WANING_CRESCENT
};
class DisplayOutput {
public:
// Constructor
DisplayOutput();
// Configuration
Servo servo;
CRGB leds[NUM_LEDS];
TFT_ILI9163C tft = TFT_ILI9163C(__CS, __A0 , __DC);
void begin();
// Mehods
void servoMoveTo(uint8_t degree, uint16_t s_delay);
void servoAttach();
void servoDetach();
void stripRGBRow(int r, int g, int b, int row);
void stripRGB(int colors[NUM_ROWS][3]);
void updateScreen(bool daytime, uint8_t moon_phase_precentage);
void drawSun();
void fillArc(int32_t x0, int32_t y0, int32_t r1, bool side, int8_t percent_transition, uint8_t phase, int16_t color);
void updateMoon( uint8_t moon_phase_precentage);
void drawMoon( uint8_t moon_phase, uint8_t moon_phase_precentage, int16_t x0, int16_t color);
void printMenuTitle(String titleString);
bool amCheck(int time_hour);
int convert12Hr(int time_hour);
void printAMPM(bool AM);
void printTime(int time_hour, int time_min);
void printDate(uint8_t month, uint8_t day, uint16_t year);
void printValue(int value, bool hr = false);
void fillMenuTitle();
void fillValue();
void fillAMPM();
void fillCircle(uint16_t color);
//variables
private:
String daysOfTheMonth[13] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
uint8_t moon_phase;
uint8_t phase_buffer = 2;
const bool MOON_SHADOW = 1;
uint8_t tft_width = 128;
uint8_t tft_height = 128;
uint8_t tft_center_height_offset = 1;
uint8_t tft_y_center = tft_height / 2 + tft_center_height_offset;
};
#endif