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

boards/waspmote-pro: add sdcard configuration

This commit is contained in:
J. David Ibáñez 2022-09-23 18:09:12 +02:00 committed by GitHub
parent 2e238859fc
commit 1ce7537d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 1 deletions

View File

@ -11,11 +11,19 @@ config BOARD_WASPMOTE_PRO
bool
default y
select CPU_MODEL_ATMEGA1281
select HAS_ARDUINO
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_ARDUINO
select HAS_SDCARD_SPI
select HAVE_MTD_SDCARD
select HAVE_SDCARD_SPI
select MODULE_FATFS_VFS if MODULE_VFS_DEFAULT
select MODULE_MTD if MODULE_VFS_DEFAULT
select MODULE_SDCARD_SPI if MODULE_MTD
source "$(RIOTKCONFIG)/Kconfig.ztimer_only"

View File

@ -2,4 +2,14 @@
# USEMODULE += saul_gpio
#endif
ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += mtd_sdcard
endif
# default to using fatfs on SD card
ifneq (,$(filter vfs_default,$(USEMODULE)))
USEMODULE += fatfs_vfs
USEMODULE += mtd
endif
include $(RIOTMAKE)/boards/ztimer_only.dep.mk

View File

@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += sdcard_spi
# Various other features (if any)
FEATURES_PROVIDED += arduino

View File

@ -25,6 +25,35 @@
#include "board.h"
#include "cpu.h"
#if defined(MODULE_MTD_SDCARD)
#include "mtd_sdcard.h"
#include "sdcard_spi.h"
#include "sdcard_spi_params.h"
#if defined(MODULE_FATFS_VFS)
#include "fs/fatfs.h"
#include "vfs_default.h"
#endif
/* 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 mtd_sdcard_dev = {
.base = {
.driver = &mtd_sdcard_driver,
},
.sd_card = &sdcard_spi_devs[0],
.params = &sdcard_spi_params[0]
};
mtd_dev_t *mtd0 = (mtd_dev_t *)&mtd_sdcard_dev;
#if IS_USED(MODULE_FATFS_VFS)
VFS_AUTO_MOUNT(fatfs, VFS_MTD(mtd_sdcard_dev), VFS_DEFAULT_SD(0), 0);
#endif /* MODULE_FATFS_VFS */
#endif /* MODULE_MTD_SDCARD */
void board_init(void)
{
/* initialize UART_1 on AUX1 */

View File

@ -21,6 +21,7 @@
#define BOARD_H
#include "cpu.h"
#include "mtd.h"
#include "waspmote_pinmap.h"
#ifdef __cplusplus
@ -180,6 +181,27 @@ extern "C" {
#define CONFIG_ZTIMER_USEC_WIDTH (16)
/** @} */
/**
* @name Onboard micro-sd slot pin definitions
* @{
*/
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0) /**< SPI device */
#define SDCARD_SPI_PARAM_CS SD_SS /**< Chip Select */
#define SDCARD_SPI_PARAM_CLK SD_SCK /**< Serial Clock */
#define SDCARD_SPI_PARAM_MOSI SD_MOSI /**< Master Output, Slave Input */
#define SDCARD_SPI_PARAM_MISO SD_MISO /**< Master Input, Slave Output */
#define SDCARD_SPI_PARAM_POWER MEM_PW /**< Powen on/off */
#define SDCARD_SPI_PARAM_POWER_AH (true) /**< Power on with power pin high */
#define CARD_DETECT_PIN SD_PRESENT /**< Pin for card detect */
/** @} */
/** Default MTD device */
#define MTD_0 mtd0
/** mtd flash emulation device */
extern mtd_dev_t *mtd0;
#ifdef __cplusplus
}
#endif