forked from jinschoi/SphereBot
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSerialDisplayPrint.h
55 lines (47 loc) · 1.62 KB
/
SerialDisplayPrint.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
/*
SerialDisplayPrint.h - Library for printing to both the serial port and display.
Created by Terence F. Golla, may 29, 2022
Released into the public domain.
*/
#ifndef SerialDisplayPrint_h
#define SerialDisplayPrint_h
#include "Configuration.h"
#include <Arduino.h>
// This contains the low-level code specific to the TFT display.
#if ADAFRUIT_TFT_TOUCH_SHIELD
#include <Adafruit_ILI9341.h>
#endif
class SerialDisplayPrint
{
public:
enum PrintDevice { Neither, SerialOnly, DisplayOnly, Both };
SerialDisplayPrint();
void begin(HardwareSerial &serial);
#if ADAFRUIT_TFT_TOUCH_SHIELD
void begin(HardwareSerial &serial, Adafruit_SPITFT &tft);
#endif
void SetTextSize(int textSize);
void SetTextDisplay();
void print(byte data, PrintDevice device);
void print(short data, PrintDevice device);
void print(int data, PrintDevice device);
void print(unsigned long data, PrintDevice device);
void print(double data, PrintDevice device);
void print(char data, PrintDevice device);
void print(char *data, PrintDevice device);
void println(byte data, PrintDevice device);
void println(short data, PrintDevice device);
void println(int data, PrintDevice device);
void println(unsigned long data, PrintDevice device);
void println(double data, PrintDevice device);
void println(char *data, PrintDevice device);
private:
HardwareSerial *Serial;
#if ADAFRUIT_TFT_TOUCH_SHIELD
Adafruit_SPITFT *TFT;
int currentDisplayLineCursor;
int currentTextSize;
#endif
void AdvanceToNextLineOnDisplay();
};
#endif