From 298a1a36ef8ccb1541262efe59b7e3fa3d1e2ce6 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 16 Dec 2019 10:25:55 +0100 Subject: [PATCH] boards/hifive1*: provide and configure SPI feature --- boards/hifive1/Makefile.features | 2 +- boards/hifive1/include/periph_conf.h | 17 +++++++++++++++++ boards/hifive1b/Makefile.features | 2 +- boards/hifive1b/include/periph_conf.h | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/boards/hifive1/Makefile.features b/boards/hifive1/Makefile.features index 37114ef73abf2..f3b75b1a13d1b 100644 --- a/boards/hifive1/Makefile.features +++ b/boards/hifive1/Makefile.features @@ -5,6 +5,6 @@ CPU_MODEL = fe310_g000 #FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_rtt -#FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart diff --git a/boards/hifive1/include/periph_conf.h b/boards/hifive1/include/periph_conf.h index 8aa21e0c8276b..597b93c1aa601 100644 --- a/boards/hifive1/include/periph_conf.h +++ b/boards/hifive1/include/periph_conf.h @@ -85,6 +85,23 @@ static const uart_conf_t uart_config[] = { #define UART_NUMOF ARRAY_SIZE(uart_config) /** @} */ +/** + * @name SPI device configuration + * + * @{ + */ +static const spi_conf_t spi_config[] = { + { + .addr = SPI1_CTRL_ADDR, + .mosi = GPIO_PIN(0, 3), /* D11 */ + .miso = GPIO_PIN(0, 4), /* D12 */ + .sclk = GPIO_PIN(0, 5), /* D13 */ + }, +}; + +#define SPI_NUMOF ARRAY_SIZE(spi_config) +/** @} */ + /** * @name RTT/RTC configuration * diff --git a/boards/hifive1b/Makefile.features b/boards/hifive1b/Makefile.features index 2f669e7ccb064..8709fbab99553 100644 --- a/boards/hifive1b/Makefile.features +++ b/boards/hifive1b/Makefile.features @@ -6,6 +6,6 @@ CPU_MODEL = fe310_g002 #FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_rtt -#FEATURES_PROVIDED += periph_spi +FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart diff --git a/boards/hifive1b/include/periph_conf.h b/boards/hifive1b/include/periph_conf.h index 7ea802c6e7f4f..e95262f32f593 100644 --- a/boards/hifive1b/include/periph_conf.h +++ b/boards/hifive1b/include/periph_conf.h @@ -86,6 +86,23 @@ static const uart_conf_t uart_config[] = { #define UART_NUMOF ARRAY_SIZE(uart_config) /** @} */ +/** + * @name SPI device configuration + * + * @{ + */ +static const spi_conf_t spi_config[] = { + { + .addr = SPI1_CTRL_ADDR, + .mosi = GPIO_PIN(0, 3), /* D11 */ + .miso = GPIO_PIN(0, 4), /* D12 */ + .sclk = GPIO_PIN(0, 5), /* D13 */ + }, +}; + +#define SPI_NUMOF ARRAY_SIZE(spi_config) +/** @} */ + /** * @name RTT/RTC configuration *