-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patholed.h
More file actions
128 lines (89 loc) · 3.76 KB
/
Copy patholed.h
File metadata and controls
128 lines (89 loc) · 3.76 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 16
uint8_t oled_buf[SCREEN_WIDTH * SCREEN_HEIGHT / 8];
const int ANALOG_INPUT_PIN = 37;
const int MIN_ANALOG_INPUT = 0;
const int MAX_ANALOG_INPUT = 1023;
const int DELAY_LOOP_MS = 5; // change to slow down how often to read and graph value
int _circularBuffer[SCREEN_WIDTH]; //fast way to store values
int _curWriteIndex = 0; // tracks where we are in the circular buffer
// for tracking fps
float _fps = 0;
unsigned long _frameCount = 0;
unsigned long _fpsStartTimeStamp = 0;
// status bar
boolean _drawStatusBar = true; // change to show/hide status bar
int _graphHeight = SCREEN_HEIGHT;
Adafruit_SSD1306 display_L(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Adafruit_SSD1306 display_R(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// 'alert', 16x18px
const unsigned char epd_bitmap_alert [] PROGMEM = {
0x01, 0x80, 0x02, 0x40, 0x02, 0x40, 0x04, 0x20, 0x04, 0x20, 0x08, 0x10, 0x19, 0x98, 0x11, 0x88,
0x31, 0x8c, 0x21, 0x84, 0x60, 0x06, 0x41, 0x82, 0xc1, 0x83, 0x81, 0x81, 0x80, 0x01, 0x7f, 0xfe,
0x00, 0x00, 0x00, 0x00
};
// 'sat_signal', 16x16px
const unsigned char epd_bitmap_sat_signal [] PROGMEM = {
0x01, 0xe0, 0x07, 0x00, 0x0c, 0x00, 0x10, 0xe0, 0x23, 0x00, 0x64, 0x00, 0x48, 0xe0, 0xc9, 0x82,
0x93, 0x06, 0x92, 0x0f, 0x92, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00, 0xfe, 0x01, 0xfc, 0x00, 0x78
};
// 'charging', 16x16px
const unsigned char epd_bitmap_charging [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x40, 0x82, 0x51, 0x8a, 0x81, 0x81, 0xa2, 0x85, 0xa4, 0x25,
0xa7, 0x45, 0xa1, 0x45, 0x81, 0x81, 0x53, 0x0a, 0x42, 0x02, 0x20, 0x04, 0x00, 0x00, 0x00, 0x00
};
// 'lightning', 10x16px
const unsigned char epd_bitmap_lightning [] PROGMEM = {
0x04, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7f, 0xc0, 0x7f, 0x80,
0xff, 0x80, 0x0f, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00
};
// 'signal', 16x16px
const unsigned char epd_bitmap_signal [] PROGMEM = {
0x00, 0x00, 0x30, 0x0c, 0x20, 0x04, 0x48, 0x12, 0x50, 0x0b, 0x93, 0xc9, 0xb2, 0x4d, 0xb2, 0x4d,
0x93, 0xc9, 0x91, 0x89, 0x49, 0x92, 0x41, 0x82, 0x21, 0x84, 0x01, 0x80, 0x01, 0x80, 0x00, 0x00
};
// 'clock', 16x16px
const unsigned char epd_bitmap_clock [] PROGMEM = {
0x07, 0xe0, 0x1f, 0xf8, 0x38, 0x1c, 0x61, 0x86, 0x61, 0x86, 0xc1, 0x83, 0xc1, 0x83, 0xc1, 0x83,
0xc1, 0xc3, 0xc0, 0xe3, 0xc0, 0x63, 0x60, 0x06, 0x60, 0x06, 0x38, 0x1c, 0x1f, 0xf8, 0x07, 0xe0
};
bool init_oled(){
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display_L.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
return false;
}
if(!display_R.begin(SSD1306_SWITCHCAPVCC, 0x3D)) {
Serial.println(F("SSD1306 allocation failed"));
return false;
}
return true;
}
void testdrawbitmap_L(const unsigned char* bmp, uint8_t col, uint8_t row,uint8_t logo_width, uint8_t logo_height) {
display_L.drawBitmap(
col,row,
bmp, logo_width, logo_height, 1);
// delay(1000);
}
void oled_clear(){
display_L.clearDisplay();
display_R.clearDisplay();
display_L.setTextColor(SSD1306_WHITE); // Draw white text
display_R.setTextColor(SSD1306_WHITE); // Draw white text
// display_L.setCursor(0,0);
// display_R.setCursor(0,0);
// display_L.setTextSize(1);
// display_R.setTextSize(1);
}
void oled_update(){
display_L.display();
display_R.display();
}