6 namespace ssd1331_base {
8 static const char *
const TAG =
"ssd1331";
10 static const uint16_t SSD1331_COLORMASK = 0xffff;
11 static const uint8_t SSD1331_MAX_CONTRASTA = 0x91;
12 static const uint8_t SSD1331_MAX_CONTRASTB = 0x50;
13 static const uint8_t SSD1331_MAX_CONTRASTC = 0x7D;
14 static const uint8_t SSD1331_BYTESPERPIXEL = 2;
16 static const uint8_t SSD1331_DRAWLINE = 0x21;
17 static const uint8_t SSD1331_DRAWRECT = 0x22;
18 static const uint8_t SSD1331_FILL = 0x26;
19 static const uint8_t SSD1331_SETCOLUMN = 0x15;
20 static const uint8_t SSD1331_SETROW = 0x75;
21 static const uint8_t SSD1331_CONTRASTA = 0x81;
22 static const uint8_t SSD1331_CONTRASTB = 0x82;
23 static const uint8_t SSD1331_CONTRASTC = 0x83;
24 static const uint8_t SSD1331_MASTERCURRENT = 0x87;
25 static const uint8_t SSD1331_SETREMAP = 0xA0;
26 static const uint8_t SSD1331_STARTLINE = 0xA1;
27 static const uint8_t SSD1331_DISPLAYOFFSET = 0xA2;
28 static const uint8_t SSD1331_NORMALDISPLAY = 0xA4;
29 static const uint8_t SSD1331_DISPLAYALLON = 0xA5;
30 static const uint8_t SSD1331_DISPLAYALLOFF = 0xA6;
31 static const uint8_t SSD1331_INVERTDISPLAY = 0xA7;
32 static const uint8_t SSD1331_SETMULTIPLEX = 0xA8;
33 static const uint8_t SSD1331_SETMASTER = 0xAD;
34 static const uint8_t SSD1331_DISPLAYOFF = 0xAE;
35 static const uint8_t SSD1331_DISPLAYON = 0xAF;
36 static const uint8_t SSD1331_POWERMODE = 0xB0;
37 static const uint8_t SSD1331_PRECHARGE = 0xB1;
38 static const uint8_t SSD1331_CLOCKDIV = 0xB3;
39 static const uint8_t SSD1331_PRECHARGEA = 0x8A;
40 static const uint8_t SSD1331_PRECHARGEB = 0x8B;
41 static const uint8_t SSD1331_PRECHARGEC = 0x8C;
42 static const uint8_t SSD1331_PRECHARGELEVEL = 0xBB;
43 static const uint8_t SSD1331_VCOMH = 0xBE;
48 this->
command(SSD1331_DISPLAYOFF);
49 this->
command(SSD1331_SETREMAP);
51 this->
command(SSD1331_STARTLINE);
53 this->
command(SSD1331_DISPLAYOFFSET);
55 this->
command(SSD1331_NORMALDISPLAY);
56 this->
command(SSD1331_SETMULTIPLEX);
58 this->
command(SSD1331_SETMASTER);
60 this->
command(SSD1331_POWERMODE);
62 this->
command(SSD1331_PRECHARGE);
64 this->
command(SSD1331_CLOCKDIV);
66 this->
command(SSD1331_PRECHARGEA);
68 this->
command(SSD1331_PRECHARGEB);
70 this->
command(SSD1331_PRECHARGEC);
72 this->
command(SSD1331_PRECHARGELEVEL);
76 this->
command(SSD1331_MASTERCURRENT);
84 this->
command(SSD1331_SETCOLUMN);
100 this->
command(SSD1331_CONTRASTA);
102 this->
command(SSD1331_CONTRASTB);
104 this->
command(SSD1331_CONTRASTC);
109 this->
command(SSD1331_DISPLAYON);
113 this->
command(SSD1331_DISPLAYOFF);
127 this->
buffer_[pos++] = (color565 >> 8) & 0xff;
128 this->
buffer_[pos] = color565 & 0xff;
134 this->
buffer_[i] = color565 & 0xff;
136 this->
buffer_[i] = (color565 >> 8) & 0xff;
void set_brightness(float brightness)
virtual void digital_write(bool value)=0
static uint16_t color_to_565(Color color, ColorOrder color_order=ColorOrder::COLOR_ORDER_RGB)
void draw_absolute_pixel_internal(int x, int y, Color color) override
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
virtual void command(uint8_t value)=0
void init_internal_(uint32_t buffer_length)
virtual void write_display_data()=0
int get_height_internal() override
int get_width_internal() override
Implementation of SPI Controller mode.
void fill(Color color) override
size_t get_buffer_length_()
void IRAM_ATTR HOT delay(uint32_t ms)