6namespace ssd1322_base {
8static const char *
const TAG =
"ssd1322";
10static const uint8_t SSD1322_MAX_CONTRAST = 255;
11static const uint8_t SSD1322_COLORMASK = 0x0f;
12static const uint8_t SSD1322_COLORSHIFT = 4;
13static const uint8_t SSD1322_PIXELSPERBYTE = 2;
15static const uint8_t SSD1322_ENABLEGRAYSCALETABLE = 0x00;
16static const uint8_t SSD1322_SETCOLUMNADDRESS = 0x15;
17static const uint8_t SSD1322_WRITERAM = 0x5C;
18static const uint8_t SSD1322_READRAM = 0x5D;
19static const uint8_t SSD1322_SETROWADDRESS = 0x75;
20static const uint8_t SSD1322_SETREMAP = 0xA0;
21static const uint8_t SSD1322_SETSTARTLINE = 0xA1;
22static const uint8_t SSD1322_SETOFFSET = 0xA2;
23static const uint8_t SSD1322_SETMODEALLOFF = 0xA4;
24static const uint8_t SSD1322_SETMODEALLON = 0xA5;
25static const uint8_t SSD1322_SETMODENORMAL = 0xA6;
26static const uint8_t SSD1322_SETMODEINVERTED = 0xA7;
27static const uint8_t SSD1322_ENABLEPARTIALDISPLAY = 0xA8;
28static const uint8_t SSD1322_EXITPARTIALDISPLAY = 0xA9;
29static const uint8_t SSD1322_SETFUNCTIONSELECTION = 0xAB;
30static const uint8_t SSD1322_SETDISPLAYOFF = 0xAE;
31static const uint8_t SSD1322_SETDISPLAYON = 0xAF;
32static const uint8_t SSD1322_SETPHASELENGTH = 0xB1;
33static const uint8_t SSD1322_SETFRONTCLOCKDIVIDER = 0xB3;
34static const uint8_t SSD1322_DISPLAYENHANCEMENTA = 0xB4;
35static const uint8_t SSD1322_SETGPIO = 0xB5;
36static const uint8_t SSD1322_SETSECONDPRECHARGEPERIOD = 0xB6;
37static const uint8_t SSD1322_SETGRAYSCALETABLE = 0xB8;
38static const uint8_t SSD1322_SELECTDEFAULTLINEARGRAYSCALETABLE = 0xB9;
39static const uint8_t SSD1322_SETPRECHARGEVOLTAGE = 0xBB;
40static const uint8_t SSD1322_SETVCOMHVOLTAGE = 0xBE;
41static const uint8_t SSD1322_SETCONTRAST = 0xC1;
42static const uint8_t SSD1322_MASTERCURRENTCONTROL = 0xC7;
43static const uint8_t SSD1322_SETMULTIPLEXRATIO = 0xCA;
44static const uint8_t SSD1322_DISPLAYENHANCEMENTB = 0xD1;
45static const uint8_t SSD1322_SETCOMMANDLOCK = 0xFD;
47static const uint8_t SSD1322_SETCOMMANDLOCK_UNLOCK = 0x12;
48static const uint8_t SSD1322_SETCOMMANDLOCK_LOCK = 0x16;
53 this->
command(SSD1322_SETCOMMANDLOCK);
54 this->
data(SSD1322_SETCOMMANDLOCK_UNLOCK);
56 this->
command(SSD1322_SETFRONTCLOCKDIVIDER);
58 this->
command(SSD1322_SETMULTIPLEXRATIO);
60 this->
command(SSD1322_SETOFFSET);
62 this->
command(SSD1322_SETSTARTLINE);
64 this->
command(SSD1322_SETREMAP);
69 this->
command(SSD1322_SETFUNCTIONSELECTION);
71 this->
command(SSD1322_DISPLAYENHANCEMENTA);
74 this->
command(SSD1322_MASTERCURRENTCONTROL);
76 this->
command(SSD1322_SETPHASELENGTH);
78 this->
command(SSD1322_DISPLAYENHANCEMENTB);
81 this->
command(SSD1322_SETPRECHARGEVOLTAGE);
83 this->
command(SSD1322_SETSECONDPRECHARGEPERIOD);
85 this->
command(SSD1322_SETVCOMHVOLTAGE);
87 this->
command(SSD1322_SETMODENORMAL);
88 this->
command(SSD1322_EXITPARTIALDISPLAY);
90 this->
command(SSD1322_SETGRAYSCALETABLE);
107 this->
command(SSD1322_ENABLEGRAYSCALETABLE);
114 this->
command(SSD1322_SETCOLUMNADDRESS);
117 this->
command(SSD1322_SETROWADDRESS);
120 this->
command(SSD1322_WRITERAM);
131 this->
command(SSD1322_SETCONTRAST);
136 this->
command(SSD1322_SETDISPLAYON);
140 this->
command(SSD1322_SETDISPLAYOFF);
167 uint16_t pos = (
x / SSD1322_PIXELSPERBYTE) + (
y * this->
get_width_internal() / SSD1322_PIXELSPERBYTE);
168 uint8_t shift = (1u - (
x % SSD1322_PIXELSPERBYTE)) * SSD1322_COLORSHIFT;
170 color4 = (color4 & SSD1322_COLORMASK) << shift;
172 this->
buffer_[pos] &= (~SSD1322_COLORMASK >> shift);
178 uint8_t
fill = (color4 & SSD1322_COLORMASK) | ((color4 & SSD1322_COLORMASK) << SSD1322_COLORSHIFT);
197 return "SSD1322 256x64";