Skip to content

Commit

Permalink
REMOVEME: SAM0 test board
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Jul 2, 2023
1 parent 9d5d228 commit 114896e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions boards/adafruit-grand-central-m4-express/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ config BOARD_ADAFRUIT_GRAND_CENTRAL_M4_EXPRESS
select HAS_PERIPH_PWM
select HAS_PERIPH_RTC
select HAS_PERIPH_RTT
select HAS_PERIPH_SDMMC
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
Expand Down
7 changes: 6 additions & 1 deletion boards/adafruit-grand-central-m4-express/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ endif
ifneq (,$(filter mtd,$(USEMODULE)))
FEATURES_REQUIRED += periph_spi_on_qspi
USEMODULE += mtd_spi_nor
USEMODULE += mtd_sdcard_default
ifeq (,$(filter sdmmc,$(USEMODULE)))
USEMODULE += sam0_sdhc
else
USEMODULE += mtd_sdmmc_default
USEMODULE += periph_sdmmc
endif
endif

# setup the samd21 arduino bootloader related dependencies
Expand Down
1 change: 1 addition & 0 deletions boards/adafruit-grand-central-m4-express/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_sdmmc
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
Expand Down
29 changes: 29 additions & 0 deletions boards/adafruit-grand-central-m4-express/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,32 @@ VFS_AUTO_MOUNT(littlefs2, VFS_MTD(samd51_nor_dev), VFS_DEFAULT_NVM(0), 0);
#endif

#endif /* MODULE_MTD_SPI_NOR */

#ifdef MODULE_SAM0_SDHC

#include "mtd_sam0_sdhc.h"

static mtd_sam0_sdhc_t sdhc_dev = {
.base = {
.driver = &mtd_sam0_sdhc_driver,
},
.state = {
.dev = SDHC1,
.cd = GPIO_PIN(PB, 16),
.wp = GPIO_UNDEF,
},
};

mtd_dev_t *mtd1 = (mtd_dev_t *)&sdhc_dev;

#ifdef MODULE_VFS_DEFAULT
/* default to FAT */
#if defined(MODULE_FATFS_VFS)
VFS_AUTO_MOUNT(fatfs, VFS_MTD(sdhc_dev), VFS_DEFAULT_SD(0), 1);
/* but also support ext2/3/4 */
#elif defined(MODULE_LWEXT4)
VFS_AUTO_MOUNT(lwext4, VFS_MTD(sdhc_dev), VFS_DEFAULT_SD(0), 1);
#endif
#endif /* MODULE_VFS_DEFAULT */

#endif /* MODULE_SAM0_SDHC */
1 change: 1 addition & 0 deletions boards/adafruit-grand-central-m4-express/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extern mtd_dev_t *mtd1; /**< MTD device pointer for SD Card */
#define MTD_1 mtd1 /**< MTD device for SD Card */

#define CONFIG_SDCARD_GENERIC_MTD_OFFSET 1 /**< mtd1 is used for SD Card */
#define CONFIG_SDMMC_GENERIC_MTD_OFFSET 1 /**< mtd1 is used for SD Card */
/** @} */

/**
Expand Down
18 changes: 18 additions & 0 deletions boards/adafruit-grand-central-m4-express/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,24 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */

/**
* @name SDHC peripheral configuration
* @{
*/

/** SDHC devices */
static const sdhc_conf_t sdhc_config[] = {
{
.sdhc = SDHC1,
.cd = GPIO_PIN(PB, 16),
.wp = GPIO_UNDEF,
},
};

/** Number of configured SDHC devices */
#define SDHC_NUMOF ARRAY_SIZE(sdhc_config)
/** @} */

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 114896e

Please sign in to comment.