aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/stm32f2-f4
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2014-10-15 14:55:56 +0800
committerbryan newbold <bnewbold@twinleaf.com>2014-11-24 15:17:24 -0800
commita6f3db0f21ccb6069240701fb08e9de2b6d2ca7b (patch)
tree814d6f387b8f797f6a849dea69fef9af7ed97db2 /libmaple/stm32f2-f4
parent9daa30c70e3eaf4a95c42f6de055bb6797044c4e (diff)
downloadlibrambutan-a6f3db0f21ccb6069240701fb08e9de2b6d2ca7b.tar.gz
librambutan-a6f3db0f21ccb6069240701fb08e9de2b6d2ca7b.zip
stm32f2-f4: refactor <series/stm32.h>
Prep work for adding F4 support. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/stm32f2-f4')
-rw-r--r--libmaple/stm32f2-f4/include/series/stm32.h50
1 files changed, 28 insertions, 22 deletions
diff --git a/libmaple/stm32f2-f4/include/series/stm32.h b/libmaple/stm32f2-f4/include/series/stm32.h
index 180ab30..9549b62 100644
--- a/libmaple/stm32f2-f4/include/series/stm32.h
+++ b/libmaple/stm32f2-f4/include/series/stm32.h
@@ -37,37 +37,43 @@ extern "C" {
#endif
/*
- * Chip configuration
+ * MCU-specific values
*/
-#ifndef STM32_PCLK1
-#define STM32_PCLK1 30000000U
-#endif
-
-#ifndef STM32_PCLK2
-#define STM32_PCLK2 60000000U
-#endif
-
-#ifndef STM32_DELAY_US_MULT
-#define STM32_DELAY_US_MULT 20 /* FIXME: dummy value. */
+#if defined(MCU_STM32F207IC) || defined(MCU_STM32F207IG)
+# define STM32_MCU_SERIES STM32_SERIES_F2
+# define STM32_NR_GPIO_PORTS 9
+# define STM32_TIMER_MASK 0x7FFE /* TIMER1-TIMER14. */
+# define STM32_SRAM_END ((void*)0x20020000)
+#else
+#warning "Unsupported or unspecified STM32F2 MCU."
#endif
/*
- * Series- and MCU-specific values
+ * Series-specific values
*/
-#define STM32_MCU_SERIES STM32_SERIES_F2
-#define STM32_NR_INTERRUPTS 81
-#define STM32_HAVE_FSMC 1
-#define STM32_HAVE_USB 1
-#define STM32_HAVE_DAC 1
+#if STM32_MCU_SERIES == STM32_SERIES_F2
+# define STM32_NR_INTERRUPTS 81
+# define STM32_HAVE_FSMC 1
+# define STM32_HAVE_USB 1
+# define STM32_HAVE_DAC 1
-#if defined(MCU_STM32F207IC) || defined(MCU_STM32F207IG)
-# define STM32_NR_GPIO_PORTS 9
-# define STM32_TIMER_MASK 0x7FFE /* TIMER1-TIMER14. */
-# define STM32_SRAM_END ((void*)0x20020000)
+# ifndef STM32_PCLK1
+# define STM32_PCLK1 30000000U
+# endif
+
+# ifndef STM32_PCLK2
+# define STM32_PCLK2 60000000U
+# endif
+
+# ifndef STM32_DELAY_US_MULT
+# define STM32_DELAY_US_MULT 20 /* FIXME: dummy value. */
+# endif
+#elif STM32_MCU_SERIES == STM32_SERIES_F4
+# error "STM32F4 support is unimplemented"
#else
-#warning "Unsupported or unspecified STM32F2 MCU."
+# error "Invalid STM32 series for this header"
#endif
#ifdef __cplusplus