ygaklk commented on a change in pull request #1630: Hal gpio deinit
URL: https://github.com/apache/mynewt-core/pull/1630#discussion_r254303880
 
 

 ##########
 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;
+    port->DIRCLR = HAL_GPIO_MASK(pin);
 
 Review comment:
   Agree, I have made a quick copy/paste of the init_out. Fixed by: 
https://github.com/apache/mynewt-core/pull/1630/commits/11a9c211abac17dde7e4ef663169ee94e92c6473

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to