コード例 #1
0
ファイル: tbox.py プロジェクト: peterhinch/micropython_ra8875
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
ファイル: tty.py プロジェクト: peterhinch/micropython_ra8875
            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
ファイル: kbd.py プロジェクト: peterhinch/micropython_ra8875
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
ファイル: pt.py プロジェクト: peterhinch/micropython_ra8875
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
ファイル: tty.py プロジェクト: peterhinch/micropython_ra8875
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
ファイル: pt.py プロジェクト: peterhinch/micropython_ra8875
 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
ファイル: pt.py プロジェクト: peterhinch/micropython_ra8875
 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)