コード例 #1
0
    def __init__(self, i2c, w, h, cycle=1000, irq_pin=33):
        self.cycle = cycle
        self.last_time = 0
        self.points = [(0, 0, 0), (0, 0, 0)]
        self.state = Touch.idle
        self.width, self.height = w, h

        # touch dirver init
        if i2c == None:
            i2c = I2C(I2C.I2C3, freq=100*1000, scl=24, sda=27)  # amigo
        TouchLow.config(i2c=i2c)

        # 按压检测(中断)
        self.events = []
        setattr(self, "press_check_", self.press_check)
        fm.register(irq_pin, fm.fpioa.GPIOHS28, force=True)
        key = GPIO(GPIO.GPIOHS28, GPIO.IN, GPIO.PULL_DOWN)
        key.irq(self.press_check_, GPIO.IRQ_FALLING, GPIO.WAKEUP_NOT_SUPPORT, 7)

        # 添加松手检测(轮询)
        system.event(20, self.release_check)
コード例 #2
0
ファイル: ui_container.py プロジェクト: denise-amiga/MaixUI
 def load():
     Launcher.h, Launcher.w = 20, 20
     system.event(2000, switch_Loading)
コード例 #3
0
ファイル: ui_container.py プロジェクト: denise-amiga/MaixUI
 def load():
     Loading.h, Loading.w = 20, 20
     #system.remove(Loading.event)
     system.event(2000, switch_Launcher)
コード例 #4
0
 def __init__(self):
     self.loop = 0
     ui.set_bg_img(self.create_bg_img())
     setattr(self, "draw_anim", self.draw_anim_)
     system.event(0, self.draw_anim)
コード例 #5
0
if __name__ == '__main__':
    try:
        from touch import Touch
        from core import system
    except:
        from driver.touch import Touch
        from lib.core import system
    import time

    # init canvas
    img = image.Image("res/images/bg.jpg")
    ui.set_bg_img(img)

    # create button
    lab = TextEdit()
    lab.set_bg_color(None)
    lab.set_border((255, 255, 255), 2)
    lab.set_text(
        "MaixPy is to port Micropython to K210 (a 64-bit dual-core RISC-V CPU with hardware FPU, convolution accelerator, FFT, Sha256) is a project that supports the normal operation of the MCU and integrates hardware acceleration. AI machine vision and microphone array, 1TOPS computing power core module is less than ¥50, in order to quickly develop intelligent applications in the field of AIOT with extremely low cost and practical size.",
        scale=2,
        lspacing=4)
    lab.set_pos_size(10, 10, 180, 180)

    system.event(0, ui.display)
    clock = time.clock()
    while True:
        clock.tick()
        system.parallel_cycle()
        print(clock.fps())
コード例 #6
0
ファイル: ui_animation.py プロジェクト: vamoosebbf/MaixUI
 def start(self):
     system.event(0, self.running)
コード例 #7
0
if __name__ == '__main__':

    import time
    from ui_label import Label
    ui.set_bg_color((75, 0, 75))
    ui.set_bg_img("res/images/bg.jpg")
    # create button
    bar = Slider(20, 30, 30, 400, 3)
    bar.set_bg_color((255, 255, 255))

    bar.set_value(100)

    lab = Label(400, 60, 30, 30)

    clock = time.clock()
    system.event(1, ui.display)
    val = 1
    dir = True
    while True:
        clock.tick()
        if dir:
            val += 1
        else:
            val -= 1
        if val == 100:
            dir = False
        if val == 0:
            dir = True
        bar.set_value(val)
        lab.set_text(str(bar.__current) + "%")
        system.parallel_cycle()