From 607320c4b6785f483fb1bd7d1c5cacf1fae40a39 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 17 Feb 2022 14:25:51 +0000 Subject: [PATCH] Badger2040: Fix broken display on reset Display configuration wasn't applied properly upon reset. Add additional delay to reset and configure busy_wait pulls. --- drivers/uc8151/uc8151.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/uc8151/uc8151.cpp b/drivers/uc8151/uc8151.cpp index 5323ae96..e01db05b 100644 --- a/drivers/uc8151/uc8151.cpp +++ b/drivers/uc8151/uc8151.cpp @@ -59,8 +59,8 @@ namespace pimoroni { } void UC8151::reset() { - gpio_put(RESET, 0); sleep_ms(1); - gpio_put(RESET, 1); sleep_ms(1); + gpio_put(RESET, 0); sleep_ms(10); + gpio_put(RESET, 1); sleep_ms(10); busy_wait(); } @@ -81,11 +81,13 @@ namespace pimoroni { gpio_set_function(BUSY, GPIO_FUNC_SIO); gpio_set_dir(BUSY, GPIO_IN); - gpio_put(BUSY, 1); + gpio_set_pulls(BUSY, true, false); gpio_set_function(SCK, GPIO_FUNC_SPI); gpio_set_function(MOSI, GPIO_FUNC_SPI); + reset(); + command(PSR, { RES_128x296 | LUT_OTP | FORMAT_BW | SHIFT_RIGHT | BOOSTER_ON | RESET_NONE });