def test(): print('''Main screen populates text box slowly to show wrapping in action. "Fast" screen shows fast updates using internal font. "Tab" screen shows use of tab characters with Python font. Text boxes may be scrolled by touching them near the top or bottom.''') setup() Screen.change(BaseScreen)
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)
def fwd(button): Screen.change(cls_screen)
def rbcb(button, screen, clip): # RadioButton callback Screen.change(screen, args=(clip, ))
def back(self, button, text): Aperture.value(text) # Save value for calling screen Screen.back()
def back(self, button, text): Aperture.value(text) Screen.back()
def back(button): Screen.back()
def quit(button): Screen.shutdown()
def _touched(self, x, y): if len(self.elements) > 1: location = self.location[0], self.location[1] + self.height + 1 args = (location, self, self.width - self.height) Screen.change(_ListDialog, args = args)
def callback(self, obj_listbox): if obj_listbox._initial_value is not None: # a touch has occurred val = obj_listbox.textvalue() Screen.back() if self.dropdown is not None: # Part of a Dropdown self.dropdown.value(obj_listbox.value()) # Update it
def test(): print('Test TFT panel...') setup() Screen.change(StartScreen)
def clear(self): tft = Screen.get_tft() self.curves = set() tft.fill_rectangle(self.x0, self.y0, self.x1, self.y1, self.bgcolor) self.show()
def setup(): lcd = LCD160CR_G("Y") # Set connection lcd.set_orient(lcd160cr.LANDSCAPE) # and orientation Screen.setup(lcd)
def test(): print('Test TFT panel...') setup() Screen.set_grey_style(desaturate=False) # dim Screen.change(SliderScreen) # Run it!
def rbcb(button, screen): # RadioButton callback Screen.change(screen)
def pt(): print('Testing plot module...') setup() Screen.change(BaseScreen)
def test(): print('Testing TFT...') setup() Screen.change(BaseScreen)
def fwd(button, screen): Screen.change(screen)
def test(): setup() Screen.change(BaseScreen)
def fwd(button): Screen.change(BackScreen)
def fwd(button): Screen.change(cls_screen, args=args, kwargs=kwargs)