浏览代码

Merge pull request #1582 from neverxie/stm32-f4xx-bsp

fixed two bugs in drv_gpio.c
ZYH 7 年之前
父节点
当前提交
ea0e9b259d
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      bsp/stm32f4xx-HAL/drivers/drv_gpio.c

+ 2 - 2
bsp/stm32f4xx-HAL/drivers/drv_gpio.c

@@ -32,7 +32,7 @@
 
 static GPIO_TypeDef * get_st_gpio(rt_uint16_t gpio_pin)
 {
-    switch(gpio_pin >> 8)
+    switch(gpio_pin & 0xFF00)
     {
     case A:
         #ifdef GPIOA
@@ -87,7 +87,7 @@ static GPIO_TypeDef * get_st_gpio(rt_uint16_t gpio_pin)
 
 static void drv_clock_enable(rt_uint16_t gpio_pin)
 {
-    switch(gpio_pin >> 8)
+    switch(gpio_pin & 0xFF00)
     {
     case A:
         #ifdef __HAL_RCC_GPIOA_CLK_ENABLE