HAL: fix - use HAL_GPIO_INDEX to know the pin number
@@ -162,10 +162,11 @@ hal_gpio_deinit(int pin)
{
uint32_t conf;
NRF_GPIO_Type *port;
+ int pin_index = HAL_GPIO_INDEX(pin);
conf = GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos;
port = HAL_GPIO_PORT(pin);
- port->PIN_CNF[pin] = conf;
+ port->PIN_CNF[pin_index] = conf;
port->DIRCLR = HAL_GPIO_MASK(pin);
return 0;
