6 namespace ssd1327_base {
8 static const char *
const TAG =
"ssd1327";
10 static const uint8_t SSD1327_MAX_CONTRAST = 127;
11 static const uint8_t SSD1327_COLORMASK = 0x0f;
12 static const uint8_t SSD1327_COLORSHIFT = 4;
13 static const uint8_t SSD1327_PIXELSPERBYTE = 2;
15 static const uint8_t SSD1327_SETCOLUMNADDRESS = 0x15;
16 static const uint8_t SSD1327_SETROWADDRESS = 0x75;
17 static const uint8_t SSD1327_SETCONTRAST = 0x81;
18 static const uint8_t SSD1327_SETREMAP = 0xA0;
19 static const uint8_t SSD1327_SETSTARTLINE = 0xA1;
20 static const uint8_t SSD1327_SETOFFSET = 0xA2;
21 static const uint8_t SSD1327_NORMALDISPLAY = 0xA4;
22 static const uint8_t SSD1327_DISPLAYALLON = 0xA5;
23 static const uint8_t SSD1327_DISPLAYALLOFF = 0xA6;
24 static const uint8_t SSD1327_INVERTDISPLAY = 0xA7;
25 static const uint8_t SSD1327_SETMULTIPLEX = 0xA8;
26 static const uint8_t SSD1327_FUNCTIONSELECTIONA = 0xAB;
27 static const uint8_t SSD1327_DISPLAYOFF = 0xAE;
28 static const uint8_t SSD1327_DISPLAYON = 0xAF;
29 static const uint8_t SSD1327_SETPHASELENGTH = 0xB1;
30 static const uint8_t SSD1327_SETFRONTCLOCKDIVIDER = 0xB3;
31 static const uint8_t SSD1327_SETGPIO = 0xB5;
32 static const uint8_t SSD1327_SETSECONDPRECHARGEPERIOD = 0xB6;
33 static const uint8_t SSD1327_SETGRAYSCALETABLE = 0xB8;
34 static const uint8_t SSD1327_SELECTDEFAULTLINEARGRAYSCALETABLE = 0xB9;
35 static const uint8_t SSD1327_SETPRECHARGEVOLTAGE = 0xBC;
36 static const uint8_t SSD1327_SETVCOMHVOLTAGE = 0xBE;
37 static const uint8_t SSD1327_FUNCTIONSELECTIONB = 0xD5;
38 static const uint8_t SSD1327_SETCOMMANDLOCK = 0xFD;
39 static const uint8_t SSD1327_HORIZONTALSCROLLRIGHTSETUP = 0x26;
40 static const uint8_t SSD1327_HORIZONTALSCROLLLEFTSETUP = 0x27;
41 static const uint8_t SSD1327_DEACTIVATESCROLL = 0x2E;
42 static const uint8_t SSD1327_ACTIVATESCROLL = 0x2F;
48 this->
command(SSD1327_SETFRONTCLOCKDIVIDER);
50 this->
command(SSD1327_SETMULTIPLEX);
52 this->
command(SSD1327_SETOFFSET);
54 this->
command(SSD1327_SETSTARTLINE);
56 this->
command(SSD1327_SETREMAP);
58 this->
command(SSD1327_SETGRAYSCALETABLE);
75 this->
command(SSD1327_SETPHASELENGTH);
77 this->
command(SSD1327_SETVCOMHVOLTAGE);
81 this->
command(SSD1327_NORMALDISPLAY);
88 this->
command(SSD1327_SETCOLUMNADDRESS);
91 this->
command(SSD1327_SETROWADDRESS);
107 this->
command(SSD1327_SETCONTRAST);
112 this->
command(SSD1327_DISPLAYON);
116 this->
command(SSD1327_DISPLAYOFF);
143 uint16_t pos = (x / SSD1327_PIXELSPERBYTE) + (y * this->
get_width_internal() / SSD1327_PIXELSPERBYTE);
144 uint8_t shift = (x % SSD1327_PIXELSPERBYTE) * SSD1327_COLORSHIFT;
146 color4 = (color4 & SSD1327_COLORMASK) << shift;
148 this->
buffer_[pos] &= (~SSD1327_COLORMASK >> shift);
154 uint8_t
fill = (color4 & SSD1327_COLORMASK) | ((color4 & SSD1327_COLORMASK) << SSD1327_COLORSHIFT);
173 return "SSD1327 128x128";
virtual void digital_write(bool value)=0
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)
void set_brightness(float brightness)
void init_internal_(uint32_t buffer_length)
static uint32_t color_to_grayscale4(Color color)
size_t get_buffer_length_()
virtual void write_display_data()=0
virtual void command(uint8_t value)=0
int get_height_internal() override
void fill(Color color) override
Implementation of SPI Controller mode.
const char * model_str_()
int get_width_internal() override
void IRAM_ATTR HOT delay(uint32_t ms)