[STM32F7] emwin 移植之后显示错乱

[复制链接]
1054|7
 楼主| xiaofei558008 发表于 2020-11-17 11:07 | 显示全部楼层 |阅读模式
最近在研究emwin,使用 STM32F7 LTDC驱动RGB屏幕;移植了emwin之后,使用  GUI_DispString("Hello world!"); 打印到屏幕上,发现显示是错乱的;求助大侠!


IMG20201117110357.jpg
 楼主| xiaofei558008 发表于 2020-11-17 11:09 | 显示全部楼层
static void _SetPixelIndex(GUI_DEVICE * pDevice, int x, int y, int PixelIndex) {
    //
    // Convert logical into physical coordinates (Dep. on LCDConf.h)
    //
    #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY == 1)
      int xPhys, yPhys;

      xPhys = LOG2PHYS_X(x, y);
      yPhys = LOG2PHYS_Y(x, y);
    #else
      #define xPhys x
      #define yPhys y
    #endif
    GUI_USE_PARA(pDevice);
    GUI_USE_PARA(x);
    GUI_USE_PARA(y);
    GUI_USE_PARA(PixelIndex);
    {
      //
      // Write into hardware ... Adapt to your system
      //
      __LCD_RAM[x][y] = (uint16_t)PixelIndex;
      //
    }
    #if (LCD_MIRROR_X == 0) && (LCD_MIRROR_Y == 0) && (LCD_SWAP_XY == 0)
      #undef xPhys
      #undef yPhys
    #endif
}

评论

static unsigned int _GetPixelIndex(GUI_DEVICE * pDevice, int x, int y) { unsigned int PixelIndex; // // Convert logical into physical coordinates (Dep. on LCDConf.h) // #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY   发表于 2020-11-17 11:10
 楼主| xiaofei558008 发表于 2020-11-17 11:11 | 显示全部楼层
xiaofei558008 发表于 2020-11-17 11:09
static void _SetPixelIndex(GUI_DEVICE * pDevice, int x, int y, int PixelIndex) {
    //
    // Conve ...

static unsigned int _GetPixelIndex(GUI_DEVICE * pDevice, int x, int y) {
  unsigned int PixelIndex;
    //
    // Convert logical into physical coordinates (Dep. on LCDConf.h)
    //
    #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY == 1)
      int xPhys, yPhys;

      xPhys = LOG2PHYS_X(x, y);
      yPhys = LOG2PHYS_Y(x, y);
    #else
      #define xPhys x
      #define yPhys y
    #endif
    GUI_USE_PARA(pDevice);
    GUI_USE_PARA(x);
    GUI_USE_PARA(y);
    {
      //
      // Write into hardware ... Adapt to your system
      //
      PixelIndex = __LCD_RAM[x][y];
      //
    }
    #if (LCD_MIRROR_X == 0) && (LCD_MIRROR_Y == 0) && (LCD_SWAP_XY == 0)
      #undef xPhys
      #undef yPhys
    #endif
  return PixelIndex;
}

只改了这两个函数,__LCD_RAM[480][272]是全局变量,做LCD显示缓存,没有用外部 SDRAM
数据采集存储 发表于 2020-11-17 11:20 | 显示全部楼层
我为什么没有看明白你的代码??
 楼主| xiaofei558008 发表于 2020-11-17 11:33 | 显示全部楼层
数据采集存储 发表于 2020-11-17 11:20
我为什么没有看明白你的代码??

emwin库的代码
 楼主| xiaofei558008 发表于 2020-11-17 14:03 | 显示全部楼层
问题找到了,自问自答一下,
__LCD_RAM[x][y]  --> 改成 __LCD_RAM[y][x] ;
内存排错了;
别看我照片 发表于 2020-11-17 19:00 | 显示全部楼层
我静然看不懂,好久没有看C语言编程嘞哎,,,
您需要登录后才可以回帖 登录 | 注册

本版积分规则

142

主题

997

帖子

13

粉丝
快速回复 在线客服 返回列表 返回顶部