-
Notifications
You must be signed in to change notification settings - Fork 0
/
Akta3d_TFT_Utils.h
65 lines (49 loc) · 1016 Bytes
/
Akta3d_TFT_Utils.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
#ifndef Akta3d_TFT_Utils_h
#define Akta3d_TFT_Utils_h
#include "Arduino.h"
#include <TouchScreen.h>
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
#define PORTRAIT 0
#define LANDSCAPE 1
struct Akta3d_Screen_Settings {
int xp;
int xm;
int yp;
int ym;
int tsLeft;
int tsRight;
int tsTop;
int tsBottom;
int orientation;
int minPressure;
int maxPressure;
};
struct Akta3d_Touch_Info {
bool down;
uint16_t x;
uint16_t y;
};
struct RGB {
uint16_t r;
uint16_t g;
uint16_t b;
};
struct HSV {
uint16_t h;
uint16_t s;
uint16_t v;
};
class Akta3d_TFT_Utils
{
public:
// colors helpers
static uint16_t rgbToHex(RGB rgb);
static RGB hsvToRgb(HSV hsv);
static HSV rgbToHsv(RGB rgb);
static uint16_t hsvToHex(HSV hsv);
static HSV hexToHsv(uint16_t color);
// touchscreen helpers
static Akta3d_Touch_Info getTouchInfo(MCUFRIEND_kbv *tft, TouchScreen *ts, Akta3d_Screen_Settings settings);
};
#endif