mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00

<!--- Provide a general summary of your changes in the Title above --> ## Description <!--- Describe your changes in detail --> Display support for the following screens: - [Pimoroni GFX Hat](https://shop.pimoroni.com/products/gfx-hat?variant=12828343631955): ui.display.type = "gfxhat" Contrast and Backlight color can be imported from config.toml: ui.display.contrast = 40 ui.display.blcolor = "olive" Available backlight colors: white, grey, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal, aqua - [Adafruit miniPiTFT](https://www.adafruit.com/product/4484): ui.display.type = "minipitft" - [Adafruit miniPiTFT2](https://www.adafruit.com/product/4393): ui.display.type = "minipitft2" - [ArgonPod](https://argon40.com/products/pod-display-2-8inch): ui.display.type = "argonpod" - [DisplayHatMini](https://shop.pimoroni.com/products/display-hat-mini?variant=39496084717651): Driver updated to fix issues - I2C Oled: Default I2C address changed to 0x3C, because most boards are coming with it by default. Can be modified in config ui.display.type = "i2coled" ui.display.i2c_addr = 0x3C ui.display.width = 128 ui.display.height = 64 ## Motivation and Context Future plan for LCD and OLED screens: Change from the pwnagotchis hw libraries for drivers to LumaOLED LumaLCD packages. Luma Core: https://github.com/rm-hull/luma.core Luma LCD: https://github.com/rm-hull/luma.lcd Luma OLED: https://github.com/rm-hull/luma.oled It has the most used LCD and OLED drivers ready, and adding new screens could be easier in the future. ## How Has This Been Tested? Except the argonpod and minipitft2 all screens were tested on previous builds, should work in 2.9.2, but before release I would like to test it with an image. ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [x] I have updated the documentation accordingly. - [x] I've read the [CONTRIBUTION](https://github.com/evilsocket/pwnagotchi/blob/master/CONTRIBUTING.md) guide - [x] I have signed-off my commits with `git commit -s`
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
from . import SSD1306
|
|
|
|
# Display resolution, change if the screen resolution is changed!
|
|
EPD_WIDTH = 128
|
|
EPD_HEIGHT = 64
|
|
|
|
# Available screen resolutions:
|
|
# disp = SSD1306.SSD1306_128_32(128, 32, address=0x3C)
|
|
# disp = SSD1306.SSD1306_96_16(96, 16, address=0x3C)
|
|
# If you change for different resolution, you have to modify the layout in pwnagotchi/ui/hw/i2coled.py
|
|
|
|
class EPD(object):
|
|
|
|
def __init__(self, address=0x3C, width=EPD_WIDTH, height=EPD_HEIGHT):
|
|
self.width = width
|
|
self.height = height
|
|
|
|
# choose subclass based on dimensions
|
|
if height == 32:
|
|
self.disp = SSD1306.SSD1306_128_32(width, height, address)
|
|
elif height == 16:
|
|
self.disp = SSD1306.SSD1306_96_16(width, height, address)
|
|
else:
|
|
self.disp = SSD1306.SSD1306_128_64(width, height, address)
|
|
|
|
def Init(self):
|
|
self.disp.begin()
|
|
|
|
def Clear(self):
|
|
self.disp.clear()
|
|
|
|
def display(self, image):
|
|
self.disp.getbuffer(image)
|
|
self.disp.ShowImage() |