You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/02/05 09:41:22 UTC
[GitHub] andrzej-kaczmarek commented on a change in pull request #1630: Hal
gpio deinit
andrzej-kaczmarek commented on a change in pull request #1630: Hal gpio deinit
URL: https://github.com/apache/mynewt-core/pull/1630#discussion_r253790455
##########
File path: hw/mcu/nordic/nrf52xxx/src/hal_gpio.c
##########
@@ -139,6 +139,27 @@ hal_gpio_init_out(int pin, int val)
return 0;
}
+/**
+ * Deinitialize the specified pin to revert the previous initialization
+ *
+ * @param pin Pin number to unset
+ *
+ * @return int 0: no error; -1 otherwise.
+ */
+int
+hal_gpio_deinit(int pin)
+{
+ uint32_t conf;
+ NRF_GPIO_Type *port;
+
+ conf = GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos;
+ port = HAL_GPIO_PORT(pin);
+ port->PIN_CNF[pin] = conf;
Review comment:
you need to use `HAL_GPIO_INDEX` here for this to work properly on nRF52840
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services