aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/test-usart-dma.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/test-usart-dma.cpp b/examples/test-usart-dma.cpp
index 04117c3..d10dc68 100644
--- a/examples/test-usart-dma.cpp
+++ b/examples/test-usart-dma.cpp
@@ -35,9 +35,18 @@
// your purposes.
HardwareSerial *serial = &Serial2;
#define USART_DMA_DEV DMA1
+#if STM32_MCU_SERIES == STM32_SERIES_F1
// On STM32F1 microcontrollers (like what's on Maple and Maple Mini),
// dma tubes are channels.
#define USART_RX_DMA_TUBE DMA_CH6
+#elif (STM32_MCU_SERIES == STM32_SERIES_F2 || \
+ STM32_MCU_SERIES == STM32_SERIES_F4)
+// On STM32F2 and STM32F4 microcontrollers (Maple 2 will have an F4),
+// dma tubes are streams.
+#define USART_RX_DMA_TUBE DMA_S5
+#else
+#error "unsupported stm32 series"
+#endif
// The serial port will make a DMA request each time it receives data.
// This is the dma_request_src we use to tell the DMA tube to handle
// that DMA request.