ArduinoDumbDisplay
v0.9.9-r50
DumbDisplay Arduino Library -- https://github.com/trevorwslee/Arduino-DumbDisplay
Loading...
Searching...
No Matches
ddatftutil.h
1
// ***
2
// * assume inclusion TFT_eSPI.h
3
// ***
4
5
//#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
6
//#include <Adafruit_SPITFT.h>
7
8
#ifndef _dd_a_tft_util_h
9
#define _dd_a_tft_util_h
10
11
#include "_dd_misc.h"
12
13
class
AfTftDDDebugInterface
:
public
DrawTextDDDebugInterface
{
14
public
:
15
AfTftDDDebugInterface
(
/*Adafruit_ST77xx*/
Adafruit_SPITFT& tft,
int
x = 0,
int
y = 0
/*, uint8_t fontSize = 2, uint8_t font = 1*/
,
bool
indicateSendCommand =
false
): tft(tft) {
16
this->x = x;
17
this->y = y;
18
//this->fontSize = fontSize;
19
//this->font = font;
20
this->indicateSendCommand = indicateSendCommand;
21
}
22
public
:
23
virtual
void
logSendCommand
(
int
state) {
24
if
(indicateSendCommand) {
25
tft.fillRect(x + 2, y + 2, x + 12, y + 12, 0xFFFF
/*ST77XX_WHITE*/
);
26
if
(state == 1) {
27
tft.fillCircle(x + 7, y + 7, 5, 0xF800
/*ST77XX_RED*/
);
28
}
29
}
30
}
31
protected
:
32
virtual
void
drawText(
const
char
* text,
bool
isError) {
33
if
(isError) {
34
showMsg(text, 80);
35
}
else
{
36
showMsg(text, 16);
37
}
38
}
39
private
:
40
void
showMsg(
const
char
* msg,
int
xOff) {
41
//uint32_t textcolor = tft.textcolor;
42
//uint32_t textbgcolor = tft.textbgcolor;
43
//uint8_t textsize = tft.textsize;
44
//tft.setTextColor(ST77XX_RED, ST77XX_WHITE);
45
//tft.setTextSize(fontSize);
46
//tft.drawString(msg, x + xOff, y, font);
47
//tft.setTextColor(textcolor, textbgcolor);
48
//tft.setTextSize(textsize);
49
tft.setCursor(x + xOff, y);
50
tft.print(msg);
51
}
52
private
:
53
Adafruit_SPITFT& tft;
54
int
x;
55
int
y;
56
//uint8_t fontSize;
57
//uint8_t font;
58
bool
indicateSendCommand;
59
};
60
61
62
// class TftDDDebugInterface: public DDDebugInterface {
63
// public:
64
// TftDDDebugInterface(TFT_eSPI& tft, int x = 0, int y = 0, uint8_t fontSize = 2, uint8_t font = 1, bool indicateSendCommand = false): tft(tft) {
65
// this->x = x;
66
// this->y = y;
67
// this->fontSize = fontSize;
68
// this->font = font;
69
// this->indicateSendCommand = indicateSendCommand;
70
// }
71
// public:
72
// virtual void logConnectionState(DDDebugConnectionState connectionState) {
73
// const char* state = NULL;
74
// switch (connectionState) {
75
// case DDDebugConnectionState::DEBUG_NOT_CONNECTED:
76
// state = "NCed";
77
// break;
78
// case DDDebugConnectionState::DEBUG_CONNECTING:
79
// state = "Cing ";
80
// break;
81
// case DDDebugConnectionState::DEBUG_CONNECTED:
82
// state = "Ced ";
83
// break;
84
// case DDDebugConnectionState::DEBUG_RECONNECTING:
85
// state = "RCing";
86
// break;
87
// case DDDebugConnectionState::DEBUG_RECONNECTED:
88
// state = "RCed ";
89
// break;
90
// }
91
// if (state != NULL) {
92
// showMsg(state, 16);
93
// }
94
// }
95
// virtual void logSendCommand(int state) {
96
// if (indicateSendCommand) {
97
// tft.fillRect(x + 2, y + 2, x + 12, y + 12, TFT_WHITE);
98
// if (state == 1) {
99
// tft.fillCircle(x + 7, y + 7, 5, TFT_RED);
100
// }
101
// }
102
// }
103
// virtual void logError(const String& errMsg) {
104
// showMsg("Err", 80);
105
// }
106
// protected:
107
// void showMsg(const char* msg, int xOff) {
108
// uint32_t textcolor = tft.textcolor;
109
// uint32_t textbgcolor = tft.textbgcolor;
110
// uint8_t textsize = tft.textsize;
111
// tft.setTextColor(TFT_RED, TFT_WHITE);
112
// tft.setTextSize(fontSize);
113
// tft.drawString(msg, x + xOff, y, font);
114
// tft.setTextColor(textcolor, textbgcolor);
115
// tft.setTextSize(textsize);
116
// }
117
// private:
118
// TFT_eSPI& tft;
119
// int x;
120
// int y;
121
// uint8_t fontSize;
122
// uint8_t font;
123
// bool indicateSendCommand;
124
// };
125
126
#endif
AfTftDDDebugInterface
Definition:
ddatftutil.h:13
AfTftDDDebugInterface::logSendCommand
virtual void logSendCommand(int state)
Definition:
ddatftutil.h:23
DrawTextDDDebugInterface
Definition:
__dd_misc_debug.h:2
Arduino
ArduinoDumbDisplay
ddatftutil.h
Generated by
1.9.6