RP2 Pico: 'module' object has no attribute 'disp_drv_t'

Hello,
Thanks to you I now have all the tools I need to explore LVGL.

I tested the :
button events
timers
FT6x36 for my display

I still have to find a 7seg font for my countdown and put the values of my ADC (multiplexed) in the textarea.

I’m sharing the code in case it helps anyone.

import time
from machine import SPI, Pin, I2C
import ili9xxx
import fs_driver
import lvgl as lv
from ft6x36 import ft6x36

from lv_utils import event_loop
import sys

lv.init()

import lvgl as lv

compte_a_rebours = None  # Initialiser à None
class CompteARebours:
    def __init__(self, minutes):
        self.temps_debut = time.time()
        self.minutes = minutes

    def get_temps_restant(self):
        temps_ecoule = time.time() - self.temps_debut
        temps_restant = self.minutes * 60 - temps_ecoule
        return time.gmtime(temps_restant) if temps_restant > 0 else time.gmtime(0)

try:
    if not lv.is_initialized():
        print("Init LVGL")
        lv.init()
        print("Init LVGL - DONE")

    print("Init LVGL FS driver")
    fs_drv = lv.fs_drv_t()
    fs_driver.fs_register(fs_drv, 'A', 0)
    print("Init LVGL FS driver - DONE")

    import lv_utils

    if lv_utils.event_loop.is_running():
        print("Deinit lv_utils.event_loop")
        lv_utils.event_loop.current_instance.deinit()
        print("Deinit lv_utils.event_loop - DONE")

    print("Create SPI")
    import machine

    spi = machine.SPI(
        0,
        baudrate=24_000_000,
        sck=machine.Pin(18, machine.Pin.OUT),
        mosi=machine.Pin(19, machine.Pin.OUT)
    )
    print("Create SPI - DONE")

    print("Init Ili9341")
    import ili9xxx

    drv = ili9xxx.Ili9341(rot=1, spi=spi, cs=17, dc=15,
                          rst=14, factor=8, doublebuffer=False)
    print("Init Ili9341 - DONE")

    print("I2C creation")
    touch = ft6x36(scl=13, sda=12, width=240, height=320, swap_xy=True, inv_y=True)
    print("I2C ok")

    print("Show screen")
    # Créer une fenêtre

    win = lv.obj()
    win.set_style_bg_color(lv.color_hex(0xFFA500), 0)  # Change la couleur de fond en orange

    countdown_label = lv.label(win)
    countdown_label.set_text("00h00m00s")
    countdown_label.align(lv.ALIGN.TOP_MID, 0, 20)

    # Créer des boutons
    btn1 = lv.button(win)
    btn1.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
    btn1_label = lv.label(btn1)
    btn1_label.set_text("15 min")

    btn2 = lv.button(win)
    btn2.align(lv.ALIGN.BOTTOM_MID, 0, -5)
    btn2_label = lv.label(btn2)
    btn2_label.set_text("STOP")

    btn3 = lv.button(win)
    btn3.align(lv.ALIGN.BOTTOM_RIGHT, -5, -5)
    btn3_label = lv.label(btn3)
    btn3_label.set_text("120 min")

    adc1 = lv.textarea(win)
    adc1.set_size(60,40)
    adc1.align(lv.ALIGN.LEFT_MID, 0, -22)

    adc2 = lv.textarea(win)
    adc2.set_size(60, 40)
    adc2.align(lv.ALIGN.LEFT_MID, 65, -22)

    adc3 = lv.textarea(win)
    adc3.set_size(60, 40)
    adc3.align(lv.ALIGN.CENTER, 0, -22)

    adc4 = lv.textarea(win)
    adc4.set_size(60, 40)
    adc4.align(lv.ALIGN.RIGHT_MID, -65, -22)

    adc5 = lv.textarea(win)
    adc5.set_size(60, 40)
    adc5.align(lv.ALIGN.RIGHT_MID, 0, -22)

    adc6 = lv.textarea(win)
    adc6.set_size(60, 40)
    adc6.align(lv.ALIGN.LEFT_MID, 0, 22)

    adc7 = lv.textarea(win)
    adc7.set_size(60, 40)
    adc7.align(lv.ALIGN.LEFT_MID, 65, 22)

    adc8 = lv.textarea(win)
    adc8.set_size(60, 40)
    adc8.align(lv.ALIGN.CENTER, 0, 22)

    adc9 = lv.textarea(win)
    adc9.set_size(60, 40)
    adc9.align(lv.ALIGN.RIGHT_MID, -65, 22)

    adc10 = lv.textarea(win)
    adc10.set_size(60, 40)
    adc10.align(lv.ALIGN.RIGHT_MID, 0, 22)

    lv.screen_load(win)
    print("Show screen - DONE")


    def button1_event_cb(event):
        global compte_a_rebours
        print("click 1")
        win.set_style_bg_color(lv.color_hex(0xFF0000), 0)  # Change la couleur de fond en rouge
        compte_a_rebours = CompteARebours(15)

    def button2_event_cb(event):
        global compte_a_rebours
        print("click 2")
        compte_a_rebours = None  # Arrête le compte à rebours
        win.set_style_bg_color(lv.color_hex(0xFFA500), 0)  # Change la couleur de fond en orange
        countdown_label.set_text("************")

    def button3_event_cb(event):
        global compte_a_rebours
        print("click 3")
        compte_a_rebours = CompteARebours(120)
        adc1.add_text("1.28")

    def update_time(t):
        global compte_a_rebours
        if compte_a_rebours is None:  # Si compte_a_rebours est None, ne faites rien
            return
        temps = compte_a_rebours.get_temps_restant()
        countdown_label.set_text(("%02d H %02d M %02d S" % (temps[3], temps[4], temps[5])))

        if temps[3] == 0 and temps[4] == 0 and temps[5] == 0:  # Si le compte à rebours est à 0
            win.set_style_bg_color(lv.color_hex(0x008000), 0)  # Change la couleur de fond en vert


    # Création du timer
    timer = lv.timer_create(update_time, 1000, None)

    btn1.add_event_cb(button1_event_cb, lv.EVENT.CLICKED, None)
    btn2.add_event_cb(button2_event_cb, lv.EVENT.CLICKED, None)
    btn3.add_event_cb(button3_event_cb, lv.EVENT.CLICKED, None)

    while True:
        print("pass")
        time.sleep(3)

except Exception as e:
    print(e)

image

PS : I have another question but I’ll create another topic
Thanks again for your help