finish docs and cmake gfx module

This commit is contained in:
Gee Bartlett 2022-11-04 17:23:30 +00:00
parent 61a80ce66e
commit f3f260e176
3 changed files with 73 additions and 1 deletions

View File

@ -63,6 +63,7 @@ Bear in mind that MicroPython has only 192K of RAM available- a 320x240 pixel di
* 128x128 I2C OLED - `DISPLAY_I2C_OLED_128X128`
* Pico Inky Pack - 296x128 mono e-ink - `DISPLAY_INKY_PACK`
* Inky Frame - 600x447 7-colour e-ink - `DISPLAY_INKY_FRAME`
* Pico GFX Pack - 128x64 mono LCD Matrix - `DISPLAY_GFX_PACK`
### Supported Graphics Modes (Pen Type)

View File

@ -0,0 +1,71 @@
# GFX Pack MicroPython <!-- omit in toc -->
This library offers convenient functions for interacting with [Pico GFX Pack](https://shop.pimoroni.com/products/gfxpack) - The Pico GFX Pack adds a 128x64 LCD Matrix display to your headered Raspberry Pi Pico or PicoW, with RGBW backlight and 5 input buttons for all your display anc control needs.
## Table of Content
- [Table of Content](#table-of-content)
- [GFX Pack Classes](#GFX-Pack-class)
- [Switches](#switches)
- [RGB Backlight](#rgb-backlight)
## GFX Pack Class
The `GfxPack` class deals with RGB backlight and buttons on the GFX Pack. To create one, import the `gfx_pack` module, then define a new `board` variable:
```python
import gfx_pack
board = gfx_pack.GfxPack()
```
### Switches
The GFX Pack has 5 user switchs located just under the display labeled A to E. The names of these switches in the class are:
`.switch_a`
`.switch_b`
`.switch_c`
`.switch_d`
`.switch_e`
These can be read with the `.is_pressed` method.
```python
if (board.switch_a.is_pressed):
print('You pressed Switch A')
if (board.switch_b.is_pressed):
print('You pressed Switch B')
```
### RGB Backlight
The GFX has an RGB backlight as well as the regular Matrix display backlight to change the colour of the backlight. This is accessed via the following method.
`.rgb.set_rgb(r, g, b)`
Where r, g, b are values between 0 and 255
example:
```python
board.rgb.set_rgb(255, 0, 0) # Makes the Backlight Red
board.rgb.set_rgb(0, 255, 0) # Makes the Backlight Blue
board.rgb.set_rgb(0, 0, 255) # Makes the Backlight Green
```

View File

@ -18,7 +18,7 @@ target_link_libraries(usermod INTERFACE usermod_modules_py)
# .py files to copy from modules_py to ports/rp2/modules
#copy_module(usermod_modules_py ${CMAKE_CURRENT_LIST_DIR}/picosystem.py picosystem)
copy_module(usermod_modules_py ${CMAKE_CURRENT_LIST_DIR}/pimoroni.py pimoroni)
copy_module(usermod_modules_py ${CMAKE_CURRENT_LIST_DIR}/gfx_pack.py gfx_pack)
if(PICO_BOARD STREQUAL "pico_w")
copy_module(usermod_modules_py ${CMAKE_CURRENT_LIST_DIR}/automation.py automation)
copy_module(usermod_modules_py ${CMAKE_CURRENT_LIST_DIR}/inventor.py inventor)