Skip to content

Commit c127c63

Browse files
committed
st7789: Avoid static flash on LCD init.
1 parent 0a66e43 commit c127c63

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drivers/st7789/st7789.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ namespace pimoroni {
112112

113113
command(reg::INVON); // set inversion mode
114114
command(reg::SLPOUT); // leave sleep mode
115-
command(reg::DISPON); // turn display on
116-
117-
sleep_ms(100);
118115

119116
configure_display(rotation);
120117

@@ -314,6 +311,12 @@ namespace pimoroni {
314311

315312
gpio_put(cs, 1);
316313
}
314+
315+
if(!display_on) {
316+
command(reg::DISPON); // turn display on
317+
sleep_ms(100);
318+
display_on = true;
319+
}
317320
}
318321

319322
void ST7789::set_backlight(uint8_t brightness) {

drivers/st7789/st7789.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace pimoroni {
4343
PIO parallel_pio;
4444
uint parallel_offset;
4545
uint st_dma;
46+
bool display_on = false;
4647

4748

4849
// The ST7789 requires 16 ns between SPI rising edges.

0 commit comments

Comments
 (0)