kopia lustrzana https://github.com/pimoroni/pimoroni-pico
updated readme's
rodzic
91a2e7f5fb
commit
4f4b0b277c
|
@ -0,0 +1,42 @@
|
|||
# ST7567 Display Driver for Pimoroni LCDs <!-- omit in toc -->
|
||||
|
||||
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)
|
||||
```
|
|
@ -1,6 +1,6 @@
|
|||
# Pico Display 2.0" Pack <!-- omit in toc -->
|
||||
# Pico GFX Pack <!-- omit in toc -->
|
||||
|
||||
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).
|
||||
Pico Display uses the ST7567 display driver to handle the LCD. For more information [read the ST7567 README.](../../drivers/st7789/README.md).
|
Ładowanie…
Reference in New Issue