1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/sensebox_samd21: make use of mtd_sdcard_default

This commit is contained in:
Benjamin Valentin 2023-01-30 14:24:10 +01:00
parent d2988b00ac
commit b71b097be4
5 changed files with 15 additions and 38 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -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