8000 stmhal: L4: Modify mphalport to support L4 MCU. · micropython/micropython@dda1a41 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit dda1a41

Browse files
Tobias Badertscherdpgeorge
Tobias Badertscher
authored andcommitted
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.
1 parent 36d328e commit dda1a41

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

stmhal/mphalport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio) {
104104
} else if (gpio == GPIOH) {
105105
__GPIOH_CLK_ENABLE();
106106
#endif
107-
#ifdef __GPIOI_CLK_ENABLE
107+
#if defined(GPIOI) && defined(__GPIOI_CLK_ENABLE)
108108
} else if (gpio == GPIOI) {
109109
__GPIOI_CLK_ENABLE();
110110
#endif
111-
#ifdef __GPIOJ_CLK_ENABLE
111+
#if defined(GPIOJ) && defined(__GPIOJ_CLK_ENABLE)
112112
} else if (gpio == GPIOJ) {
113113
__GPIOJ_CLK_ENABLE();
114114
#endif
115-
#ifdef __GPIOK_CLK_ENABLE
115+
#if defined(GPIOK) && defined(__GPIOK_CLK_ENABLE)
116116
} else if (gpio == GPIOK) {
117117
__GPIOK_CLK_ENABLE();
118118
#endif

stmhal/mphalport.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7a10)
99
#elif defined(MCU_SERIES_F7)
1010
#define MP_HAL_UNIQUE_ID_ADDRESS (0x1ff0f420)
11+
#elif defined(MCU_SERIES_L4)
12+
#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7590)
1113
#else
1214
#error mphalport.h: Unrecognized MCU_SERIES
1315
#endif
1416

1517
// Basic GPIO functions
1618
#define GPIO_read_pin(gpio, pin) (((gpio)->IDR >> (pin)) & 1)
17-
#if defined(MCU_SERIES_F7)
19+
#if defined(MCU_SERIES_F7) || defined(MCU_SERIES_L4)
1820
#define GPIO_set_pin(gpio, pin_mask) (((gpio)->BSRR) = (pin_mask))
1921
#define GPIO_clear_pin(gpio, pin_mask) (((gpio)->BSRR) = ((pin_mask) << 16))
2022
#else

0 commit comments

Comments
 (0)
0