Commit Graph

29 Commits

Author SHA1 Message Date
ZodiusInfuser 95142ffeb5 Fix for display glitch during screen initialisation 2022-02-14 12:57:34 +00:00
Chris Blume 261d2732f0 Improve ST7789 frame rate ~4x
The ST7789's Tscycw (time between serial write clock cycles) is
16 ns. This can be found on page 44 of the datasheet I'm using:
https://www.waveshare.com/w/upload/a/ae/ST7789_Datasheet.pdf

(I do not know which manufacturer Pimoroni products use and if
their parts might be different. But it seems like this wouldn't
change.)

The existing code sets the SPI baud to 16 * 1000 * 1000. But baud
is Hz, not seconds. That 16 * 1000 * 1000 doesn't represent 16 ns.
It represents 16,000,000 Hz.

16 ns * (1 Hz / s) = 62,500,000 Hz.

This commit changes the baud from 16 * 1000 * 1000 to 62'500'000,
representing ~4x speed improvement in SPI and thus ~4x frame rate
improvement, since the display's frame rate is currently
SPI-limited.

A before & after video can be seen here:
https://www.youtube.com/watch?v=n2y19TCnATo

Note that also on page 44 of that datasheet Tscycr (the read speed)
is only 150 ns, not 16 ns. Right now, the Pimoroni code doesn't read
any values back from the ST7789 so it is safe to operate at the
higher speed.

Also note that the 16 * 1000 * 1000 is the requested baud. The actual
baud is the closest the Pico can get, which is 15,625,000.
The new requested baud of 62'500'000 results in an exact match.
2021-11-11 15:36:13 -08:00
Phil Howard 240eab7ccf Tweak 320x240 init to avoid flicker 2021-09-08 13:56:03 +01:00
Phil Howard cfe0f8731e Fix bugs in 320x240 display init 2021-09-08 13:56:03 +01:00
ZodiusInfuser 84a81be9d6 Fixed colour ordering 2021-09-08 13:56:03 +01:00
Phil Howard 9ba3a6cfab 320x240 LCD library + tweaks to ST7789 driver
Add the init required for the 320x240 2.0" LCD.

Add an option to set baudrate, 320x240 needs 74MHz for 60FPS

Add library and example for 320x240 2.0 LCD.
2021-09-08 13:55:57 +01:00
Charlie Birks 47a2f7c1c7
Fix some ST7789 regs
Fixes frame rate/porch register confusion and uses PWCTRL1 instead of 0xd0.
2021-07-20 15:22:31 +01:00
Phil Howard 6022928517 Fix Pico Explorer SPI for #162
The switch to common I2C and common definitions for SPI had broken an edge case in Pico Explorer where no backlight pin is used.

The backlight pin was inadvertently set to the front Breakout Garden SPI slot default, which is pin 20- this also happens to be the I2C SDA pin for Pico Explorer, breaking I2C comms.

This fix adds a new special case board "PICO_EXPLORER_ONBOARD" so that ST7789 can be initialised without the backlight pin.

This will be useful for anyone using ST7789 without the rest of the Pico Explorer library, although it feels a little contrived.

Also switches ST7735 over to the common defines.
2021-06-05 19:06:11 +01:00
Phil Howard 42c7555c96 Add common I2C class
This change adds a common I2C class, gathering various I2C functions into a single point of responsibility.

It's necessary for correctly managing the I2C bus pins and state across multiple devices.
2021-05-14 23:02:38 +01:00
Phil Howard 3dfae2ed5c Add a common header for pins and settings
* Add a common/pimoroni.hpp to list default pins for various add-ons
* Move the BG SPI Slot enum here for safe keeping
* Switch all GPIO pin references to "uint" to match Pico SDK and bring back PIN_UNUSED as UINT_MAX
2021-05-14 21:55:19 +01:00
Phil Howard 356e649308 Extra init for 240x240 ST7789 displays 2021-05-07 13:48:56 +01:00
Phil Howard f843b771ab Fix for ST7789 display flicker 2021-05-07 13:48:56 +01:00
ZodiusInfuser f4a58ec2b2 Changed private to public 2021-05-07 13:48:56 +01:00
ZodiusInfuser c6068c0fec Reordered variables 2021-05-07 13:48:56 +01:00
ZodiusInfuser 84015d7de9 ST7789 tidyup, incl. whitespace removal 2021-05-07 13:48:56 +01:00
ZodiusInfuser 16106d5596 Micropython bindings for ColourLCD and minor tweaks for ST7789, and RoundLCD 2021-05-07 13:48:51 +01:00
Phil Howard b3df1483c1 Add breakout-garden SPI slot selection for ST7789 displays
A new constructor has been added which accepts a enum type BG_SPI_SLOT which can be either:

ST7789::BG_SPI_FRONT or ST7789::BG_SPI_BACK.

This selects the correct CS/BL pins for the respective breakout-garden SPI slot.

Additionally the PWM'd backlight is turned *on* by default to avoid any confusion when the user does not set a value.
2021-04-19 17:22:56 +01:00
Phil Howard 50912e65bf Revert ST7789 backlight for Pico Display 2021-03-31 11:45:54 +01:00
ZodiusInfuser 848aa19c2c Added micropython support and example for roundlcd breakout 2021-03-30 15:15:13 +01:00
Phil Howard f812e23d8e Cleaner RASET, CASET and MADCTL handling 2021-03-29 13:18:31 +01:00
David Tillotson 1993d403e5 Added portrait mode (building with the work from hamid-elaosta:portrait) 2021-03-29 13:18:31 +01:00
David Tillotson 98b633f31f Correct version of the st7789.cpp driver! 2021-03-29 13:18:31 +01:00
David Tillotson 237d59d1d1 Slight efactor of st7789 driver, and addition of the flip function 2021-03-29 13:18:31 +01:00
Phil Howard 8dae215552 Add .cmake files to support out-of-tree projects 2021-01-22 14:03:38 +00:00
ZodiusInfuser 75560ea038 Added outline of an mpy wrapper for pico_display 2021-01-20 15:59:48 +00:00
Jonathan Williamson 96d702ef9a PicoExplorer library and example, basic text support for PicoGraphics 2021-01-17 07:41:25 +00:00
Jonathan Williamson 9f31765c98 Setup libraries and drivers correctly for CMake 2021-01-16 15:02:18 +00:00
Jonathan Williamson 90d3ab8178 pico display driver 2021-01-16 12:26:03 +00:00
Jonathan Williamson cf86122d56 ST7789 driver 2021-01-15 16:12:36 +00:00