pimoroni / pimoroni-pico

Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
https://shop.pimoroni.com/collections/pico
MIT License
1.32k stars 499 forks source link

Add Pico Display Pack 2.8 and fix SPI for st7789 on Pico2 #1006

Open peardox opened 1 month ago

peardox commented 1 month ago

This adds libraries/pico_display_28 along with a demo that displays the FPS in examples/pico_display_28

Also updated drivers/st7789 as per #985 / #1005

Full repo build impossible owing to hardware/rtc.h not existing for Pico2 when it hits breakout_encoder_wheel (about to raise issue) so just built and tested pico_display_28

Slion commented 1 month ago

Why do we need a specific example for 2.8? I thought is was exactly the same as the 2 but physically larger.

Does the higher baud rate work on Pico 1?

peardox commented 1 month ago

Why do we need a specific example for 2.8? I thought is was exactly the same as the 2 but physically larger.

It isn't a carbon copy. It changes the text from "Hello World" to one that displays the Frames Per Second which is calculated on every update so has a benefit not present in other demos (as none of them do FPS)

You can also change the code trivially to work on other pico_displays

The baud rate is dependant on the device in modified driver/st7789.hpp

if !PICO_RP2350

static const uint32_t SPI_BAUD = 62'500'000;

else

static const uint32_t SPI_BAUD = 75'000'000;

endif

Slion commented 1 month ago

The baud rate is dependant on the device in modified driver/st7789.hpp

Yeah I saw that I was just wondering if the faster baud rate also works on Pico 1.

peardox commented 1 month ago

Yeah I saw that I was just wondering if the faster baud rate also works on Pico 1.

I most sincerely doubt it (might give it a go tho)

The baud rate is tied to the system clock and those values are 1/2 device clock frequency (Pico 1 should be 66.5 for 1/2 freq - might be worth a try) although the docs say 16us apparently