-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSSD1327_WS.h
51 lines (37 loc) · 1.34 KB
/
SSD1327_WS.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
#ifndef SSD1327_WS_H
#define SSD1327_WS_H
#include <Arduino.h>
#define OLED_CMD_MODE 0x00 // DC bit is logic 0 -> subsequent bytes are interpreted as commands
#define OLED_DATA_MODE 0x40 // DC bit is logic 1 -> subsequent bytes are written to GDDRAM
// I2C Waveshare 1.5 inch OLED display on SDD1327
class SSD1327_WS_OLED{
public:
SSD1327_WS_OLED();
SSD1327_WS_OLED(byte i2cAddr);
SSD1327_WS_OLED(byte i2cAddr, byte width, byte height);
void begin();
void clear();
void normalMode();
void inverseMode();
void sleepMode();
void turnOn();
void setContrast(byte contrastValue);
int print(char strToPrint[], int length, bool invert = false);
bool printChar(char character, bool invert = false);
bool isPageEnd() const;
void home();
void setCursor(byte x, byte y);
void setWorkingArea(byte startX, byte startY, byte endX, byte endY);
private:
byte m_i2cAddr, m_width, m_height;
byte m_cursorX, m_cursorY;
void _initDisplay();
void _printChar(char character, byte x, byte y, bool invert = false);
void _printCharBufferChunk(byte row[4], byte x, byte y);
void _i2cWrite(byte *pData, int length);
void _i2cWriteDataBlock(byte *pData, int length);
void _i2cWriteByteCommand(byte cmd);
void _i2cWriteDoubleByteCommand(byte cmd, byte arg1);
void _i2cWriteTripleByteCommand(byte cmd, byte arg1, byte arg2);
};
#endif