コード例 #1
0
def setup():
    pwr = Pin(25, Pin.OUT)
    pwr(1)
    sleep_ms(100)
    # Hardware SPI on native pins for performance. See examples in doc
    # http://docs.micropython.org/en/latest/esp32/quickref.html#hardware-spi-bus
    # Seems to be necessary to explicitly state pin ID's even when using defaults
    spi = SPI(1, 10_000_000, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
    i2c = I2C(0, freq=1_000_000
              )  # As per examples in docs, don't need to specify defaults
    # Alternatives. Note pin 19 conflicts with native I2C(0)
    #spi = SPI(2, 10_000_000, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
    #i2c = I2C(1, scl=Pin(25), sda=Pin(26), freq=1_000_000)
    #i2c = I2C(0, scl=Pin(18), sda=Pin(19), freq=1_000_000)

    lcd = LCD160CR_G(pwr=pwr, spi=spi, i2c=i2c)  # Set connection
    lcd.set_orient(lcd160cr.LANDSCAPE)  # and orientation
    Screen.setup(lcd)
コード例 #2
0
def setup():
    lcd = LCD160CR_G("Y")  # Set connection
    lcd.set_orient(lcd160cr.LANDSCAPE)  # and orientation
    Screen.setup(lcd)