Python framebuf.MONO_HLSB Examples
The following are 3
code examples of framebuf.MONO_HLSB().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
framebuf
, or try the search function
.
Example #1
Source File: max7219.py From micropython-max7219 with MIT License | 7 votes |
def __init__(self, spi, cs, num): """ Driver for cascading MAX7219 8x8 LED matrices. >>> import max7219 >>> from machine import Pin, SPI >>> spi = SPI(1) >>> display = max7219.Matrix8x8(spi, Pin('X5'), 4) >>> display.text('1234',0,0,1) >>> display.show() """ self.spi = spi self.cs = cs self.cs.init(cs.OUT, True) self.buffer = bytearray(8 * num) self.num = num fb = framebuf.FrameBuffer(self.buffer, 8 * num, 8, framebuf.MONO_HLSB) 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 # (col) self.pixel = fb.pixel # (x, y[, c]) self.hline = fb.hline # (x, y, w, col) self.vline = fb.vline # (x, y, h, col) self.line = fb.line # (x1, y1, x2, y2, col) self.rect = fb.rect # (x, y, w, h, col) self.fill_rect = fb.fill_rect # (x, y, w, h, col) self.text = fb.text # (string, x, y, col=1) self.scroll = fb.scroll # (dx, dy) self.blit = fb.blit # (fbuf, x, y[, key]) self.init()
Example #2
Source File: writer_minimal.py From micropython-font-to-py with MIT License | 5 votes |
def __init__(self, device, font, verbose=True): self.device = device self.font = font # Allow to work with any font mapping if font.hmap(): self.map = framebuf.MONO_HMSB if font.reverse() else framebuf.MONO_HLSB else: raise ValueError('Font must be horizontally mapped.') if verbose: print('Orientation: {} Reversal: {}'.format('horiz' if font.hmap() else 'vert', font.reverse())) self.screenwidth = device.width # In pixels self.screenheight = device.height
Example #3
Source File: writer.py From micropython-font-to-py with MIT License | 5 votes |
def __init__(self, device, font, verbose=True): self.devid = _get_id(device) self.device = device if self.devid not in Writer.state: Writer.state[self.devid] = DisplayState() self.font = font self.usd = Writer.state[self.devid].usd # Allow to work with reverse or normal font mapping if font.hmap(): self.map = framebuf.MONO_HMSB if font.reverse() else framebuf.MONO_HLSB else: raise ValueError('Font must be horizontally mapped.') if verbose: fstr = 'Orientation: Horizontal. Reversal: {}. Width: {}. Height: {}.' print(fstr.format(font.reverse(), device.width, device.height)) print('Start row = {} col = {}'.format(self._getstate().text_row, self._getstate().text_col)) self.screenwidth = device.width # In pixels self.screenheight = device.height self.bgcolor = 0 # Monochrome background and foreground colors self.fgcolor = 1 self.row_clip = False # Clip or scroll when screen full self.col_clip = False # Clip or new line when row is full self.wrap = True # Word wrap self.cpos = 0 self.tab = 4 self.glyph = None # Current char self.char_height = 0 self.char_width = 0