From 69d440335fdad90d3be410428d1e692af430ab89 Mon Sep 17 00:00:00 2001 From: Liam <30486941+liamHowatt@users.noreply.github.com> Date: Fri, 23 Aug 2024 02:16:52 -0400 Subject: [PATCH] fix(fs): remove Arduino SD initialization (#6725) --- Kconfig | 8 -------- docs/libs/arduino_sd.rst | 3 +-- env_support/cmsis-pack/lv_conf_cmsis.h | 2 -- lv_conf_template.h | 2 -- src/libs/fsdrv/lv_fs_arduino_sd.cpp | 14 -------------- src/lv_conf_internal.h | 14 -------------- 6 files changed, 1 insertion(+), 42 deletions(-) diff --git a/Kconfig b/Kconfig index bc952ebcf..0384c073c 100644 --- a/Kconfig +++ b/Kconfig @@ -1210,14 +1210,6 @@ menu "LVGL configuration" int "Set an upper cased letter on which the drive will accessible (e.g. 65 for 'A')" default 0 depends on LV_USE_FS_ARDUINO_SD - config LV_FS_ARDUINO_SD_CS_PIN - int "Set the pin connected to the chip select line of the SD card" - default 0 - depends on LV_USE_FS_ARDUINO_SD - config LV_FS_ARDUINO_SD_FREQUENCY - int "Set the frequency used by the chip of the SD CARD" - default 40000000 - depends on LV_USE_FS_ARDUINO_SD config LV_USE_LODEPNG bool "PNG decoder library" diff --git a/docs/libs/arduino_sd.rst b/docs/libs/arduino_sd.rst index 97ae71319..c5c8ad2e4 100644 --- a/docs/libs/arduino_sd.rst +++ b/docs/libs/arduino_sd.rst @@ -17,8 +17,7 @@ Usage ----- Enable :c:macro:`LV_USE_FS_ARDUINO_SD` and define a :c:macro:`LV_FS_ARDUINO_SD_LETTER` in ``lv_conf.h``. -You probably need to configure the :c:macro:`LV_FS_ARDUINO_SD_CS_PIN` and :c:macro:`LV_FS_ARDUINO_SD_FREQUENCY` that -corresponds to the pin connected and the frequency used by the chip of the SD CARD. +You will need to initialize the SD card before LVGL can use it (i.e. :cpp:expr:`SD.begin(0, SPI, 40000000)`). API diff --git a/env_support/cmsis-pack/lv_conf_cmsis.h b/env_support/cmsis-pack/lv_conf_cmsis.h index f2fe4a77b..f887ded9c 100644 --- a/env_support/cmsis-pack/lv_conf_cmsis.h +++ b/env_support/cmsis-pack/lv_conf_cmsis.h @@ -669,8 +669,6 @@ /*API for Arduino Sd. */ #if LV_USE_FS_ARDUINO_SD #define LV_FS_ARDUINO_SD_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_ARDUINO_SD_CS_PIN 0 /*Set the pin connected to the chip select line of the SD card */ - #define LV_FS_ARDUINO_SD_FREQUENCY 40000000 /*Set the frequency used by the chip of the SD CARD */ #endif /*GIF decoder library*/ diff --git a/lv_conf_template.h b/lv_conf_template.h index bef23926c..769070814 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -741,8 +741,6 @@ #define LV_USE_FS_ARDUINO_SD 0 #if LV_USE_FS_ARDUINO_SD #define LV_FS_ARDUINO_SD_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_ARDUINO_SD_CS_PIN 0 /*Set the pin connected to the chip select line of the SD card */ - #define LV_FS_ARDUINO_SD_FREQUENCY 40000000 /*Set the frequency used by the chip of the SD CARD */ #endif /*LODEPNG decoder library*/ diff --git a/src/libs/fsdrv/lv_fs_arduino_sd.cpp b/src/libs/fsdrv/lv_fs_arduino_sd.cpp index c0706657f..14941aca0 100644 --- a/src/libs/fsdrv/lv_fs_arduino_sd.cpp +++ b/src/libs/fsdrv/lv_fs_arduino_sd.cpp @@ -25,7 +25,6 @@ typedef struct SdFile { /********************** * STATIC PROTOTYPES **********************/ -static void fs_init(void); static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode); static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p); static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); @@ -38,8 +37,6 @@ static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); */ extern "C" void lv_fs_arduino_sd_init(void) { - fs_init(); - lv_fs_drv_t * fs_drv = &(LV_GLOBAL_DEFAULT()->arduino_sd_fs_drv); lv_fs_drv_init(fs_drv); @@ -62,17 +59,6 @@ extern "C" void lv_fs_arduino_sd_init(void) * STATIC FUNCTIONS **********************/ -/*Initialize your Storage device and File system.*/ -static void fs_init(void) -{ - if(!SD.begin(LV_FS_ARDUINO_SD_CS_PIN, SPI, LV_FS_ARDUINO_SD_FREQUENCY)) { - LV_LOG_WARN("Driver Arduino SD Card not mounted"); - return; - } - - LV_LOG_WARN("Driver Arduino SD Card mounted"); -} - /** * Open a file * @param drv pointer to a driver where this function belongs diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 8be76d0c9..2bd9bd68b 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -2484,20 +2484,6 @@ #define LV_FS_ARDUINO_SD_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #endif #endif - #ifndef LV_FS_ARDUINO_SD_CS_PIN - #ifdef CONFIG_LV_FS_ARDUINO_SD_CS_PIN - #define LV_FS_ARDUINO_SD_CS_PIN CONFIG_LV_FS_ARDUINO_SD_CS_PIN - #else - #define LV_FS_ARDUINO_SD_CS_PIN 0 /*Set the pin connected to the chip select line of the SD card */ - #endif - #endif - #ifndef LV_FS_ARDUINO_SD_FREQUENCY - #ifdef CONFIG_LV_FS_ARDUINO_SD_FREQUENCY - #define LV_FS_ARDUINO_SD_FREQUENCY CONFIG_LV_FS_ARDUINO_SD_FREQUENCY - #else - #define LV_FS_ARDUINO_SD_FREQUENCY 40000000 /*Set the frequency used by the chip of the SD CARD */ - #endif - #endif #endif /*LODEPNG decoder library*/