使用TouchGFX显示来自SDRAM的图像

问题描述

我从SDCard复制了一个位图图像到外部SDRAM的地址0xC0000000。我想使用TouchGFX功能显示此图像。当我在this document中阅读时,我必须执行以下代码

static uint32_t bmpCache = (uint32_t)(0xC0000000); // SDRAM
void touchgfx_init()
{
  HAL& hal = touchgfx_generic_init<STM32F7HAL>(dma,display,tc,480,272,(uint16_t*)bmpCache,232000,1);
  ...
}

但是当我在编译项目时将此代码带入我的项目( TouchGFXConfiguration.cpp )时,会出现以下错误

'STM32F7HAL' was not declared in this scope

我在整个项目中搜索了“ STM32F7HAL”,但在搜索结果中什么都没有找到。 另外,我的项目是使用STM32F779微控制器和STM32F779EVAL板实现的。

解决方法

您偶然发现了TouchGFX 4.15.0文档中的一个错误。

不推荐使用touchgfx_generic_init的调用(它只是一个辅助函数)。已经为您定义的功能touchgfx_init应该显式调用Bitmap::registerBitmapDatabase()。如果您使用的是CubeMX和TouchGFX Generator,则此呼叫应该已经存在。

该函数的签名如下。最后三个参数是缓存指针,缓存大小和动态位图的数量。

/**
 * Registers an array of bitmaps. All Bitmap instances are bound to this database. This
 * function is called automatically from HAL::touchgfx_generic_init().
 *
 * @param      data                   A reference to the BitmapData storage array.
 * @param      n                      The number of bitmaps in the array.
 * @param [in] cachep                 (Optional) Pointer to memory region in which bitmap
 *                                    data can be cached.
 * @param      csize                  (Optional) Size of cache memory region in bytes (0 if
 *                                    unused)
 * @param      numberOfDynamicBitmaps (Optional) Number of dynamic bitmaps to be allowed in
 *                                    the cache.
 */

static void registerBitmapDatabase(const BitmapData* data,const uint16_t n,uint16_t* cachep = 0,uint32_t csize = 0,uint32_t numberOfDynamicBitmaps = 0);

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...