yinxiangxv 发表于 2024-4-28 16:29

【N32G430开发板体验】读帖子的心得

在eeworld上面看到这个帖子,然后就看了看
https://bbs.**/thread-1275000-1-1.html
但是开发板型号不对应,所以没有进行编译,只是对代码进行了解读,认识浅显,大佬勿喷。

帖子里面的一个函数的第三个参数 :

[*]static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
[*]用到一个结构体,但是贴出来的代码是不是有一个命名错误?
[*]
[*]typedef union {
[*]    struct {
[*]#if LV_COLOR_16_SWAP == 0
[*]      uint16_t blue : 5;
[*]      uint16_t green : 6;
[*]      uint16_t red : 5;
[*]#else
[*]      uint16_t green_h : 3;
[*]      uint16_t red : 5;
[*]      uint16_t blue : 5;
[*]      uint16_t green_l : 3;
[*]#endif
[*]    } ch;
[*]    uint16_t full;
[*]} lv_color16_t;

full","marks":[]}]}],"state":{}}]" style="color: rgb(51, 51, 51); font-family: "Microsoft yahei"; font-size: 14px; white-space: normal;">lv_color16_t 是一个共用体,所以可以直接填color_p->full,这里的lv_color16_t跟函数里面的lv_color_t是不是一个东西呢?


另外,这里的一个函数的实现楼主并没有给出:

[*]void lv_port_disp_init(void)
[*]{
[*]    /*-------------------------
[*]   * Initialize your display
[*]   * -----------------------*/
[*]//    disp_init();
[*]   LCD_Init();
[*]    /*-----------------------------
[*]   * Create a buffer for drawing
[*]   *----------------------------*/
[*]第二个作者自己实现的函数,也没有给出具体的逻辑,只有函数声明,难道这就是作者的核心竞争力吗?
[*]void GUI_DrawPoint(unsigned short x,unsigned short y,unsigned short color)
[*]在https://www.cnblogs.com/delehub/p/17448309.html,找到了一下相关代码的参考,但是具体能不能运行,还要看看编译后下载执行的情况
[*]


慢醇 发表于 2024-8-31 18:21

在对代码进行适配后,进行编译和测试以确保其在您的开发板上正常运行。

yinxiangxv 发表于 2024-9-1 11:05

慢醇 发表于 2024-8-31 18:21
定向到串口打印

抽空试一试

caigang13 发表于 2024-9-2 07:40

网上很多代码都是故意留了坑的,不能直接使用。

好几遍vh 发表于 2024-9-30 14:48

只是对代码进行了解读,认识浅显,大佬勿喷

suncat0504 发表于 2024-10-29 18:46

平时不怎么用深一些的知识编程,不到UNION是干啥用的。看来的恶补一下了。只知道在SQL中union是干啥用的,
页: [1]
查看完整版本: 【N32G430开发板体验】读帖子的心得