diff --git a/i2c/ssd1306_i2c/ssd1306_i2c.c b/i2c/ssd1306_i2c/ssd1306_i2c.c index 6be5ea42c..cb467cda4 100644 --- a/i2c/ssd1306_i2c/ssd1306_i2c.c +++ b/i2c/ssd1306_i2c/ssd1306_i2c.c @@ -389,14 +389,24 @@ int main() { }; int y = 0; - for (uint i = 0 ;i < count_of(text); i++) { + for (uint i = 0; i < count_of(text); i++) { WriteString(buf, 5, y, text[i]); - y+=8; + y += 8; + // Height limit reached. Show some lines. + if (y == SSD1306_HEIGHT) { + render(buf, &frame_area); + sleep_ms(3000); + memset(buf, 0, SSD1306_BUF_LEN); + y = 0; + } + } + // Check if there's any more text left to display. + if (y != 0) { + render(buf, &frame_area); + sleep_ms(3000); } - render(buf, &frame_area); // Test the display invert function - sleep_ms(3000); SSD1306_send_cmd(SSD1306_SET_INV_DISP); sleep_ms(3000); SSD1306_send_cmd(SSD1306_SET_NORM_DISP);