6 namespace ssd1325_base {
8 static const char *
const TAG =
"ssd1325";
10 static const uint8_t SSD1325_MAX_CONTRAST = 127;
11 static const uint8_t SSD1325_COLORMASK = 0x0f;
12 static const uint8_t SSD1325_COLORSHIFT = 4;
13 static const uint8_t SSD1325_PIXELSPERBYTE = 2;
15 static const uint8_t SSD1325_SETCOLADDR = 0x15;
16 static const uint8_t SSD1325_SETROWADDR = 0x75;
17 static const uint8_t SSD1325_SETCONTRAST = 0x81;
18 static const uint8_t SSD1325_SETCURRENT = 0x84;
20 static const uint8_t SSD1325_SETREMAP = 0xA0;
21 static const uint8_t SSD1325_SETSTARTLINE = 0xA1;
22 static const uint8_t SSD1325_SETOFFSET = 0xA2;
23 static const uint8_t SSD1325_NORMALDISPLAY = 0xA4;
24 static const uint8_t SSD1325_DISPLAYALLON = 0xA5;
25 static const uint8_t SSD1325_DISPLAYALLOFF = 0xA6;
26 static const uint8_t SSD1325_INVERTDISPLAY = 0xA7;
27 static const uint8_t SSD1325_SETMULTIPLEX = 0xA8;
28 static const uint8_t SSD1325_MASTERCONFIG = 0xAD;
29 static const uint8_t SSD1325_DISPLAYOFF = 0xAE;
30 static const uint8_t SSD1325_DISPLAYON = 0xAF;
32 static const uint8_t SSD1325_SETPRECHARGECOMPENABLE = 0xB0;
33 static const uint8_t SSD1325_SETPHASELEN = 0xB1;
34 static const uint8_t SSD1325_SETROWPERIOD = 0xB2;
35 static const uint8_t SSD1325_SETCLOCK = 0xB3;
36 static const uint8_t SSD1325_SETPRECHARGECOMP = 0xB4;
37 static const uint8_t SSD1325_SETGRAYTABLE = 0xB8;
38 static const uint8_t SSD1325_SETDEFAULTGRAYTABLE = 0xB9;
39 static const uint8_t SSD1325_SETPRECHARGEVOLTAGE = 0xBC;
40 static const uint8_t SSD1325_SETVCOMLEVEL = 0xBE;
41 static const uint8_t SSD1325_SETVSL = 0xBF;
43 static const uint8_t SSD1325_GFXACCEL = 0x23;
44 static const uint8_t SSD1325_DRAWRECT = 0x24;
45 static const uint8_t SSD1325_COPY = 0x25;
50 this->
command(SSD1325_DISPLAYOFF);
51 this->
command(SSD1325_SETCLOCK);
53 this->
command(SSD1325_SETMULTIPLEX);
59 this->
command(SSD1325_SETOFFSET);
65 this->
command(SSD1325_SETSTARTLINE);
67 this->
command(SSD1325_MASTERCONFIG);
69 this->
command(SSD1325_SETREMAP);
75 this->
command(SSD1325_SETCURRENT + 0x2);
76 this->
command(SSD1325_SETGRAYTABLE);
104 this->
command(SSD1325_SETROWPERIOD);
106 this->
command(SSD1325_SETPHASELEN);
108 this->
command(SSD1325_SETPRECHARGECOMP);
110 this->
command(SSD1325_SETPRECHARGECOMPENABLE);
112 this->
command(SSD1325_SETVCOMLEVEL);
116 this->
command(SSD1325_NORMALDISPLAY);
123 this->
command(SSD1325_SETCOLADDR);
126 this->
command(SSD1325_SETROWADDR);
142 if (brightness > 1) {
144 }
else if (brightness < 0) {
150 this->
command(SSD1325_SETCONTRAST);
155 this->
command(SSD1325_DISPLAYON);
159 this->
command(SSD1325_DISPLAYOFF);
200 uint16_t pos = (x / SSD1325_PIXELSPERBYTE) + (y * this->
get_width_internal() / SSD1325_PIXELSPERBYTE);
201 uint8_t shift = (x % SSD1325_PIXELSPERBYTE) * SSD1325_COLORSHIFT;
203 color4 = (color4 & SSD1325_COLORMASK) << shift;
205 this->
buffer_[pos] &= (~SSD1325_COLORMASK >> shift);
211 uint8_t
fill = (color4 & SSD1325_COLORMASK) | ((color4 & SSD1325_COLORMASK) << SSD1325_COLORSHIFT);
230 return "SSD1325 128x32";
232 return "SSD1325 128x64";
234 return "SSD1325 96x16";
236 return "SSD1325 64x48";
238 return "SSD1327 128x128";
virtual void digital_write(bool value)=0
virtual void command(uint8_t value)=0
size_t get_buffer_length_()
void draw_absolute_pixel_internal(int x, int y, Color color) override
virtual void write_display_data()=0
void fill(Color color) override
void init_internal_(uint32_t buffer_length)
static uint32_t color_to_grayscale4(Color color)
int get_width_internal() override
int get_height_internal() override
const char * model_str_()
Implementation of SPI Controller mode.
void set_brightness(float brightness)
void IRAM_ATTR HOT delay(uint32_t ms)