C
Qt Quick Ultralite fileloading Example
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "fatfs/fatfsfilesystem.h"
#include "board_config.h"
#include "ff.h"
#include "ff_gen_drv.h"
#include <platforminterface/log.h>
#include <platform/mem.h>
#include <qul/application.h>
extern "C" const Diskio_drvTypeDef SD_Driver;
void ConfigureBoard()
{
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);
}
extern "C" {
void *ff_memalloc(UINT msize)
{
return Qul::Platform::qul_malloc(msize);
}
void ff_memfree(void *ptr)
{
Qul::Platform::qul_free(ptr);
}
}