From 8405fbe611cb91abeb92afef1b75f17dfaf70932 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 37114ef73a..f3b75b1a13 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 f64cf55331..4fb24d20df 100644 --- a/boards/hifive1/include/periph_conf.h +++ b/boards/hifive1/include/periph_conf.h @@ -109,6 +109,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 9ab282f177..503f701333 100644 --- a/boards/hifive1b/Makefile.features +++ b/boards/hifive1b/Makefile.features @@ -6,7 +6,7 @@ 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 dd5679a514..169fb91304 100644 --- a/boards/hifive1b/include/periph_conf.h +++ b/boards/hifive1b/include/periph_conf.h @@ -110,6 +110,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 *