From 45f43b61fc2d38e4e00dea96a458d131f698f874 Mon Sep 17 00:00:00 2001 From: TeddyWiz Date: Mon, 20 May 2019 16:52:54 +0900 Subject: [PATCH] change text W7500x_gpio.c GPIO_Mode_OUT, HAL_GPIO_SetBits, HAL_GPIO_ResetBits --- .../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 76c9837d65..54b31e3c54 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 @@ -81,7 +81,7 @@ void HAL_GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { if(GPIO_InitStruct->GPIO_Mode == GPIO_Mode_OUT) { - GPIOx->OUTENSET |= pos; + GPIOx->OUTENSET = pos; } else // GPIO_Mode_In { @@ -199,8 +199,10 @@ void HAL_GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); assert_param(IS_GPIO_PIN(GPIO_Pin)); - (GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = GPIO_Pin; - (GPIOx->UB_MASKED[(uint8_t)((GPIO_Pin)>>8)]) = GPIO_Pin; + if (GPIO_Pin < 256) + (GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0xFFFF; + else + (GPIOx->UB_MASKED[(uint8_t) ((GPIO_Pin) >> 8)]) = 0xFFFF; } 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) assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); assert_param(IS_GPIO_PIN(GPIO_Pin)); - (GPIOx->LB_MASKED[(uint8_t)(GPIO_Pin)]) = ~(GPIO_Pin); - (GPIOx->UB_MASKED[(uint8_t)(GPIO_Pin>>8)]) = ~(GPIO_Pin); + if (GPIO_Pin < 256) + (GPIOx->LB_MASKED[(uint8_t) (GPIO_Pin)]) = 0x0; + else + (GPIOx->UB_MASKED[(uint8_t) (GPIO_Pin >> 8)]) = 0x0; } void HAL_GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)