From 2a69c6d2cc2fa98ccb01a09f00913cd98131602a Mon Sep 17 00:00:00 2001 From: TeddyWiz Date: Mon, 20 May 2019 16:56:48 +0900 Subject: [PATCH] change W7500x_gpio.c GPIO_WriteBit --- .../W7500x_Peripheral_Library/W7500x_gpio.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/targets/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_gpio.c b/targets/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_gpio.c index 54b31e3c54..dddaa9fa22 100644 --- a/targets/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_gpio.c +++ b/targets/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_gpio.c @@ -230,15 +230,19 @@ void HAL_GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal) temp_gpio_lb = (GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]); temp_gpio_ub = (GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]); - if( BitVal == Bit_SET) + if (GPIO_Pin < 256) { - (GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = (temp_gpio_lb | GPIO_Pin); - (GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]) = (temp_gpio_ub | GPIO_Pin); + if(BitVal) + (GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0xFFFF; + else + (GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0x0; } else { - (GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = (temp_gpio_lb & ~(GPIO_Pin)); - (GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]) = (temp_gpio_ub & ~(GPIO_Pin)); + if(BitVal) + (GPIOx->UB_MASKED[(uint8_t) (GPIO_Pin)]) = 0xFFFF; + else + (GPIOx->UB_MASKED[(uint8_t) (GPIO_Pin)]) = 0x0; } }