File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change 23
23
SET_VCOM_DESEL = const (0xdb )
24
24
SET_CHARGE_PUMP = const (0x8d )
25
25
26
-
27
- class SSD1306 :
26
+ # Subclassing FrameBuffer provides support for graphics primitives
27
+ # http://docs.micropython.org/en/latest/pyboard/library/framebuf.html
28
+ class SSD1306 (framebuf .FrameBuffer ):
28
29
def __init__ (self , width , height , external_vcc ):
29
30
self .width = width
30
31
self .height = height
31
32
self .external_vcc = external_vcc
32
33
self .pages = self .height // 8
33
34
self .buffer = bytearray (self .pages * self .width )
34
- fb = framebuf .FrameBuffer (self .buffer , self .width , self .height , framebuf .MONO_VLSB )
35
- self .framebuf = fb
36
- # Provide methods for accessing FrameBuffer graphics primitives. This is a
37
- # workround because inheritance from a native class is currently unsupported.
38
- # http://docs.micropython.org/en/latest/pyboard/library/framebuf.html
39
- self .fill = fb .fill
40
- self .pixel = fb .pixel
41
- self .hline = fb .hline
42
- self .vline = fb .vline
43
- self .line = fb .line
44
- self .rect = fb .rect
45
- self .fill_rect = fb .fill_rect
46
- self .text = fb .text
47
- self .scroll = fb .scroll
48
- self .blit = fb .blit
35
+ super .__init__ (self .buffer , self .width , self .height , framebuf .MONO_VLSB )
49
36
self .init_display ()
50
37
51
38
def init_display (self ):
You can’t perform that action at this time.
0 commit comments