C

Qt Quick Ultralite fileloading Example

/****************************************************************************** ** ** Copyright (C) 2023 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
#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); } }