summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTobias Badertscher <python@baerospace.ch>2016-03-22 17:21:05 +0100
committerDamien George <damien.p.george@gmail.com>2016-04-21 12:23:28 +0100
commitdda1a41205ce67c3e5f3e680f9a4359fc3f80f96 (patch)
treef25d6e45127e8f196b3c0de4703661255b525bc2
parent36d328e4513aec2cc870c2a1c3df84fb11122bd2 (diff)
downloadmicropython-dda1a41205ce67c3e5f3e680f9a4359fc3f80f96.tar.gz
micropython-dda1a41205ce67c3e5f3e680f9a4359fc3f80f96.zip
stmhal: L4: Modify mphalport to support L4 MCU.
__GPIOI_CLK_ENABLE is defined in hal/l4/inc/Legacy/stm32_hal_legacy.h as __HAL_RCC_GPIOI_CLK_ENABLE, and that latter macro is not defined anywhere else (because the L4 does not have port GPIOI). So the test for GPIOI is needed, along with the test for the CLK_ENABLE macro.
-rw-r--r--stmhal/mphalport.c6
-rw-r--r--stmhal/mphalport.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/stmhal/mphalport.c b/stmhal/mphalport.c
index 82a345b8ad..7a86989ffd 100644
--- a/stmhal/mphalport.c
+++ b/stmhal/mphalport.c
@@ -104,15 +104,15 @@ void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio) {
} else if (gpio == GPIOH) {
__GPIOH_CLK_ENABLE();
#endif
- #ifdef __GPIOI_CLK_ENABLE
+ #if defined(GPIOI) && defined(__GPIOI_CLK_ENABLE)
} else if (gpio == GPIOI) {
__GPIOI_CLK_ENABLE();
#endif
- #ifdef __GPIOJ_CLK_ENABLE
+ #if defined(GPIOJ) && defined(__GPIOJ_CLK_ENABLE)
} else if (gpio == GPIOJ) {
__GPIOJ_CLK_ENABLE();
#endif
- #ifdef __GPIOK_CLK_ENABLE
+ #if defined(GPIOK) && defined(__GPIOK_CLK_ENABLE)
} else if (gpio == GPIOK) {
__GPIOK_CLK_ENABLE();
#endif
diff --git a/stmhal/mphalport.h b/stmhal/mphalport.h
index 9bd4f4b4e8..65de2ab863 100644
--- a/stmhal/mphalport.h
+++ b/stmhal/mphalport.h
@@ -8,13 +8,15 @@
#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7a10)
#elif defined(MCU_SERIES_F7)
#define MP_HAL_UNIQUE_ID_ADDRESS (0x1ff0f420)
+#elif defined(MCU_SERIES_L4)
+#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7590)
#else
#error mphalport.h: Unrecognized MCU_SERIES
#endif
// Basic GPIO functions
#define GPIO_read_pin(gpio, pin) (((gpio)->IDR >> (pin)) & 1)
-#if defined(MCU_SERIES_F7)
+#if defined(MCU_SERIES_F7) || defined(MCU_SERIES_L4)
#define GPIO_set_pin(gpio, pin_mask) (((gpio)->BSRR) = (pin_mask))
#define GPIO_clear_pin(gpio, pin_mask) (((gpio)->BSRR) = ((pin_mask) << 16))
#else