#ifndef SD_H
#define SD_H

#include <string.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#include "driver/sdmmc_host.h"

#define MOUNT_POINT "/sd"

extern sdmmc_card_t *card;

#define SD_PIN_CLK GPIO_NUM_39
#define SD_PIN_CMD GPIO_NUM_40
#define SD_PIN_D0  GPIO_NUM_38
#define SD_PIN_D1  GPIO_NUM_45
#define SD_PIN_D2  GPIO_NUM_42
#define SD_PIN_D3  GPIO_NUM_41

/// @brief Initializes the SD card
///
/// This requires the char_lcd to have been initialized.
/// @return true if the sd card was successfully initialized
bool init_sd();

/// @brief Unmounts the sd card
void deinit_sd();

#endif /* SD_H */