summaryrefslogtreecommitdiff
path: root/src/drivers/include/storage.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-02 21:52:59 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-02 21:52:59 +1000
commit26eb580043ad176bdc58d996f30d470e1073ef00 (patch)
treee499b1115108effe91c961452c1ee101d07beeac /src/drivers/include/storage.hpp
parent7d7f7755d17e1e0a2348d75d797097f166b70471 (diff)
downloadtangara-fw-26eb580043ad176bdc58d996f30d470e1073ef00.tar.gz
move driver includes into a subdir as well
Diffstat (limited to 'src/drivers/include/storage.hpp')
-rw-r--r--src/drivers/include/storage.hpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/drivers/include/storage.hpp b/src/drivers/include/storage.hpp
deleted file mode 100644
index 836bbbdc..00000000
--- a/src/drivers/include/storage.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2023 jacqueline <me@jacqueline.id.au>
- *
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-#pragma once
-
-#include <memory>
-
-#include "driver/sdmmc_types.h"
-#include "driver/sdspi_host.h"
-#include "esp_err.h"
-#include "esp_vfs_fat.h"
-#include "ff.h"
-#include "result.hpp"
-
-#include "gpios.hpp"
-
-namespace drivers {
-
-extern const char* kStoragePath;
-
-enum class SdState {
- kNotPresent,
- kNotFormatted,
- kNotMounted,
- kMounted,
-};
-
-class SdStorage {
- public:
- enum Error {
- FAILED_TO_INIT,
- /** We couldn't interact with the SD card at all. Is it missing? */
- FAILED_TO_READ,
- /** We couldn't mount the SD card. Is it formatted? */
- FAILED_TO_MOUNT,
- };
-
- static auto Create(IGpios& gpio) -> cpp::result<SdStorage*, Error>;
-
- SdStorage(IGpios& gpio,
- sdspi_dev_handle_t handle_,
- std::unique_ptr<sdmmc_host_t> host_,
- std::unique_ptr<sdmmc_card_t> card_,
- FATFS* fs_);
- ~SdStorage();
-
- auto HandleTransaction(sdspi_dev_handle_t handle, sdmmc_command_t* cmdinfo)
- -> esp_err_t;
-
- auto GetFs() -> FATFS*;
-
- // Not copyable or movable.
- SdStorage(const SdStorage&) = delete;
- SdStorage& operator=(const SdStorage&) = delete;
-
- private:
- IGpios& gpio_;
-
- // SPI and SD driver info
- sdspi_dev_handle_t handle_;
- std::unique_ptr<sdmmc_host_t> host_;
- std::unique_ptr<sdmmc_card_t> card_;
-
- // Filesystem info
- FATFS* fs_ = nullptr;
-};
-
-} // namespace drivers