forked from htotoo/TCarTrackerSim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patholed.h
56 lines (51 loc) · 1.39 KB
/
oled.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
#ifdef usedisplay
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 5
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#endif
void InitDisplay()
{
#ifdef usedisplay
pinMode(34, OUTPUT);
digitalWrite(34, HIGH);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
display.display();
display.clearDisplay();
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("Booting...");
display.display();
#endif
}
void PrintDisplay()
{
#ifdef usedisplay
display.clearDisplay();
display.setCursor(0,0);
display.print("G: ");
display.print(gpsIsValid);
display.print(" #");
display.print(gpsUSat);
display.print(" #");
display.print(battery);
display.setCursor(0,12);
display.print( SWifi::IsConnected() ? "Wifi: OK ": "Wifi: DC " );
display.print( lastMillisModemUsed==0 ? "R: - ": "R: + " );
display.setCursor(0,24);
display.print("LS: ");
display.print(String(lastSuccCode).c_str());
display.print(" LA: ");
display.print(String(AccelLastHitSec()));
display.display();
#endif
}
void DisplayOff()
{
#ifdef usedisplay
display.ssd1306_command(SSD1306_DISPLAYOFF);
digitalWrite(34, LOW);
#endif
}