38
38
"""
39
39
40
40
# imports
41
+ try :
42
+ from circuitpython_typing .led import FillBasedColorUnion
43
+ except ImportError :
44
+ pass
41
45
42
- from micropython import const
43
46
import adafruit_framebuf
44
47
from adafruit_led_animation .grid import PixelGrid
48
+ from micropython import const
45
49
46
50
__version__ = "0.0.0+auto.0"
47
51
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Pixel_Framebuf.git"
48
52
49
- HORIZONTAL = const (1 )
50
- VERTICAL = const (2 )
53
+ HORIZONTAL : int = const (1 )
54
+ VERTICAL : int = const (2 )
55
+
51
56
52
57
# pylint: disable=too-many-function-args
53
58
class PixelFramebuffer (adafruit_framebuf .FrameBuffer ):
@@ -59,6 +64,7 @@ class PixelFramebuffer(adafruit_framebuf.FrameBuffer):
59
64
:param width: Framebuffer width.
60
65
:param height: Framebuffer height.
61
66
:param orientation: Orientation of the strip pixels - HORIZONTAL (default) or VERTICAL.
67
+ HORIZONTAL and VERTICAL are primitive integers created by micropython.const(x).
62
68
:param alternating: Whether the strip alternates direction from row to row (default True).
63
69
:param reverse_x: Whether the strip X origin is on the right side (default False).
64
70
:param reverse_y: Whether the strip Y origin is on the bottom (default False).
@@ -68,19 +74,20 @@ class PixelFramebuffer(adafruit_framebuf.FrameBuffer):
68
74
69
75
"""
70
76
77
+ # pylint: disable=too-many-arguments
71
78
def __init__ (
72
79
self ,
73
- pixels ,
74
- width ,
75
- height ,
76
- orientation = HORIZONTAL ,
77
- alternating = True ,
78
- reverse_x = False ,
79
- reverse_y = False ,
80
- top = 0 ,
81
- bottom = 0 ,
82
- rotation = 0 ,
83
- ): # pylint: disable=too-many-arguments
80
+ pixels : FillBasedColorUnion ,
81
+ width : int ,
82
+ height : int ,
83
+ orientation : int = HORIZONTAL ,
84
+ alternating : bool = True ,
85
+ reverse_x : bool = False ,
86
+ reverse_y : bool = False ,
87
+ top : int = 0 ,
88
+ bottom : int = 0 ,
89
+ rotation : int = 0 ,
90
+ ) -> None :
84
91
self ._width = width
85
92
self ._height = height
86
93
@@ -103,11 +110,11 @@ def __init__(
103
110
)
104
111
self .rotation = rotation
105
112
106
- def blit (self ):
113
+ def blit (self ) -> None :
107
114
"""blit is not yet implemented"""
108
115
raise NotImplementedError ()
109
116
110
- def display (self ):
117
+ def display (self ) -> None :
111
118
"""Copy the raw buffer changes to the grid and show"""
112
119
for _y in range (self ._height ):
113
120
for _x in range (self ._width ):
0 commit comments