Skip to content

Commit 83025fe

Browse files
committed
Reannotate bargraph.py
1 parent e84574a commit 83025fe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

adafruit_ht16k33/bargraph.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class Bicolor24(HT16K33):
2525
LED_GREEN = 2
2626
LED_YELLOW = 3
2727

28-
def __getitem__(self, key):
28+
def __getitem__(self, key: int) -> int:
2929
# map to HT16K33 row (x) and column (y), see schematic
3030
x = key % 4 + 4 * (key // 12)
3131
y = key // 4 - 3 * (key // 12)
3232
# construct the color value and return it
3333
return self._pixel(x, y) | self._pixel(x + 8, y) << 1
3434

35-
def __setitem__(self, key, value):
35+
def __setitem__(self, key: int, value: int) -> None:
3636
# map to HT16K33 row (x) and column (y), see schematic
3737
x = key % 4 + 4 * (key // 12)
3838
y = key // 4 - 3 * (key // 12)
@@ -41,10 +41,12 @@ def __setitem__(self, key, value):
4141
# conditionally turn on green LED
4242
self._pixel(x + 8, y, value >> 1)
4343

44-
def fill(self, color):
44+
def fill(self, color: int) -> None: # TODO: finish annotation
4545
"""Fill the whole display with the given color.
4646
47-
:param bool color: Whether to fill the display
47+
:param int color: Whether to fill the display, where 0 is no
48+
color, 1 is red, 2 is green, and 3 is yellow (red +
49+
green)
4850
"""
4951

5052
what_it_was = self.auto_write

0 commit comments

Comments
 (0)