You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
810 B
43 lines
810 B
#ifndef STORAGE_H
|
|
#define STORAGE_H
|
|
|
|
#include "driver/sdmmc_types.h"
|
|
#include "driver/sdspi_host.h"
|
|
#include "esp_err.h"
|
|
#include "esp_vfs_fat.h"
|
|
#include "gpio-expander.h"
|
|
|
|
#define MAX_OPEN_FILES (8)
|
|
|
|
namespace gay_ipod {
|
|
|
|
static const char *STORAGE_PATH = "/sd";
|
|
|
|
class SdStorage {
|
|
public:
|
|
SdStorage(GpioExpander *gpio);
|
|
~SdStorage();
|
|
|
|
esp_err_t Acquire(void);
|
|
esp_err_t Release(void);
|
|
|
|
// Not copyable or movable.
|
|
// TODO: maybe this could be movable?
|
|
SdStorage(const SdStorage&) = delete;
|
|
SdStorage& operator=(const SdStorage&) = delete;
|
|
|
|
private:
|
|
GpioExpander *gpio_;
|
|
|
|
// SPI and SD driver info
|
|
sdspi_dev_handle_t handle_;
|
|
sdmmc_host_t host_;
|
|
sdmmc_card_t card_;
|
|
|
|
// Filesystem info
|
|
FATFS *fs_ = nullptr;
|
|
};
|
|
|
|
} // namespace gay_ipod
|
|
|
|
#endif
|
|
|