Skip to content

Change W7500 GPIO Driver #10617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -226,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;
}
}

Expand Down