aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-06-14 18:32:01 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-06-15 17:41:37 -0400
commitc5b954a8670abe277daa06f4eea2b48d761e3175 (patch)
tree05f8a7ded4f1e58a892c564b424b49688056ebb7 /examples
parente72e411c1f0e4f96326351264301c6e475206e30 (diff)
downloadlibrambutan-c5b954a8670abe277daa06f4eea2b48d761e3175.tar.gz
librambutan-c5b954a8670abe277daa06f4eea2b48d761e3175.zip
Port test-usart-dma.cpp for STM32F2.
Too ugly? Meh. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'examples')
-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.