本文整理汇总了Python中framebuf.MONO_VLSB属性的典型用法代码示例。如果您正苦于以下问题:Python framebuf.MONO_VLSB属性的具体用法?Python framebuf.MONO_VLSB怎么用?Python framebuf.MONO_VLSB使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类framebuf
的用法示例。
在下文中一共展示了framebuf.MONO_VLSB属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import framebuf [as 别名]
# 或者: from framebuf import MONO_VLSB [as 别名]
def __init__(self, width, height, external_vcc):
self.width = width
self.height = height
self.external_vcc = external_vcc
self.pages = self.height // 8
self.buffer = bytearray(self.pages * self.width)
fb = framebuf.FrameBuffer(self.buffer, self.width, self.height, framebuf.MONO_VLSB)
self.framebuf = fb
# Provide methods for accessing FrameBuffer graphics primitives. This is a
# workround because inheritance from a native class is currently unsupported.
# http://docs.micropython.org/en/latest/pyboard/library/framebuf.html
self.fill = fb.fill
self.pixel = fb.pixel
self.hline = fb.hline
self.vline = fb.vline
self.line = fb.line
self.rect = fb.rect
self.fill_rect = fb.fill_rect
self.text = fb.text
self.scroll = fb.scroll
self.blit = fb.blit
self.poweron()
self.init_display()
示例2: chars
# 需要导入模块: import framebuf [as 别名]
# 或者: from framebuf import MONO_VLSB [as 别名]
def chars(self, str, x, y):
str_w = self._font.get_width(str)
div, rem = divmod(self._font.height(),8)
nbytes = div+1 if rem else div
buf = bytearray(str_w * nbytes)
pos = 0
for ch in str:
glyph, char_w = self._font.get_ch(ch)
for row in range(nbytes):
index = row*str_w + pos
for i in range(char_w):
buf[index+i] = glyph[nbytes*i+row]
pos += char_w
fb = framebuf.FrameBuffer(buf,str_w, self._font.height(), framebuf.MONO_VLSB)
self.blit(fb,x,y,str_w,self._font.height())
return x+str_w
示例3: __init__
# 需要导入模块: import framebuf [as 别名]
# 或者: from framebuf import MONO_VLSB [as 别名]
def __init__(self, spi, cs, dc, rst=None):
self.spi = spi
self.cs = cs # chip enable, active LOW
self.dc = dc # data HIGH, command LOW
self.rst = rst # reset, active LOW
self.height = HEIGHT # For Writer class
self.width = WIDTH
self.cs.init(self.cs.OUT, value=1)
self.dc.init(self.dc.OUT, value=0)
if self.rst:
self.rst.init(self.rst.OUT, value=1)
self.buf = bytearray((HEIGHT // 8) * WIDTH)
super().__init__(self.buf, WIDTH, HEIGHT, framebuf.MONO_VLSB)
self.reset()
self.init()
示例4: __init__
# 需要导入模块: import framebuf [as 别名]
# 或者: from framebuf import MONO_VLSB [as 别名]
def __init__(self, width, height, external_vcc):
self.width = width
self.height = height
self.external_vcc = external_vcc
self.pages = self.height // 8
self.buffer = bytearray(self.pages * self.width)
super().__init__(self.buffer, self.width, self.height, framebuf.MONO_VLSB)
self.init_display()
示例5: __init__
# 需要导入模块: import framebuf [as 别名]
# 或者: from framebuf import MONO_VLSB [as 别名]
def __init__(self, spi, cs, dc, rst=None):
super().__init__(spi, cs, dc, rst)
self.buf = bytearray((HEIGHT // 8) * WIDTH)
self.fbuf = framebuf.FrameBuffer(self.buf, WIDTH, HEIGHT, framebuf.MONO_VLSB)