Display an Image from SDRAM with TouchGFX

1.5k Views Asked by At

I copied a Bitmap image from SDCard to Address 0xC0000000 of External SDRAM. I want to display this image using the TouchGFX functions. As I read in this document, I have to execute this code:

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);
  ...
}

But when I bring this code into my project (TouchGFXConfiguration.cpp) when I compile the project, I get this error:

'STM32F7HAL' was not declared in this scope

I searched for "STM32F7HAL" throughout the project but found nothing in the search results. Also, my project is implemented with STM32F779 microcontroller and STM32F779EVAL board.

1

There are 1 best solutions below

0
On

You've stumbled upon an error in the documentation for TouchGFX 4.15.0.

The call to touchgfx_generic_init is deprecated (it was just a helper function). The function touchgfx_init which is already defined for you, should make an explicit call to Bitmap::registerBitmapDatabase(). If you're using CubeMX and TouchGFX Generator, this call should've already been there.

The signature of the function is as follows. The last three arguments are cache pointer, cache size, and number of dynamic bitmaps.

/**
 * 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);