C
Qt Quick Ultralite imagedecoder Example
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "board_config.h"
#include "stmimagedecoder.h"
#include "stm32_mcu_specific.h"
#include <qul/application.h>
#if defined(SUPPORT_FILESYSTEM)
#include "fatfs/fatfsfilesystem.h"
#include "ff.h"
#include "ff_gen_drv.h"
FIL JPEG_File; /* File object */
extern "C" const Diskio_drvTypeDef SD_Driver;
extern "C" {
void *ff_memalloc(UINT msize)
{
return Qul::Platform::qul_malloc(msize);
}
void ff_memfree(void *ptr)
{
Qul::Platform::qul_free(ptr);
}
}
#endif
JPEG_HandleTypeDef JPEG_Handle;
extern "C" {
void JPEG_InitColorTables();
}
void ConfigureBoard()
{
/* Init The JPEG Look Up Tables used for YCbCr to RGB conversion*/
JPEG_InitColorTables();
/* Init the HAL JPEG driver */
JPEG_Handle.Instance = JPEG;
if (HAL_JPEG_Init(&JPEG_Handle) != HAL_OK)
Qul::PlatformInterface::log("HAL_JPEG_Init failed\n");
#if defined(SUPPORT_FILESYSTEM)
static FatFsFilesystem filesystem;
static FATFS sdFatFs;
static char sdPath[4];
if (FATFS_LinkDriver(&SD_Driver, sdPath) != 0) {
Qul::PlatformInterface::log("FATFS_LinkDriver failed\n");
return;
}
if (f_mount(&sdFatFs, sdPath, 0) != 0) {
Qul::PlatformInterface::log("Mounting filesystem failed!\n");
return;
}
Qul::Application::addFilesystem(&filesystem);
#endif
static StmImageDecoder imagedecoder;
Qul::Application::addImageDecoder(&imagedecoder);
}