-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrint.cpp
More file actions
48 lines (37 loc) · 1.06 KB
/
Print.cpp
File metadata and controls
48 lines (37 loc) · 1.06 KB
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
/*
* @author:
* @lead: Andrew Horsman
* @other: Mike Noseworthy (Co-Captain)
* @description: Easy class for printing to the driver station or other debug
* methods.
*/
#include "Headers/WPILibrary.h"
class Print {
DriverStationLCD *driverStation;
DriverStationLCD::Line userLines[6];
int currentLine;
public:
Print() {
driverStation = DriverStationLCD::GetInstance();
userLines[0] = DriverStationLCD::kUser_Line1;
userLines[1] = DriverStationLCD::kUser_Line2;
userLines[2] = DriverStationLCD::kUser_Line3;
userLines[3] = DriverStationLCD::kUser_Line4;
userLines[4] = DriverStationLCD::kUser_Line5;
userLines[5] = DriverStationLCD::kUser_Line6;
currentLine = 0;
}
void ClearDisplay() {
currentLine = 0;
driverStation->Clear();
}
void PrintText(char *text) {
driverStation->Printf(userLines[currentLine], 1, text);
driverStation->UpdateLCD();
IncrementCurrentDisplayLine();
}
private:
void IncrementCurrentDisplayLine() {
currentLine = (currentLine == 5) ? 0 : currentLine + 1;
}
};