Browse Source

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.
pull/1921/merge
Tobias Badertscher 9 years ago
committed by Damien George
parent
commit
dda1a41205
  1. 6
      stmhal/mphalport.c
  2. 4
      stmhal/mphalport.h

6
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

4
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

Loading…
Cancel
Save