diff --git a/boards/sensebox_samd21/Kconfig b/boards/sensebox_samd21/Kconfig index d5965d20c2..3ef03391db 100644 --- a/boards/sensebox_samd21/Kconfig +++ b/boards/sensebox_samd21/Kconfig @@ -23,4 +23,7 @@ config BOARD_SENSEBOX_SAMD21 select HAVE_SAUL_GPIO + select HAVE_MTD_SDCARD_DEFAULT + select MODULE_FATFS_VFS if MODULE_VFS_DEFAULT + source "$(RIOTBOARD)/common/samdx1-arduino-bootloader/Kconfig" diff --git a/boards/sensebox_samd21/Makefile.dep b/boards/sensebox_samd21/Makefile.dep index 716e2eadfb..f9febd99fd 100644 --- a/boards/sensebox_samd21/Makefile.dep +++ b/boards/sensebox_samd21/Makefile.dep @@ -2,5 +2,15 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio endif +ifneq (,$(filter mtd,$(USEMODULE))) + USEMODULE += mtd_sdcard_default +endif + +# default to using fatfs on SD card +ifneq (,$(filter vfs_default,$(USEMODULE))) + USEMODULE += fatfs_vfs + USEMODULE += mtd +endif + # setup the samd21 arduino bootloader related dependencies include $(RIOTBOARD)/common/samdx1-arduino-bootloader/Makefile.dep diff --git a/boards/sensebox_samd21/Makefile.features b/boards/sensebox_samd21/Makefile.features index 1d1fab2539..1d7ed3da30 100644 --- a/boards/sensebox_samd21/Makefile.features +++ b/boards/sensebox_samd21/Makefile.features @@ -13,6 +13,7 @@ FEATURES_PROVIDED += periph_usbdev # Put other features for this board (in alphabetical order) FEATURES_PROVIDED += highlevel_stdio +FEATURES_PROVIDED += sdcard_spi # This configuration enables modules that are only available when using Kconfig # module modelling diff --git a/boards/sensebox_samd21/board.c b/boards/sensebox_samd21/board.c index 918bd4b14a..ee3a7df0bb 100644 --- a/boards/sensebox_samd21/board.c +++ b/boards/sensebox_samd21/board.c @@ -21,26 +21,6 @@ #include "cpu.h" #include "board.h" #include "periph/gpio.h" -#include "sdcard_spi_params.h" -#include "mtd_sdcard.h" - -#if defined(MODULE_MTD_SDCARD) || defined(DOXYGEN) - /* this is provided by the sdcard_spi driver - * see drivers/sdcard_spi/sdcard_spi.c */ -extern sdcard_spi_t sdcard_spi_devs[ARRAY_SIZE(sdcard_spi_params)]; -mtd_sdcard_t sensebox_sd_dev = { - .base = { - .driver = &mtd_sdcard_driver, - .page_size = MTD_SD_CARD_PAGE_SIZE, - .pages_per_sector = MTD_SD_CARD_PAGES_PER_SECTOR, - .sector_count = MTD_SD_CARD_SECTOR_COUNT - }, - .sd_card = &sdcard_spi_devs[0], - .params = &sdcard_spi_params[0] -}; - -mtd_dev_t *mtd0 = (mtd_dev_t *)&sensebox_sd_dev; -#endif /* MODULE_MTD_SDCARD || DOXYGEN */ void board_init(void) { diff --git a/boards/sensebox_samd21/include/board.h b/boards/sensebox_samd21/include/board.h index d2a069d138..ec875cc9ff 100644 --- a/boards/sensebox_samd21/include/board.h +++ b/boards/sensebox_samd21/include/board.h @@ -25,7 +25,7 @@ #include "cpu.h" #include "periph_conf.h" #include "periph_cpu.h" -#include "mtd_sdcard.h" +#include "mtd.h" #ifdef __cplusplus extern "C" { @@ -170,23 +170,6 @@ extern "C" { extern mtd_dev_t *mtd0; #define MTD_0 mtd0 /** @} */ - -/** - * @brief Attributes for the mtd_sdcard driver - * @{ - */ -#ifndef MTD_SD_CARD_PAGE_SIZE -#define MTD_SD_CARD_PAGE_SIZE (512) -#endif - -#ifndef MTD_SD_CARD_PAGES_PER_SECTOR -#define MTD_SD_CARD_PAGES_PER_SECTOR (128) -#endif - -#ifndef MTD_SD_CARD_SECTOR_COUNT -#define MTD_SD_CARD_SECTOR_COUNT (3921920UL) -#endif -/** @} */ #endif /* MODULE_MTD_SDCARD || DOXYGEN */ #ifdef __cplusplus