Merge pull request #276 from dipsylala/master
Inkyphat subclass to incorporate timing changes.
This commit is contained in:
commit
f8a28d375b
@ -136,9 +136,9 @@ class Display(View):
|
||||
def _init_display(self):
|
||||
if self.is_inky():
|
||||
logging.info("initializing inky display")
|
||||
from inky import InkyPHAT
|
||||
self._display = InkyPHAT(self._display_color)
|
||||
self._display.set_border(InkyPHAT.BLACK)
|
||||
from pwnagotchi.ui.inkyphat.inkyphatfast import InkyPHATFast
|
||||
self._display = InkyPHATFast(self._display_color)
|
||||
self._display.set_border(InkyPHATFast.BLACK)
|
||||
self._render_cb = self._inky_render
|
||||
|
||||
elif self.is_papirus():
|
||||
|
0
pwnagotchi/ui/inkyphat/__init__.py
Normal file
0
pwnagotchi/ui/inkyphat/__init__.py
Normal file
24
pwnagotchi/ui/inkyphat/inkyfast.py
Normal file
24
pwnagotchi/ui/inkyphat/inkyfast.py
Normal file
@ -0,0 +1,24 @@
|
||||
from inky.inky import Inky, CS0_PIN, DC_PIN, RESET_PIN, BUSY_PIN
|
||||
|
||||
|
||||
class InkyFast(Inky):
|
||||
|
||||
def __init__(self, resolution=(400, 300), colour='black', cs_pin=CS0_PIN, dc_pin=DC_PIN, reset_pin=RESET_PIN,
|
||||
busy_pin=BUSY_PIN, h_flip=False, v_flip=False):
|
||||
super(InkyFast, self).__init__(resolution, colour, cs_pin, dc_pin, reset_pin, busy_pin, h_flip, v_flip)
|
||||
|
||||
self._luts['black'] = [
|
||||
0b01001000, 0b10100000, 0b00010000, 0b00010000, 0b00010011, 0b00000000, 0b00000000,
|
||||
0b01001000, 0b10100000, 0b10000000, 0b00000000, 0b00000011, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b01001000, 0b10100101, 0b00000000, 0b10111011, 0b00000000, 0b00000000, 0b00000000,
|
||||
0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||
# The following timings have been reduced to avoid the fade to black
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x04, 0x04, 0x04, 0x04,
|
||||
0x04, 0x08, 0x08, 0x10, 0x10,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
]
|
27
pwnagotchi/ui/inkyphat/inkyphatfast.py
Normal file
27
pwnagotchi/ui/inkyphat/inkyphatfast.py
Normal file
@ -0,0 +1,27 @@
|
||||
"""Inky pHAT e-Ink Display Driver."""
|
||||
from . import inkyfast
|
||||
|
||||
|
||||
class InkyPHATFast(inkyfast.InkyFast):
|
||||
"""Inky wHAT e-Ink Display Driver."""
|
||||
|
||||
WIDTH = 212
|
||||
HEIGHT = 104
|
||||
|
||||
WHITE = 0
|
||||
BLACK = 1
|
||||
RED = 2
|
||||
YELLOW = 2
|
||||
|
||||
def __init__(self, colour):
|
||||
"""Initialise an Inky pHAT Display.
|
||||
|
||||
:param colour: one of red, black or yellow, default: black
|
||||
|
||||
"""
|
||||
inkyfast.InkyFast.__init__(
|
||||
self,
|
||||
resolution=(self.WIDTH, self.HEIGHT),
|
||||
colour=colour,
|
||||
h_flip=False,
|
||||
v_flip=False)
|
Loading…
x
Reference in New Issue
Block a user