LVGL 驱动地址自动变更为32 位的问题

cpp 复制代码
lv_indev_t * kb = NULL;
lv_display_t * sdl_hal_init(int32_t w, int32_t h)
{

  lv_group_set_default(lv_group_create());

  lv_display_t * disp = lv_sdl_window_create(w, h);

  lv_indev_t * mouse = lv_sdl_mouse_create();
  lv_indev_set_group(mouse, lv_group_get_default());
  lv_indev_set_display(mouse, disp);
  lv_display_set_default(disp);
  /*Declare the image file.*/
  LV_IMAGE_DECLARE(mouse_cursor_icon);
  lv_obj_t * cursor_obj;
  /*Create an image object for the cursor */
  cursor_obj = lv_image_create(lv_screen_active());
  /*Set the image source*/
  lv_image_set_src(cursor_obj, &mouse_cursor_icon);
  /*Connect the image  object to the driver*/
  lv_indev_set_cursor(mouse, cursor_obj);

  // lv_indev_t * mousewheel = lv_sdl_mousewheel_create();
  // lv_indev_set_display(mousewheel, disp);
  // lv_indev_set_group(mousewheel, lv_group_get_default());

    kb = lv_sdl_keyboard_create();
  lv_indev_set_display(kb, disp);
  lv_indev_set_group(kb, lv_group_get_default());
    LV_LOG_WARN(" sdl_hal_init kb:%p \n",kb);
  return disp;
}

核心原因是 get_indev 是一个 static 函数。。。。

他获取到的地址会自动将 高32 截取掉, 仅保留低32 位地址。

因此 函数在使用的时候一定注意!!! 静态函数的使用范围!

cpp 复制代码
static lv_indev_t * get_indev(const lv_group_t * g)
{
    lv_indev_t * indev_guess = NULL;
    lv_indev_t * indev = lv_indev_get_next(NULL);

    while(indev) {
        lv_indev_type_t indev_type = lv_indev_get_type(indev);
        /*Prefer POINTER*/
        if(indev_type == LV_INDEV_TYPE_KEYPAD) return indev;
        if(lv_indev_get_group(indev) == g) {
            indev_guess = indev;
        }
        indev = lv_indev_get_next(indev);
    }

    return indev_guess;
}
相关推荐
活捉一个坏小孩7 天前
Nvidia FFmpeg安装说明
ffmpeg
WF_YL7 天前
如何删除 Oracle 过期 key / 数据,删除目的的key
ffmpeg
浩瀚之水_csdn7 天前
avcodec_find_decoder函数详解
ffmpeg
浩瀚之水_csdn10 天前
avcodec_parameters_copy详解
linux·人工智能·ffmpeg
不吃鱼的猫74814 天前
【ffplay 源码解析系列】02-核心数据结构详解
c++·ffmpeg·音视频
不吃鱼的猫74814 天前
【ffplay 源码解析系列】01-开篇-ffplay整体架构与启动流程
c++·架构·ffmpeg·音视频
REDcker16 天前
FFmpeg开发者快速入门
ffmpeg
不吃鱼的猫74816 天前
【从零手写播放器:FFmpeg 音视频开发实战】04-封装格式与多媒体容器
c++·ffmpeg·音视频
REDcker17 天前
FFmpeg完整文档
linux·服务器·c++·ffmpeg·音视频·c·后端开发
硬汉嵌入式17 天前
QEMU & FFmpeg作者Fabrice Bellard推出MicroQuickJS,一款面向嵌入式系统JavaScript引擎,仅需10K RAM
javascript·ffmpeg·microquickjs