Skip to content

Commit

Permalink
Partial update command
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeharker committed Oct 29, 2024
1 parent d4ac2a9 commit a79f1a6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions adafruit_neotrellis/neotrellis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_neotrellis.git"

from time import sleep
from typing import Callable, List, Optional, TypeAlias
from typing import Callable, List, Optional, Sequence, Tuple, TypeAlias

from adafruit_seesaw.keypad import KeyEvent, Keypad, ResponseType
from adafruit_seesaw.neopixel import NeoPixel
from adafruit_seesaw.neopixel import ColorType, NeoPixel
from micropython import const


Expand Down Expand Up @@ -108,6 +108,14 @@ def activate_key(self, key: int, edge: int, enable: bool = True) -> None:
def clear(self) -> None:
self.pixels.fill((0, 0, 0))

def color(self, key: int, color: ColorType):
"""Set the color of the specified key """
self.pixels[key] = color

def update(self, updates: Sequence[Tuple[int, ColorType]]):
"""Set the color of the specified keys """
self.pixels.update(updates)

def show(self) -> None:
self.pixels.show()

Expand Down

0 comments on commit a79f1a6

Please sign in to comment.