From 9c8b3225efd5ee816ad840ea97ba7bb92ff17941 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 24 Apr 2012 05:01:28 -0400 Subject: stm32.h: Various updates, mostly to help STM32F1 line support. Add STM32_HAVE_USB feature test macro requirement for . This will let us test if we've got a USB peripheral. wirish/stm32f1/boards_setup.cpp is set up to use this when turning on USB CDC ACM support at init() time. Rework the STM32F1 to make it easier to support the various lines that subdivide that series. We don't really support anything besides performance line yet, but there's been enough enthusiasm for value and connectivity line support in the past that these hooks seem worth adding. This means adding an STM32_F1_LINE macro and STM32_F1_LINE_[PERFORMANCE,VALUE,ACCESS,CONNECTIVITY] macros for values that STM32_F1_LINE can take, and generalizing the rest of the file to begin taking this into account. Some TODOs remain, but filling these in is the responsibility of future libmaple porting efforts. One pleasant consequence of the F1 stm32.h rework is that the build system no longer has to tell us what density of F103 we're building for, so remove that from the relevant support/make/board-includes/ files. Add some tweaks to and the STM32F2 stm32.h header to make sure this went through properly, and continues to go through properly in the future. --- libmaple/include/libmaple/stm32.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libmaple/include') diff --git a/libmaple/include/libmaple/stm32.h b/libmaple/include/libmaple/stm32.h index d6f3304..d53af3a 100644 --- a/libmaple/include/libmaple/stm32.h +++ b/libmaple/include/libmaple/stm32.h @@ -58,9 +58,21 @@ extern "C" { * * - STM32_HAVE_FSMC: 1 if the MCU has the FSMC peripheral, and 0 * otherwise. + * + * - STM32_HAVE_USB: 1 if the MCU has a USB peripheral, and 0 + * otherwise. */ #include +/* Ensure the series header isn't broken. */ +#if (!defined(STM32_PCLK1) || !defined(STM32_PCLK2) || \ + !defined(STM32_MCU_SERIES) || !defined(STM32_NR_INTERRUPTS) || \ + !defined(STM32_NR_GPIO_PORTS) || !defined(STM32_DELAY_US_MULT) || \ + !defined(STM32_SRAM_END) || !defined(STM32_HAVE_FSMC) || \ + !defined(STM32_HAVE_USB)) +#error "Bad STM32F1 configuration. Check header for your MCU." +#endif + #ifdef __DOXYGEN_PREDEFINED_HACK /* -- cgit v1.2.3