TB2026-YDS Firmware
Loading...
Searching...
No Matches
storage.h
Go to the documentation of this file.
1
20#pragma once
21
22#include "esp_err.h"
23#include <stddef.h>
24#include <stdbool.h>
25#include <stdint.h>
26
33
35#define STORAGE_MAX_TRACKS 512
36
38#define STORAGE_PATH_MAX 320
39
50esp_err_t storage_init(void);
51
59esp_err_t storage_rescan(void);
60
69esp_err_t storage_unmount(void);
70
75bool storage_ready(void);
76
78size_t storage_count(void);
79
91esp_err_t storage_get_usage(uint64_t *total_bytes, uint64_t *used_bytes);
92
98const char *storage_track_path(size_t index);
99
105const char *storage_track_name(size_t index);
106
119esp_err_t storage_scan_dir(const char *root);
120
125esp_err_t storage_deinit(void);
126
const char * storage_track_name(size_t index)
Display name of a track (file name, no directory prefix).
Definition storage.c:197
esp_err_t storage_deinit(void)
Unmount the card and free the index.
Definition storage.c:207
const char * storage_track_path(size_t index)
Full POSIX path of a track, ready for decoder_open().
Definition storage.c:189
esp_err_t storage_scan_dir(const char *root)
Scan an arbitrary directory for playable tracks, rebuilding the index.
Definition storage.c:87
bool storage_ready(void)
Whether the card is mounted and a scan has completed.
Definition storage.c:169
esp_err_t storage_init(void)
Mount the SD card and scan its root for playable tracks.
Definition storage.c:117
size_t storage_count(void)
Number of tracks in the index (0 before any successful scan).
Definition storage.c:174
esp_err_t storage_get_usage(uint64_t *total_bytes, uint64_t *used_bytes)
Total and used size of the mounted FAT volume, in bytes.
Definition storage.c:179
esp_err_t storage_unmount(void)
Unmount the card and invalidate the index, after a card removal.
Definition storage.c:158
esp_err_t storage_rescan(void)
Re-scan the (already mounted) card root, rebuilding the track index.
Definition storage.c:142