nrf52 GPIO: fix setting of SENSE to pins; clear LATCH register on initialization

This commit is contained in:
Matias N 2020-11-13 12:08:12 -03:00 committed by Brennan Ashton
parent d118249566
commit 10d7d8e9c3
2 changed files with 9 additions and 1 deletions

View File

@ -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;
}

View File

@ -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));