diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-12 19:14:09 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-12 19:14:09 +1100 |
| commit | 8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de (patch) | |
| tree | 02b6cf23f591915747ec2994381854a79979c4a0 /src/drivers/spiffs.cpp | |
| parent | 8471046a95ab9e00f7d42b56dbbc9ce3e5b424b9 (diff) | |
| download | tangara-fw-8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de.tar.gz | |
Convert the main menu screen to lua lol
Diffstat (limited to 'src/drivers/spiffs.cpp')
| -rw-r--r-- | src/drivers/spiffs.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/drivers/spiffs.cpp b/src/drivers/spiffs.cpp new file mode 100644 index 00000000..9a85c0d3 --- /dev/null +++ b/src/drivers/spiffs.cpp @@ -0,0 +1,35 @@ +/* + * Copyright 2023 jacqueline <me@jacqueline.id.au> + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include "spiffs.hpp" + +#include "esp_err.h" +#include "esp_log.h" +#include "esp_spiffs.h" + +namespace drivers { + +[[maybe_unused]] static constexpr char kTag[] = "spiffs"; + +esp_err_t spiffs_mount() { + esp_vfs_spiffs_conf_t config{ + .base_path = "/lua", + .partition_label = "lua", + .max_files = 5, + .format_if_mount_failed = false, + }; + + esp_err_t res = esp_vfs_spiffs_register(&config); + if (res == ESP_OK) { + size_t total, used; + esp_spiffs_info("lua", &total, &used); + ESP_LOGI(kTag, "spiffs mounted okay. %d / %d ", used / 1024, total / 1024); + } + + return res; +} + +} // namespace drivers |
