Skip to content

Commit

Permalink
Merge 1383b6d into d96333a
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-warren committed Nov 19, 2020
2 parents d96333a + 1383b6d commit 92f352a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions examples/7color/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

for color in range(7):
print("Color: {}".format(colors[color]))
for y in range(inky.height - 1):
for x in range(inky.width - 1):
for y in range(inky.height):
for x in range(inky.width):
inky.set_pixel(x, y, color)
inky.set_border(color)
inky.show()
time.sleep(5.0)
9 changes: 5 additions & 4 deletions library/inky/inky_uc8159.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def __init__(self, resolution=(600, 448), colour='multi', cs_pin=CS0_PIN, dc_pin

self.resolution = resolution
self.width, self.height = resolution
self.border_colour = BLACK
self.cols, self.rows, self.rotation, self.offset_x, self.offset_y = _RESOLUTION[resolution]

if colour not in ('multi'):
Expand Down Expand Up @@ -159,8 +160,6 @@ def __init__(self, resolution=(600, 448), colour='multi', cs_pin=CS0_PIN, dc_pin

self.buf = numpy.zeros((self.rows, self.cols), dtype=numpy.uint8)

self.border_colour = 0

self.dc_pin = dc_pin
self.reset_pin = reset_pin
self.busy_pin = busy_pin
Expand Down Expand Up @@ -280,7 +279,8 @@ def setup(self):
# 0b11100000 = Vborder control (0b001 = LUTB voltage)
# 0b00010000 = Data polarity
# 0b00001111 = Vcom and data interval (0b0111 = 10, default)
self._send_command(UC8159_CDI, [0x37]) # 0b00110111
cdi = (self.border_colour << 5) | 0x17
self._send_command(UC8159_CDI, [cdi]) # 0b00110111

# Gate/Source non-overlap period
# 0b11110000 = Source to Gate (0b0010 = 12nS, default)
Expand Down Expand Up @@ -366,7 +366,8 @@ def show(self, busy_wait=True):

def set_border(self, colour):
"""Set the border colour."""
raise NotImplementedError
if colour in (BLACK, WHITE, GREEN, BLUE, RED, YELLOW, ORANGE, CLEAN):
self.border_colour = colour

def set_image(self, image, saturation=0.5):
"""Copy an image to the display.
Expand Down

0 comments on commit 92f352a

Please sign in to comment.