aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/stm32.h
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-07-18 14:19:04 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-07-18 14:19:04 -0400
commitcb0f0b690e7b2fb33094df89b8f84141a7b7f377 (patch)
treec5076323fd9972c1552fc5b3d3290dfd2387c7b0 /libmaple/stm32.h
parent69d0f4424a5c9d2bba4ec7c8a69968d7ae034f77 (diff)
downloadlibrambutan-cb0f0b690e7b2fb33094df89b8f84141a7b7f377.tar.gz
librambutan-cb0f0b690e7b2fb33094df89b8f84141a7b7f377.zip
Add DELAY_US_MULT, for use in generalizing delay_us().
The delay_us() implementation multiplies its specified delay target by a fixed constant in order to turn it into a busy-loop. This magic number doesn't work properly when the clock configuration isn't the same as a stock LeafLabs board. Add DELAY_US_MULT to the MCU-specific configuration in stm32.h in order to allow other chips to use delay_us().
Diffstat (limited to 'libmaple/stm32.h')
-rw-r--r--libmaple/stm32.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libmaple/stm32.h b/libmaple/stm32.h
index d7e946e..9d2ed99 100644
--- a/libmaple/stm32.h
+++ b/libmaple/stm32.h
@@ -32,11 +32,16 @@
/* SRAM size, in bytes */
#define SRAM_SIZE 0x5000
+ /* Multiplier to convert microseconds into loop iterations in
+ * delay_us() (See delay.h) */
+ #define DELAY_US_MULT 12
+
#elif defined(MCU_STM32F103ZE)
/* e.g., LeafLabs Maple Native */
#define NR_GPIO_PORTS 7
#define SRAM_SIZE 0x10000
+ #define DELAY_US_MULT 12
#elif defined(MCU_STM32F103CB)
/* e.g., LeafLabs Maple Mini */
@@ -47,12 +52,14 @@
#define NR_GPIO_PORTS 3
#define SRAM_SIZE 0x5000
+ #define DELAY_US_MULT 12
#elif defined(MCU_STM32F103RE)
/* e.g., LeafLabs Maple RET6 edition */
#define NR_GPIO_PORTS 4
#define SRAM_SIZE 0x10000
+ #define DELAY_US_MULT 12
#else