散bing 2023-05-03 10:10 采纳率: 50%
浏览 43

lvgl8.0.0移植后颜色显示不正常

原来使用的lvgl6.0.0的系统,所有的组件颜色显示都是正常,然而移植完8.0.0版本后颜色缺不正常,发现给的颜色为白色rgb(r8,g8,b8)565格式,实际显示成了rg(r8,b8,0)的颜色,其中b的颜色被砍了,变成了0,检查lv_conf.h文件跟原来给的是一样的16位深的设置,是哪里还需要修改吗,有能解惑么?

  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-05-03 12:03
    关注
    • 这篇博客: LVGL8.1笔记2–触摸移植(2022-0603)中的 下面列出我移植完成的.c和.h文件 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
    • lv_port_indev.h

      /**
       * @file lv_port_indev_templ.h
       *
       */
      
       /*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/
      #if 1
      
      #ifndef LV_PORT_INDEV_H
      #define LV_PORT_INDEV_H
      
      #ifdef __cplusplus
      extern "C" {
      #endif
      
      /*********************
       *      INCLUDES
       *********************/
      #include "lvgl.h"
      
      /*********************
       *      DEFINES
       *********************/
      
      /**********************
       *      TYPEDEFS
       **********************/
      
      /**********************
       * GLOBAL PROTOTYPES
       **********************/
      void lv_port_indev_init(void);
      /**********************
       *      MACROS
       **********************/
      
      #ifdef __cplusplus
      } /*extern "C"*/
      #endif
      
      #endif /*LV_PORT_INDEV_TEMPL_H*/
      
      #endif /*Disable/Enable content*/
      
      

      lv_port_indev.c

      /**
       * @file lv_port_indev_templ.c
       *
       */
      
       /*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
      #if 1
      
      /*********************
       *      INCLUDES
       *********************/
      #include "lv_port_indev.h"
      #include "../../lvgl.h"
      
      #include "touch.h"
      
      /*********************
       *      DEFINES
       *********************/
      
      /**********************
       *      TYPEDEFS
       **********************/
      
      /**********************
       *  STATIC PROTOTYPES
       **********************/
      
      static void touchpad_init(void);
      static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
      static bool touchpad_is_pressed(void);
      static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
      
      /**********************
       *  STATIC VARIABLES
       **********************/
      lv_indev_t * indev_touchpad;
      
      /**********************
       *      MACROS
       **********************/
      
      /**********************
       *   GLOBAL FUNCTIONS
       **********************/
      
      void lv_port_indev_init(void)
      {
          /**
           * Here you will find example implementation of input devices supported by LittelvGL:
           *  - Touchpad
           *  - Mouse (with cursor support)
           *  - Keypad (supports GUI usage only with key)
           *  - Encoder (supports GUI usage only with: left, right, push)
           *  - Button (external buttons to press points on the screen)
           *
           *  The `..._read()` function are only examples.
           *  You should shape them according to your hardware
           */
      
          static lv_indev_drv_t indev_drv;
      
          /*------------------
           * Touchpad
           * -----------------*/
      
          /*Initialize your touchpad if you have*/
          touchpad_init();
      
          /*Register a touchpad input device*/
          lv_indev_drv_init(&indev_drv);
          indev_drv.type = LV_INDEV_TYPE_POINTER;
          indev_drv.read_cb = touchpad_read;
          indev_touchpad = lv_indev_drv_register(&indev_drv);
      }
      
      /**********************
       *   STATIC FUNCTIONS
       **********************/
      
      /*------------------
       * Touchpad
       * -----------------*/
      
      /*Initialize your touchpad*/
      static void touchpad_init(void)
      {
          /*Your code comes here*/
      }
      
      /*Will be called by the library to read the touchpad*/
      static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
      {
          static lv_coord_t last_x = 0;
          static lv_coord_t last_y = 0;
      
          /*Save the pressed coordinates and the state*/
          if(touchpad_is_pressed()) {
              touchpad_get_xy(&last_x, &last_y);
              data->state = LV_INDEV_STATE_PR;
          } else {
              data->state = LV_INDEV_STATE_REL;
          }
      
          /*Set the last pressed coordinates*/
          data->point.x = last_x;
          data->point.y = last_y;
      }
      
      /*Return true is the touchpad is pressed*/
      static bool touchpad_is_pressed(void)
      {
          /*Your code comes here*/
          if(TP_PRES_DOWN & tp_dev.sta)
          {
              return true;
          }
          return false;
      }
      
      /*Get the x and y coordinates if the touchpad is pressed*/
      static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
      {
          /*Your code comes here*/
      
          (*x) = tp_dev.x[0];
          (*y) = tp_dev.y[0];
      }
      
      
      
      #else /*Enable this file at the top*/
      
      /*This dummy typedef exists purely to silence -Wpedantic.*/
      typedef int keep_pedantic_happy;
      #endif
      
      
    评论

报告相同问题?

问题事件

  • 创建了问题 5月3日

悬赏问题

  • ¥20 ARKts悬浮窗和快捷方式问题
  • ¥15 comparecluster没有办法kegg
  • ¥15 远程访问linux主机超时
  • ¥15 odoo17存货管理优势于中国国内该行业传统ERP或MES的详细解读和举例
  • ¥15 CPU卡指令整合指令数据都在图片上
  • ¥15 odoo17处理受托加工产品
  • ¥15 如何用MATLAB编码图三的积分
  • ¥15 圆孔衍射光强随孔径变化
  • ¥15 MacBook pro m3max上用vscode运行c语言没有反应
  • ¥15 ESP-PROG配置错误,ALL ONES