Skip to content

Commit

Permalink
Merge pull request #184 from espressif/examples/spiffs_in_display_aud…
Browse files Browse the repository at this point in the history
…io_photo

example: Use SPIFFS init from BSP
  • Loading branch information
espzav authored Jun 21, 2023
2 parents 9151469 + 1f65d68 commit ab64673
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion esp-box-lite/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "1.0.0"
version: "1.0.1"
description: Board Support Package for ESP32-S3-BOX-Lite
url: https://github.com/espressif/esp-bsp/tree/master/esp-box-lite

Expand Down
4 changes: 2 additions & 2 deletions esp-box-lite/include/bsp/esp-box-lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ esp_err_t bsp_i2c_deinit(void);
*
* After mounting the SPIFFS, it can be accessed with stdio functions ie.:
* \code{.c}
* FILE* f = fopen(BSP_MOUNT_POINT"/hello.txt", "w");
* FILE* f = fopen(BSP_SPIFFS_MOUNT_POINT"/hello.txt", "w");
* fprintf(f, "Hello World!\n");
* fclose(f);
* \endcode
**************************************************************************************************/
#define BSP_MOUNT_POINT CONFIG_BSP_SPIFFS_MOUNT_POINT
#define BSP_SPIFFS_MOUNT_POINT CONFIG_BSP_SPIFFS_MOUNT_POINT

/**
* @brief Mount SPIFFS to virtual file system
Expand Down
2 changes: 1 addition & 1 deletion esp-box/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version: "2.4.0"
version: "2.4.1"
description: Board Support Package for ESP-BOX
url: https://github.com/espressif/esp-bsp/tree/master/esp-box

Expand Down
4 changes: 2 additions & 2 deletions esp-box/include/bsp/esp-box.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ esp_err_t bsp_i2c_deinit(void);
*
* After mounting the SPIFFS, it can be accessed with stdio functions ie.:
* \code{.c}
* FILE* f = fopen(BSP_MOUNT_POINT"/hello.txt", "w");
* FILE* f = fopen(BSP_SPIFFS_MOUNT_POINT"/hello.txt", "w");
* fprintf(f, "Hello World!\n");
* fclose(f);
* \endcode
**************************************************************************************************/
#define BSP_MOUNT_POINT CONFIG_BSP_SPIFFS_MOUNT_POINT
#define BSP_SPIFFS_MOUNT_POINT CONFIG_BSP_SPIFFS_MOUNT_POINT

/**
* @brief Mount SPIFFS to virtual file system
Expand Down
12 changes: 2 additions & 10 deletions examples/display_audio_photo/main/app_disp_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "jpeg_decoder.h"

/* SPIFFS mount root */
#define FS_MNT_PATH "/root"
#define FS_MNT_PATH BSP_SPIFFS_MOUNT_POINT

/* Buffer for reading/writing to I2S driver. Same length as SPIFFS buffer and I2S buffer, for optimal read/write performance.
Recording audio data path:
Expand Down Expand Up @@ -170,19 +170,11 @@ void app_audio_init(void)

void app_disp_fs_init(void)
{
const esp_vfs_spiffs_conf_t spifs_conf = {
.base_path = FS_MNT_PATH,
.partition_label = NULL,
.max_files = 5,
.format_if_mount_failed = true
};

file_buffer_size = BSP_LCD_H_RES * BSP_LCD_V_RES * sizeof(lv_color_t);
file_buffer = heap_caps_calloc(file_buffer_size, 1, MALLOC_CAP_DEFAULT);
assert(file_buffer);

/* Initialize file system */
ESP_ERROR_CHECK( esp_vfs_spiffs_register(&spifs_conf) );
/* Initialize root path */
strcpy(fs_current_path, FS_MNT_PATH);

/* Show list of files */
Expand Down
3 changes: 3 additions & 0 deletions examples/display_audio_photo/main/bsp_espbox_disp_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ static const char *TAG = "example";

void app_main(void)
{
/* Initialize and mount SPIFFS */
bsp_spiffs_mount();

/* Initialize I2C (for touch and audio) */
bsp_i2c_init();

Expand Down

0 comments on commit ab64673

Please sign in to comment.