#ifndef _SD_MMC_SPI_IMPL_H_
#define _SD_MMC_SPI_IMPL_H_

#include "atmel_start.h"

// Example implementation for sd mmc
#define SD_MMC_SPI_nCS		PB28
#define SD_MMC_SPI_nCS_PORT GPIO_PORT(SD_MMC_SPI_nCS)
#define SD_MMC_SPI_nCS_PIN	GPIO_PIN(SD_MMC_SPI_nCS)

#define SD_MMC_SPI_CD		PA04
#define SD_MMC_SPI_CD_PIN	GPIO_PIN(SD_MMC_SPI_CD)
#define SD_MMC_SPI_CD_PORT	GPIO_PORT(SD_MMC_SPI_CD)

int32_t sd_mmc_spi_impl_init(void);

int32_t sd_mmc_spi_impl_read(uint8_t* const bytes, uint16_t len);

int32_t sd_mmc_spi_impl_write(const uint8_t* const bytes, uint16_t len);

int32_t sd_mmc_spi_impl_select_device();

int32_t sd_mmc_spi_impl_deselect_device();

bool sd_mmc_spi_impl_check_cd();

#endif
