Skip to content

Commit

Permalink
GPIO: - Explicitly casts constants to uint32_t
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Dec 13, 2024
1 parent 9272d4b commit 8c72588
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion board/drivers/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void set_gpio_alternate(GPIO_TypeDef *GPIO, unsigned int pin, unsigned int mode)
void set_gpio_pullup(GPIO_TypeDef *GPIO, unsigned int pin, unsigned int mode) {
ENTER_CRITICAL();
uint32_t tmp = GPIO->PUPDR;
tmp &= ~(3U << (pin * 2U));
tmp &= ~((uint32_t)3U << ((uint32_t)(pin * 2U)));
tmp |= (mode << (pin * 2U));
register_set(&(GPIO->PUPDR), tmp, 0xFFFFFFFFU);
EXIT_CRITICAL();
Expand Down

0 comments on commit 8c72588

Please sign in to comment.