예제 #1
0
def test():
    print('''Main screen populates text boxes slowly to show
    clipping and 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(TScreen)
예제 #2
0
def setup(driver_test=False, use_async=True):
    # Option for Pyboard D. See below.
    # freq(216_000_000)
    pinrst = Pin(_RESET, Pin.OUT, value=1)
    pincs = Pin(_CS, Pin.OUT, value=1)
    spi = SPI(_SPI, baudrate=6_000_000)  # Max that is reliable
    if driver_test:
        from micropython_ra8875.driver.ra8875 import RA8875
        return RA8875(spi, pincs, pinrst, _WIDTH, _HEIGHT, use_async)

    from micropython_ra8875.py.ugui import Screen
    from micropython_ra8875.driver.tft import TFT
    tft = TFT(spi, pincs, pinrst, _WIDTH, _HEIGHT, _TOUCH_DELAY, True)
    # Touch panel calibration values xmin, ymin, xmax, ymax
    # See docs for calibration procedure
    tft.calibrate(25, 25, 459, 243)  # *** To be updated by cal.py ***
    Screen.setup(tft, tft)
예제 #3
0
            await sr.readexactly(3)  # discard VT100
            process_char('Bs', tb)
            continue
        else:
            await asyncio.sleep_ms(10)
            n = uart.any()
            if n:  # rapid input: assume programmatic
                s = await sr.readexactly(n)
                s = s.decode().replace('\r','')
                #for char in s:
                    #print('s:', char, hex(ord(char)))
                tb.append(''.join((ch, s)), ntrim = NLINES)  # TODO splits line on tab expansion because tb.append puts on new line
            else:
                process_char(ch, tb)


class KBD(Screen):
    def __init__(self):
        super().__init__()
        uart = UART(1, 115200, read_buf_len=256)
        sreader = asyncio.StreamReader(uart)
        quitbutton()
        tb = tbox(0, 280)  # Create textbox
        keys = make_keys(uart)  # Create normal keys
        ctrl(uart, keys)  # Create control keys
        self.reg_task(handle_input(uart, sreader, tb))

print('Test TFT panel...')
setup()  # Initialise GUI (see tft_local.py)
Screen.change(KBD)       # Run it!
예제 #4
0
def test():
    print('Test TFT panel...')
    setup()  # Initialise GUI (see tft_local.py)
    Screen.change(KBD)       # Run it!
예제 #5
0
def test():
    print('Test TFT panel...')
    setup()
    Screen.set_grey_style(desaturate = False) # dim
    Screen.change(SliderScreen)       # Run it!
예제 #6
0
 def fwd(button):
     Screen.change(cls_screen)
예제 #7
0
 def quit(button):
     Screen.shutdown()
예제 #8
0
 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
예제 #9
0
def pt():
    print('Testing plot module...')
    setup()
    Screen.change(BaseScreen)
예제 #10
0
def test():
    print('Test TFT panel...')
    setup()
    Screen.change(KnobScreen)
예제 #11
0
 def cb_style(self, button, desaturate):
     self.lbl_style.value(''.join(
         ('Current style: ', 'grey' if desaturate else 'dim')))
     Screen.set_grey_style(desaturate=desaturate)
예제 #12
0
 def quit(self, button):
     Screen.shutdown()
예제 #13
0
def test():
    print('Testing TFT...')
    setup()
    Screen.change(ButtonScreen)
예제 #14
0
def test():
    setup()
    Screen.change(ChoiceScreen)
예제 #15
0
def quitbutton():
    Button((719, 449), font = font14, height = 30, width = 80, shape = RECTANGLE,
           fgcolor = RED, text = 'Quit', callback = lambda _ : Screen.shutdown())
예제 #16
0
 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)
예제 #17
0
 def fwd(button, screen):
     Screen.change(screen)
예제 #18
0
def test():
    print('Test TFT panel...')
    setup()  # Initialise GUI (see tft_local.py)
    Screen.set_grey_style(desaturate=False)  # dim
    Screen.change(VerticalSliderScreen)  # Run it!
예제 #19
0
 def fwd(button):
     Screen.change(BackScreen)
예제 #20
0
 def back(button):
     for task in self.tasks:
         task.cancel()
     self.tasks = []
     Screen.back()
예제 #21
0
 def back(self, button, text):
     Aperture.value(text)
     Screen.back()
예제 #22
0
def test():
    print('Test TFT panel...')
    setup()
    Screen.change(BaseScreen)  # Run it!
예제 #23
0
def test():
    setup()
    Screen.change(BaseScreen)
예제 #24
0
 def back(button):
     Screen.back()
예제 #25
0
 def fwd(button):
     Screen.change(cls_screen, args=args, kwargs=kwargs)