You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/11/22 02:18:32 UTC

[incubator-nuttx] branch master updated: nrf52 GPIO: fix setting of SENSE to pins; clear LATCH register on initialization

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 10d7d8e  nrf52 GPIO: fix setting of SENSE to pins; clear LATCH register on initialization
10d7d8e is described below

commit 10d7d8e9c3136ecc26971444ae399d85810d2c90
Author: Matias N <ma...@protobits.dev>
AuthorDate: Fri Nov 13 12:08:12 2020 -0300

    nrf52 GPIO: fix setting of SENSE to pins; clear LATCH register on initialization
---
 arch/arm/src/nrf52/nrf52_gpio.c   | 2 +-
 arch/arm/src/nrf52/nrf52_gpiote.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/nrf52/nrf52_gpio.c b/arch/arm/src/nrf52/nrf52_gpio.c
index 6aaff7f..6f5625c 100644
--- a/arch/arm/src/nrf52/nrf52_gpio.c
+++ b/arch/arm/src/nrf52/nrf52_gpio.c
@@ -184,7 +184,7 @@ static inline void nrf52_gpio_sense(nrf52_pinset_t cfgset,
     {
       regval |= GPIO_CNF_SENSE_HIGH;
     }
-  else
+  else if (mode == GPIO_SENSE_LOW)
     {
       regval |= GPIO_CNF_SENSE_LOW;
     }
diff --git a/arch/arm/src/nrf52/nrf52_gpiote.c b/arch/arm/src/nrf52/nrf52_gpiote.c
index 777b131..09fb743 100644
--- a/arch/arm/src/nrf52/nrf52_gpiote.c
+++ b/arch/arm/src/nrf52/nrf52_gpiote.c
@@ -532,6 +532,14 @@ void nrf52_gpiote_set_task(uint32_t pinset, int channel,
 
 int nrf52_gpiote_init(void)
 {
+  /* Clear LATCH register(s) */
+
+  putreg32(0, NRF52_GPIO_P0_BASE + NRF52_GPIO_LATCH_OFFSET);
+
+#ifdef CONFIG_NRF52_HAVE_PORT1
+  putreg32(0, NRF52_GPIO_P1_BASE + NRF52_GPIO_LATCH_OFFSET);
+#endif
+
   /* Reset GPIOTE data */
 
   memset(&g_gpiote_ch_callbacks, 0, sizeof(g_gpiote_ch_callbacks));