🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Dial TFT_eSPI pinout

    Scheduled Pinned Locked Moved SOFTWARE
    17 Posts 5 Posters 15.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • felmueF Offline
      felmue
      last edited by

      Hello @gordsh

      re TFT_eSPI : try adding the following define in Setup200_GC9A01.h

      #define TFT_BACKLIGHT_ON HIGH
      

      re GC9A01_demo : please find an M5Dial version here.

      Thanks
      Felix

      GPIO translation table M5Stack / M5Core2
      Information about various M5Stack products.
      Code examples

      1 Reply Last reply Reply Quote 0
      • gordshG Offline
        gordsh
        last edited by

        @felmue, thanks very much, This worked perfectly.

        M 1 Reply Last reply Reply Quote 0
        • M Offline
          mukul_100_ @gordsh
          last edited by

          @gordsh Hi ,
          did you get this working ?
          I am banging my head against the wall with this one right now ,
          I am trying to use EEZ Studio with M5dial and using platform.io (or arduino ide whichever works)

          also if you have the file of user_setup.h for GC9A01. kindly share
          Thank You

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            mukul_100_ @mukul_100_
            last edited by

            @mukul_100_ Got this workking by using m5unified instead of tft_espi
            But i can get the touch to work
            as per what i read lvgl uses polling to get the touch coordinates using lv_timer_handler();

            but i dont understand how to implement M5Dial.Touch.getDetail(); to get the touch

            gordshG 2 Replies Last reply Reply Quote 0
            • gordshG Offline
              gordsh @mukul_100_
              last edited by

              @mukul_100_ I did get this working, I am having a different issue now but I will send you a small demo program that I wrote using LVGL with touch.

              1 Reply Last reply Reply Quote 0
              • gordshG Offline
                gordsh @mukul_100_
                last edited by gordsh

                @mukul_100_ Here is a small demo of the M5Dial with touch and LVGL. Hope this helps and sorry for the delay.

                M5DialLVGLTouchDemo.ino

                unnamed.jpg

                M gordshG S 3 Replies Last reply Reply Quote 0
                • M Offline
                  mukul_100_ @gordsh
                  last edited by

                  @gordsh Oh great thanks a lot, I actually got it working,
                  and after seeing your code i tried to implement the button part with encoder but the dial seems to crash repeatedly because of it. For now that is not my focus so i will try it again later.
                  Also , do you have any idea how the implementation of encoder is eez studio is.
                  i understood that the group is to be made but didnt quite understand how to append/impelment the encoder events to it
                  If anyone has any idea or reference, Thank you in advance.

                  also this is the code for how i implemented the button press with encoder

                  // Encoder read function
                  void encoder_read(lv_indev_drv_t *drv, lv_indev_data_t *data) {
                      long newPosition = M5Dial.Encoder.read() / 4; // Normalize encoder position
                      if (newPosition != oldPosition) {
                          int encoderDiff = newPosition - oldPosition;
                          oldPosition = newPosition;
                  
                          // React to encoder rotation
                          if (encoderDiff > 0) {
                              lv_group_focus_next(group);
                          } else if (encoderDiff < 0) {
                              lv_group_focus_prev(group);
                          }
                      }
                  
                      // Check button press
                      if (M5Dial.BtnA.wasPressed()) {
                          data->state = LV_INDEV_STATE_PR;
                          Serial.println("M5.BtnA Pressed");
                      } else {
                          data->state = LV_INDEV_STATE_REL;
                      }
                  }
                  
                  // Display flush function
                  void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
                      uint32_t width = (area->x2 - area->x1 + 1);
                      uint32_t height = (area->y2 - area->y1 + 1);
                  
                      M5.Display.startWrite();
                      M5.Display.setAddrWindow(area->x1, area->y1, width, height);
                      M5.Display.pushPixels((uint16_t *)&color_p->full, width * height, true);
                      M5.Display.endWrite();
                  
                      lv_disp_flush_ready(disp);
                  }
                  
                  void setup() {
                      auto cfg = M5.config();
                      M5Dial.begin(cfg, true, false);
                      Serial.begin(115200);
                  
                      // LVGL initialization
                      lv_init();
                      lv_disp_draw_buf_init(&drawBuffer, buffer, NULL, SCREEN_WIDTH * SCREEN_HEIGHT / 10);
                  
                      static lv_disp_drv_t disp_drv;
                      lv_disp_drv_init(&disp_drv);
                      disp_drv.hor_res = SCREEN_WIDTH;
                      disp_drv.ver_res = SCREEN_HEIGHT;
                      disp_drv.flush_cb = my_disp_flush;
                      disp_drv.draw_buf = &drawBuffer;
                      lv_disp_drv_register(&disp_drv);
                  
                      static lv_indev_drv_t encoder_drv;
                      lv_indev_drv_init(&encoder_drv);
                      encoder_drv.type = LV_INDEV_TYPE_ENCODER;
                      encoder_drv.read_cb = encoder_read;
                      encoder_indev = lv_indev_drv_register(&encoder_drv);
                  
                      // Create a group and assign it to the encoder input device
                      group = lv_group_create();
                      lv_indev_set_group(encoder_indev, group);
                  
                      // Create focusable widgets
                      lv_obj_t *btn1 = lv_btn_create(lv_scr_act());
                      lv_obj_align(btn1, LV_ALIGN_CENTER, -60, 0);
                      lv_obj_t *label1 = lv_label_create(btn1);
                      lv_label_set_text(label1, "Button 1");
                  
                      lv_obj_t *btn2 = lv_btn_create(lv_scr_act());
                      lv_obj_align(btn2, LV_ALIGN_CENTER, 60, 0);
                      lv_obj_t *label2 = lv_label_create(btn2);
                      lv_label_set_text(label2, "Button 2");
                  
                      lv_obj_t *btn3 = lv_btn_create(lv_scr_act());
                      lv_obj_align(btn3, LV_ALIGN_CENTER, 0, 50);
                      lv_obj_t *label3 = lv_label_create(btn3);
                      lv_label_set_text(label3, "Button 3");
                  
                      // Add widgets to the group
                      lv_group_add_obj(group, btn1);
                      lv_group_add_obj(group, btn2);
                      lv_group_add_obj(group, btn3);
                  }
                  
                  1 Reply Last reply Reply Quote 0
                  • gordshG Offline
                    gordsh @gordsh
                    last edited by

                    @gordsh thanks for sending, I actually don't know eez studio at all, I have never used it..

                    M 1 Reply Last reply Reply Quote 1
                    • M Offline
                      mukul_100_ @gordsh
                      last edited by

                      @gordsh in your code, is the press function working successfully?
                      i am getting crashes for now, i am trying to use the button as a external button and not as a encoder button, the main problems seems to be init of button

                      1 Reply Last reply Reply Quote 1
                      • S Offline
                        SadE54 @gordsh
                        last edited by

                        @gordsh Do you think with the lvgl m5dial setup , that Squareline Studio is usable ?

                        gordshG 1 Reply Last reply Reply Quote 0
                        • gordshG Offline
                          gordsh @SadE54
                          last edited by

                          @SadE54 I believe it is.

                          1 Reply Last reply Reply Quote 2

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • First post
                            Last post