Skip to content

Commit 2a69c6d

Browse files
committed
change W7500x_gpio.c GPIO_WriteBit
1 parent 45f43b6 commit 2a69c6d

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
@@ -230,15 +230,19 @@ void HAL_GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
230230
temp_gpio_lb = (GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]);
231231
temp_gpio_ub = (GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]);
232232

233-
if( BitVal == Bit_SET)
233+
if (GPIO_Pin < 256)
234234
{
235-
(GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = (temp_gpio_lb | GPIO_Pin);
236-
(GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]) = (temp_gpio_ub | GPIO_Pin);
235+
if(BitVal)
236+
(GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0xFFFF;
237+
else
238+
(GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0x0;
237239
}
238240
else
239241
{
240-
(GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = (temp_gpio_lb & ~(GPIO_Pin));
241-
(GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]) = (temp_gpio_ub & ~(GPIO_Pin));
242+
if(BitVal)
243+
(GPIOx->UB_MASKED[(uint8_t) (GPIO_Pin)]) = 0xFFFF;
244+
else
245+
(GPIOx->UB_MASKED[(uint8_t) (GPIO_Pin)]) = 0x0;
242246
}
243247
}
244248

0 commit comments

Comments
 (0)