我将位图图像从SDCard复制到外部SDRAM的地址0xC0000000。我想使用TouchGFX功能显示此图像。正如我在这份文件中所读到的,我必须执行以下代码:
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微控制器和STM32F777EVAL板实现的。
您在TouchGFX 4.15.0的文档中偶然发现了一个错误。
对touchgfx_generic_init
的调用已被弃用(它只是一个辅助函数(。已经为您定义的函数touchgfx_init
应该显式调用Bitmap::registerBitmapDatabase()
。如果你正在使用CubeMX和TouchGFX生成器,那么这个调用应该已经存在了。
函数的签名如下。最后三个参数是缓存指针、缓存大小和动态位图的数量。
/**
* 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);