本文整理匯總了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)