Pico Display would have a pixel offset at 90 and 180 degree rotations.
Add a special case offset tweak for these, and demystify the rotate_180 variable.
* Absorb ST7735 support into the generic ST7789 driver and rename to PicoGraphics
* Delete obsolete MicroPython modules
* Refactor PicoGraphics to inherited class for each pen type
* Refactor ST7789 and ST7735 to derive from DisplayDriver
* Allow user to set pen_type in MicroPython constructor for RGB565, RGB332, P8 and P4 modes
* Make ST7789 accept only full config with SPI pins
* Make Generic ST7789 wrapper library handle "slot"
* Update Round LCD and 240x240 Square LCD
* Remove Python Round LCD and 240x240 LCD modules (we need the space!)
* Remove C++ Round LCD and 240x240 LCD libraries (they're a little redundant!)
* Fix garbage collected framebuffer bug in Python ST7789
* Deprecate "flip" in favour of "configure_display"
* Tidy up ST7789, remove dead/unused/commented code
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.
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.
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.
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.
* 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
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.