diff --git a/boards/stm32f3discovery/Makefile.features b/boards/stm32f3discovery/Makefile.features index 38847eeda9..4dfa4fad14 100644 --- a/boards/stm32f3discovery/Makefile.features +++ b/boards/stm32f3discovery/Makefile.features @@ -1,2 +1,2 @@ FEATURES_PROVIDED += cpp -FEATURES_PROVIDED += periph_uart periph_gpio periph_pwm +FEATURES_PROVIDED += periph_uart periph_gpio periph_pwm periph_spi diff --git a/boards/stm32f3discovery/include/periph_conf.h b/boards/stm32f3discovery/include/periph_conf.h index 916db6d14f..9cdc8804ad 100644 --- a/boards/stm32f3discovery/include/periph_conf.h +++ b/boards/stm32f3discovery/include/periph_conf.h @@ -147,6 +147,56 @@ extern "C" { #define PWM_1_PIN_AF 2 /** @} */ +/** + * @name SPI configuration + * @{ + */ +#define SPI_NUMOF (2U) +#define SPI_0_EN 1 +#define SPI_1_EN 1 +#define SPI_IRQ_PRIO 1 + +/* SPI 0 device config */ +#define SPI_0_DEV SPI1 +#define SPI_0_CLKEN() (RCC->APB2ENR |= RCC_APB2ENR_SPI1EN) +#define SPI_0_CLKDIS() (RCC->APB2ENR &= ~RCC_APB2ENR_SPI1EN) +#define SPI_0_IRQ SPI1_IRQn +#define SPI_0_IRQ_HANDLER isr_spi1 +/* SPI 0 pin configuration */ +#define SPI_0_SCK_PORT GPIOA +#define SPI_0_SCK_PIN 5 +#define SPI_0_SCK_AF 5 +#define SPI_0_SCK_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN) +#define SPI_0_MISO_PORT GPIOA +#define SPI_0_MISO_PIN 6 +#define SPI_0_MISO_AF 5 +#define SPI_0_MISO_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN) +#define SPI_0_MOSI_PORT GPIOA +#define SPI_0_MOSI_PIN 7 +#define SPI_0_MOSI_AF 5 +#define SPI_0_MOSI_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOAEN) + +/* SPI 1 device config */ +#define SPI_1_DEV SPI3 +#define SPI_1_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_SPI3EN) +#define SPI_1_CLKDIS() (RCC->APB1ENR &= ~RCC_APB1ENR_SPI3EN) +#define SPI_1_IRQ SPI3_IRQn +#define SPI_1_IRQ_HANDLER isr_spi3 +/* SPI 1 pin configuration */ +#define SPI_1_SCK_PORT GPIOC +#define SPI_1_SCK_PIN 10 +#define SPI_1_SCK_AF 6 +#define SPI_1_SCK_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN) +#define SPI_1_MISO_PORT GPIOC +#define SPI_1_MISO_PIN 11 +#define SPI_1_MISO_AF 6 +#define SPI_1_MISO_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN) +#define SPI_1_MOSI_PORT GPIOC +#define SPI_1_MOSI_PIN 12 +#define SPI_1_MOSI_AF 6 +#define SPI_1_MOSI_PORT_CLKEN() (RCC->AHBENR |= RCC_AHBENR_GPIOCEN) +/** @} */ + /** * @brief GPIO configuration * @{