1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-27 05:03:48 +00:00

Add proper support for SH1107 to SSD1306 component (#5166)

This commit is contained in:
Nikita Kuklev
2023-11-16 02:06:03 -06:00
committed by GitHub
parent 754bd5b7be
commit fefdb80fdc
5 changed files with 95 additions and 39 deletions

View File

@@ -38,13 +38,19 @@ void I2CSSD1306::dump_config() {
}
void I2CSSD1306::command(uint8_t value) { this->write_byte(0x00, value); }
void HOT I2CSSD1306::write_display_data() {
if (this->is_sh1106_()) {
if (this->is_sh1106_() || this->is_sh1107_()) {
uint32_t i = 0;
for (uint8_t page = 0; page < (uint8_t) this->get_height_internal() / 8; page++) {
this->command(0xB0 + page); // row
this->command(0x02); // lower column
this->command(0x10); // higher column
if (this->is_sh1106_()) {
this->command(0x02); // lower column - 0x02 is historical SH1106 value
} else {
// Other SH1107 drivers use 0x00
// Column values dont change and it seems they can be set only once,
// but we follow SH1106 implementation and resend them
this->command(0x00);
}
this->command(0x10); // higher column
for (uint8_t x = 0; x < (uint8_t) this->get_width_internal() / 16; x++) {
uint8_t data[16];
for (uint8_t &j : data)