1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00

Add support for SSD1306 72x40 displays (#4659)

* add SSD1306 72x40

* fix indents

* fix clang style
This commit is contained in:
Dave Johnston
2023-04-12 05:02:29 +01:00
committed by GitHub
parent 5a4840f641
commit a3cacc0c8b
4 changed files with 24 additions and 1 deletions

View File

@@ -53,8 +53,14 @@ void HOT I2CSSD1306::write_display_data() {
}
}
} else {
size_t block_size = 16;
if ((this->get_buffer_length_() & 8) == 8) {
// use smaller block size for e.g. 72x40 displays where buffer size is multiple of 8, not 16
block_size = 8;
}
for (uint32_t i = 0; i < this->get_buffer_length_();) {
uint8_t data[16];
uint8_t data[block_size];
for (uint8_t &j : data)
j = this->buffer_[i++];
this->write_bytes(0x40, data, sizeof(data));