diff --git a/boards/nucleo-f091rc/Makefile.dep b/boards/nucleo-f091rc/Makefile.dep index 729485827299c1a63e12514b30d4943aeea41c0d..a7e11adb3cd8c6b91303c4ec2a8d7891afe8c266 100644 --- a/boards/nucleo-f091rc/Makefile.dep +++ b/boards/nucleo-f091rc/Makefile.dep @@ -1 +1,3 @@ +FEATURES_REQUIRED += periph_dma + include $(RIOTBOARD)/common/nucleo/Makefile.dep diff --git a/boards/nucleo-f091rc/Makefile.features b/boards/nucleo-f091rc/Makefile.features index 2597c39f409e75f792495ef106af8e857a6b86ff..95ac5acc7afb99789f0985b1656ccb735c57dea1 100644 --- a/boards/nucleo-f091rc/Makefile.features +++ b/boards/nucleo-f091rc/Makefile.features @@ -1,5 +1,6 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc +FEATURES_PROVIDED += periph_dma FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc diff --git a/boards/nucleo-f091rc/include/periph_conf.h b/boards/nucleo-f091rc/include/periph_conf.h index 60c864f95380788b36f61cacea4021b73e320465..9938038ac878f3d672bd84ab0f8bc90d7de79435 100644 --- a/boards/nucleo-f091rc/include/periph_conf.h +++ b/boards/nucleo-f091rc/include/periph_conf.h @@ -56,6 +56,22 @@ extern "C" { #define CLOCK_PLL_MUL (6) /** @} */ +/** + * @name DMA streams configuration + * @{ + */ +#ifdef MODULE_PERIPH_DMA +static const dma_conf_t dma_config[] = { + { .stream = 1 }, + { .stream = 2 }, +}; + +#define DMA_SHARED_ISR_0 isr_dma1_ch2_3_dma2_ch1_2 +#define DMA_SHARED_ISR_0_STREAMS { 0, 1 } /* Indexes 0 and 1 of dma_config share the same isr */ + +#define DMA_NUMOF (sizeof(dma_config) / sizeof(dma_config[0])) +#endif + /** * @name Timer configuration * @{ @@ -88,7 +104,11 @@ static const uart_conf_t uart_config[] = { .rx_af = GPIO_AF1, .tx_af = GPIO_AF1, .bus = APB1, - .irqn = USART2_IRQn + .irqn = USART2_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 0, + .dma_chan = 0x9, +#endif }, { .dev = USART1, @@ -98,7 +118,11 @@ static const uart_conf_t uart_config[] = { .rx_af = GPIO_AF1, .tx_af = GPIO_AF1, .bus = APB2, - .irqn = USART1_IRQn + .irqn = USART1_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 0, + .dma_chan = 0x8, +#endif }, { .dev = USART3, @@ -108,7 +132,11 @@ static const uart_conf_t uart_config[] = { .rx_af = GPIO_AF1, .tx_af = GPIO_AF1, .bus = APB1, - .irqn = USART3_8_IRQn + .irqn = USART3_8_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 0, + .dma_chan = 0xA, +#endif }, }; @@ -153,7 +181,13 @@ static const spi_conf_t spi_config[] = { .cs_pin = GPIO_PIN(PORT_B, 6), .af = GPIO_AF0, .rccmask = RCC_APB2ENR_SPI1EN, - .apbbus = APB2 + .apbbus = APB2, +#ifdef MODULE_PERIPH_DMA + .tx_dma = 1, + .tx_dma_chan = 0, + .rx_dma = 0, + .rx_dma_chan = 0, +#endif } };