From 4f4b0b277c7a5d52f5323430e2c08745138472aa Mon Sep 17 00:00:00 2001 From: Gee Bartlett Date: Mon, 7 Nov 2022 18:07:48 +0000 Subject: [PATCH] updated readme's --- drivers/st7567/README.md | 42 +++++++++++++++++++++++++++++ libraries/gfx_pack/README.md | 52 +++++++++++++++++++----------------- 2 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 drivers/st7567/README.md diff --git a/drivers/st7567/README.md b/drivers/st7567/README.md new file mode 100644 index 00000000..43468b58 --- /dev/null +++ b/drivers/st7567/README.md @@ -0,0 +1,42 @@ +# ST7567 Display Driver for Pimoroni LCDs + +The ST7567 driver supports Serial (SPI) ST7567 displays and is intended for use with: + +* Pico GFX Pack + +## Setup + +Construct an instance of the ST7567 driver with SPI pins. + + +SPI: + +```c++ +ST7567 st7567(WIDTH, HEIGHT, { + PIMORONI_SPI_DEFAULT_INSTANCE, // SPI instance + SPI_BG_FRONT_CS, // Chip-select + SPI_DEFAULT_SCK, // SPI Clock + SPI_DEFAULT_MOSI, // SPI Out + PIN_UNUSED, // SPI In + SPI_DEFAULT_DC, // SPI Data/Command + PIN_UNUSED // Backlight +}); +``` + +## Reference + +### Update + +ST7567's `update` accepts an instance of `PicoGraphics` in 1 bit colour mode: + +```c++ +st7567.update(&graphics); +``` + +### Set Backlight + +If a backlight pin has been configured, you can set the backlight from 0 to 255: + +```c++ +st7567.set_backlight(128) +``` \ No newline at end of file diff --git a/libraries/gfx_pack/README.md b/libraries/gfx_pack/README.md index 53ad9c6d..42d6e533 100644 --- a/libraries/gfx_pack/README.md +++ b/libraries/gfx_pack/README.md @@ -1,6 +1,6 @@ -# Pico Display 2.0" Pack +# Pico GFX Pack -Our Pico Display Pack offers a vibrant 1.14" (240x135) IPS LCD screen for your Raspberry Pi Pico it also includes four switches and and an RGB LED! +Our Pico GFX Pack offers 2.15" (128x64) LCD matrix display for your Raspberry Pi Pico it also includes five switches and an RGBW Backlight! - [Example Program](#example-program) - [Function Reference](#function-reference) @@ -9,44 +9,48 @@ Our Pico Display Pack offers a vibrant 1.14" (240x135) IPS LCD screen for your R ## Example Program -The following example sets up Pico Display, displays some basic demo text and graphics and will illuminate the RGB LED green if the A button is pressed. +The following example sets up Pico Display, displays some basic demo text and graphics and will illuminate the backlight green if the A button is pressed. ```c++ -#include "pico_display_2.hpp" -#include "drivers/st7789/st7789.hpp" +#include "gxf_pack.hpp" +#include "drivers/st7567/st7576.hpp" #include "libraries/pico_graphics/pico_graphics.hpp" #include "rgbled.hpp" #include "button.hpp" // Display driver -ST7789 st7789(PicoDisplay2::WIDTH, PicoDisplay2::HEIGHT, ROTATE_0, false, get_spi_pins(BG_SPI_FRONT)); +ST7567 st7567(128, 64, GfxPack::gfx_pack_pins); + +// Graphics library - in 1 Bit mode you get 16 shades with dithering. +PicoGraphics_Pen1Bit graphics(st7567.width, st7567.height, nullptr); + +// RGB backlight elements +RGBLED backlight_rgb(GfxPack::BL_R, GfxPack::BL_G, GfxPack::BL_B, Polarity::ACTIVE_HIGH); + +// And each button +Button button_a(GfxPack::A); +Button button_b(GfxPack::B); +Button button_c(GfxPack::C); +Button button_d(GfxPack::D); +Button button_e(GfxPack::E); -// Graphics library - in RGB332 mode you get 256 colours and optional dithering for 75K RAM. -PicoGraphics_PenRGB332 graphics(st7789.width, st7789.height, nullptr); // RGB LED RGBLED led(PicoDisplay2::LED_R, PicoDisplay2::LED_G, PicoDisplay2::LED_B); -// And each button -Button button_a(PicoDisplay2::A); -Button button_b(PicoDisplay2::B); -Button button_x(PicoDisplay2::X); -Button button_y(PicoDisplay2::Y); - int main() { // set the backlight to a value between 0 and 255 - // the backlight is driven via PWM and is gamma corrected by our - // library to give a gorgeous linear brightness range. - st7789.set_backlight(100); + // This controls the white elements of the RGBW backlight + st7567.set_backlight(100); while(true) { - // detect if the A button is pressed (could be A, B, X, or Y) + // detect if the A button is pressed (could be A, B, C, D or E) if(button_a.raw(display.A)) { - // make the led glow green + // make the LCD glow green // parameters are red, green, blue all between 0 and 255 // these are also gamma corrected - led.set_rgb(0, 255, 0); + backlight_rgb.set_rgb(0, 255, 0); } // set the colour of the pen @@ -68,7 +72,7 @@ int main() { graphics.text("This is a message", Point(text_rect.x, text_rect.y), text_rect.w); // now we've done our drawing let's update the screen - st7789.update(&graphics); + st7567.update(&graphics); } } ``` @@ -77,8 +81,8 @@ int main() { ### PicoGraphics -Pico Display uses our Pico Graphics library to draw graphics and text. For more information [read the Pico Graphics function reference.](../pico_graphics/README.md#function-reference). +Pico GFX Pack uses our Pico Graphics library to draw graphics and text. For more information [read the Pico Graphics function reference.](../pico_graphics/README.md#function-reference). -### ST7789 +### ST7567 -Pico Display uses the ST7789 display driver to handle the LCD. For more information [read the ST7789 README.](../../drivers/st7789/README.md). \ No newline at end of file +Pico Display uses the ST7567 display driver to handle the LCD. For more information [read the ST7567 README.](../../drivers/st7789/README.md). \ No newline at end of file