Exemplo n.º 1
0
    def __init__(self, side='L',*, mode=NORMAL, model=EMBEDDED_ARTISTS, use_flash=False, up_time=None):
        self.flash = None                       # Assume flash is unused
        self.in_context = False
        try:
            intside = {'l':0, 'r':1}[side.lower()]
        except (KeyError, AttributeError):
            raise ValueError("Side must be 'L' or 'R'")
        if model not in (EMBEDDED_ARTISTS, ADAFRUIT):
            raise ValueError('Unsupported model')
        if mode == FAST and use_flash:
            raise ValueError('Flash memory unavailable in fast mode')
        if mode == NORMAL and up_time is not None:
            raise ValueError('Cannot set up_time in normal mode')
        if mode == NORMAL:
            from epd import EPD
            self.epd = EPD(intside, model)
        elif mode == FAST:
            from epdpart import EPD
            self.epd = EPD(intside, model, up_time)
        else:
            raise ValueError('Unsupported mode {}'.format(mode))
        self.mode = mode
        self.font = Font()
        gc.collect()
        self.locate(0, 0)                       # Text cursor: default top left

        self.mounted = False                    # umountflash() not to sync
        if use_flash:
            from flash import FlashClass
            gc.collect()
            self.flash = FlashClass(intside)
            self.umountflash()                  # In case mounted by prior tests.
            self.mountflash()
        gc.collect()
Exemplo n.º 2
0
import machine
import uos
from flash import FlashClass

# pinCS = machine.Pin(machine.Pin.board.PB3, machine.Pin.OUT)

flash_cs = machine.Pin.board.PB3
flash_spi_bus = 3

flash = FlashClass(flash_spi_bus, flash_cs)
uos.mount(flash, '/fs')
#uos.umount('/fs')
# self.flash = FlashClass(intside)
# self.umountflash()  # In case mounted by prior tests.
# self.mountflash()

# import pyb, flash, os
# f = flash.FlashClass(0) # If on right hand side pass 1
# f.low_level_format()
# pyb.mount(f, f.mountpoint, mkfs=True)
# flash.cp('/sd/LiberationSerif-Regular45x44','/fc/')
# os.listdir('/fc')
# pyb.mount(None, '/fc')