硬汉嵌入式论坛

 找回密码
 立即注册
查看: 2181|回复: 4
收起左侧

ST各个版本HAL库的结构体成员和宏定义不兼容看来是传统,这已经好多次了

[复制链接]

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115667
QQ
发表于 2020-5-29 12:05:25 | 显示全部楼层 |阅读模式
有些地方改的太随意了,前期规划不给力。

参数成员的定义和宏定义不兼容是硬伤,非常影响参考工程的移植。

ThreadX的的F7 GUIX工程里面DMA2D整了个这个定义

  1. /** @defgroup DMA2D_Color_Mode DMA2D Color Mode
  2.   * @{
  3.   */
  4. #define DMA2D_ARGB8888                       ((uint32_t)0x00000000)             /*!< ARGB8888 DMA2D color mode */
  5. #define DMA2D_RGB888                         ((uint32_t)0x00000001)             /*!< RGB888 DMA2D color mode   */
  6. #define DMA2D_RGB565                         ((uint32_t)0x00000002)             /*!< RGB565 DMA2D color mode   */
  7. #define DMA2D_ARGB1555                       ((uint32_t)0x00000003)             /*!< ARGB1555 DMA2D color mode */
  8. #define DMA2D_ARGB4444                       ((uint32_t)0x00000004)             /*!< ARGB4444 DMA2D color mode */
复制代码


新版的已经分成输入和输出
  1. /** @defgroup DMA2D_Output_Color_Mode DMA2D Output Color Mode
  2.   * @{
  3.   */
  4. #define DMA2D_OUTPUT_ARGB8888       ((uint32_t)0x00000000U)               /*!< ARGB8888 DMA2D color mode */
  5. #define DMA2D_OUTPUT_RGB888         DMA2D_OPFCCR_CM_0                     /*!< RGB888 DMA2D color mode   */
  6. #define DMA2D_OUTPUT_RGB565         DMA2D_OPFCCR_CM_1                     /*!< RGB565 DMA2D color mode   */
  7. #define DMA2D_OUTPUT_ARGB1555       (DMA2D_OPFCCR_CM_0|DMA2D_OPFCCR_CM_1) /*!< ARGB1555 DMA2D color mode */
  8. #define DMA2D_OUTPUT_ARGB4444       DMA2D_OPFCCR_CM_2                     /*!< ARGB4444 DMA2D color mode */
  9. /**
  10.   * @}
  11.   */

  12. /** @defgroup DMA2D_Input_Color_Mode DMA2D Input Color Mode
  13.   * @{
  14.   */
  15. #define DMA2D_INPUT_ARGB8888        ((uint32_t)0x00000000U)  /*!< ARGB8888 color mode */
  16. #define DMA2D_INPUT_RGB888          ((uint32_t)0x00000001U)  /*!< RGB888 color mode   */
  17. #define DMA2D_INPUT_RGB565          ((uint32_t)0x00000002U)  /*!< RGB565 color mode   */
  18. #define DMA2D_INPUT_ARGB1555        ((uint32_t)0x00000003U)  /*!< ARGB1555 color mode */
  19. #define DMA2D_INPUT_ARGB4444        ((uint32_t)0x00000004U)  /*!< ARGB4444 color mode */
  20. #define DMA2D_INPUT_L8              ((uint32_t)0x00000005U)  /*!< L8 color mode       */
  21. #define DMA2D_INPUT_AL44            ((uint32_t)0x00000006U)  /*!< AL44 color mode     */
  22. #define DMA2D_INPUT_AL88            ((uint32_t)0x00000007U)  /*!< AL88 color mode     */
  23. #define DMA2D_INPUT_L4              ((uint32_t)0x00000008U)  /*!< L4 color mode       */
  24. #define DMA2D_INPUT_A8              ((uint32_t)0x00000009U)  /*!< A8 color mode       */
  25. #define DMA2D_INPUT_A4              ((uint32_t)0x0000000AU)  /*!< A4 color mode       */
  26. #define DMA2D_INPUT_YCBCR           ((uint32_t)0x0000000BU)   /*!< YCbCr color mode */
复制代码





回复

使用道具 举报

4

主题

39

回帖

51

积分

初级会员

积分
51
发表于 2020-5-29 12:11:48 | 显示全部楼层
如果是大版本更新的话,有点breaking change也是能够理解的
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115667
QQ
 楼主| 发表于 2020-5-29 12:20:40 | 显示全部楼层
msr06rr 发表于 2020-5-29 12:11
如果是大版本更新的话,有点breaking change也是能够理解的

这种问题,更新案例的非常闹心。
回复

使用道具 举报

1

主题

71

回帖

74

积分

初级会员

积分
74
发表于 2020-5-29 15:03:54 | 显示全部楼层
HAL库反正是超级难用,都有点向上寄存器了
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115667
QQ
 楼主| 发表于 2020-5-30 18:21:18 | 显示全部楼层
252514251 发表于 2020-5-29 15:03
HAL库反正是超级难用,都有点向上寄存器了

逐渐熟练点了,会好不少。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-5-10 23:52 , Processed in 0.219629 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表