mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-25 09:42:35 +00:00
examples: file_serving: add support for ESP32-S3, refactoring
* Move filesystem mounting code into a separate file to simplify the main source file. * Clean up SDMMC and SDSPI related code. Move pin configuration into Kconfig. * Use same base_path ('/data') for either SPIFFS or SD. Remove the check in file_server.c about the base path. * Update README according to the changes above.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
/* HTTP File Server Example
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
@@ -443,16 +448,10 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
|
||||
}
|
||||
|
||||
/* Function to start the file server */
|
||||
esp_err_t start_file_server(const char *base_path)
|
||||
esp_err_t example_start_file_server(const char *base_path)
|
||||
{
|
||||
static struct file_server_data *server_data = NULL;
|
||||
|
||||
/* Validate file storage base path */
|
||||
if (!base_path || strcmp(base_path, "/spiffs") != 0) {
|
||||
ESP_LOGE(TAG, "File server presently supports only '/spiffs' as base path");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (server_data) {
|
||||
ESP_LOGE(TAG, "File server already started");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
|
Reference in New Issue
Block a user