You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2024/03/16 16:09:21 UTC
(mynewt-core) 01/04: mcu/pic32: Add missing hal_gpio_deinit function
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 4f07cb8a0150058e34a2103b6c28de35ec95fa5e
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Mar 15 12:26:56 2024 +0100
mcu/pic32: Add missing hal_gpio_deinit function
One of hal_gpio functions was not implemented and
now it is added like for other MCU's
Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
hw/mcu/microchip/pic32mz/src/hal_gpio.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/mcu/microchip/pic32mz/src/hal_gpio.c b/hw/mcu/microchip/pic32mz/src/hal_gpio.c
index e2b817271..6ff45af57 100644
--- a/hw/mcu/microchip/pic32mz/src/hal_gpio.c
+++ b/hw/mcu/microchip/pic32mz/src/hal_gpio.c
@@ -347,6 +347,21 @@ hal_gpio_init_out(int pin, int val)
return 0;
}
+int
+hal_gpio_deinit(int pin)
+{
+ uint32_t port = GPIO_PORT(pin);
+ uint32_t mask = GPIO_MASK(pin);
+
+ /* Disable pull-up, pull-down and open drain */
+ CNPUxCLR(port) = mask;
+ CNPDxCLR(port) = mask;
+ ODCxCLR(port) = mask;
+
+ /* Configure pin direction as input */
+ TRISxSET(port) = mask;
+}
+
void
hal_gpio_write(int pin, int val)
{