Skip to content

Commit e3d1ed4

Browse files
authored
Merge pull request #3936 from thread-liu/liukang
[update] stm32mp1 pin-index
2 parents aa05fc1 + 076e33a commit e3d1ed4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bsp/stm32/libraries/HAL_Drivers/drv_gpio.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121
#define PIN_PORT(pin) ((uint8_t)(((pin) >> 4) & 0xFu))
2222
#define PIN_NO(pin) ((uint8_t)((pin) & 0xFu))
2323

24+
#if defined(SOC_SERIES_STM32MP1)
25+
#if defined(GPIOZ)
26+
#define gpioz_port_base (175) /* PIN_STPORT_MAX * 16 - 16 */
27+
#define PIN_STPORT(pin) ((pin > gpioz_port_base) ? ((GPIO_TypeDef *)(GPIOZ_BASE )) : ((GPIO_TypeDef *)(GPIOA_BASE + (0x1000u * PIN_PORT(pin)))))
28+
#else
29+
#define PIN_STPORT(pin) ((GPIO_TypeDef *)(GPIOA_BASE + (0x1000u * PIN_PORT(pin)))))
30+
#endif /* GPIOZ */
31+
#else
2432
#define PIN_STPORT(pin) ((GPIO_TypeDef *)(GPIOA_BASE + (0x400u * PIN_PORT(pin))))
33+
#endif /* SOC_SERIES_STM32MP1 */
34+
2535
#define PIN_STPIN(pin) ((uint16_t)(1u << PIN_NO(pin)))
2636

2737
#if defined(GPIOZ)

0 commit comments

Comments
 (0)