Skip to content

Commit 45f43b6

Browse files
committed
change text W7500x_gpio.c GPIO_Mode_OUT, HAL_GPIO_SetBits, HAL_GPIO_ResetBits
1 parent 25019df commit 45f43b6

File tree

1 file changed

+9
-5
lines changed
  • targets/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library

1 file changed

+9
-5
lines changed

targets/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_gpio.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void HAL_GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
8181
{
8282
if(GPIO_InitStruct->GPIO_Mode == GPIO_Mode_OUT)
8383
{
84-
GPIOx->OUTENSET |= pos;
84+
GPIOx->OUTENSET = pos;
8585
}
8686
else // GPIO_Mode_In
8787
{
@@ -199,8 +199,10 @@ void HAL_GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
199199
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
200200
assert_param(IS_GPIO_PIN(GPIO_Pin));
201201

202-
(GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = GPIO_Pin;
203-
(GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]) = GPIO_Pin;
202+
if (GPIO_Pin < 256)
203+
(GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0xFFFF;
204+
else
205+
(GPIOx->UB_MASKED[(uint8_t) ((GPIO_Pin) >> 8)]) = 0xFFFF;
204206
}
205207

206208
void HAL_GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
@@ -209,8 +211,10 @@ void HAL_GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
209211
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
210212
assert_param(IS_GPIO_PIN(GPIO_Pin));
211213

212-
(GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = ~(GPIO_Pin);
213-
(GPIOx->UB_MASKED[(uint8_t)(GPIO_Pin>>8)]) = ~(GPIO_Pin);
214+
if (GPIO_Pin < 256)
215+
(GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0x0;
216+
else
217+
(GPIOx->UB_MASKED[(uint8_t) (GPIO_Pin >> 8)]) = 0x0;
214218
}
215219

216220
void HAL_GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)

0 commit comments

Comments
 (0)