Skip to content

Commit 1e75d5d

Browse files
nvlsianpurlubos
authored andcommitted
[nrf noup] boot/zephyr/nrf_cleanup: cleanup uarte pins
Added procedure which does configure UARTE pins to the default states. This allows to reduce power consumption if pin is floating. clean-up UARTE only if its driver was enabled Signed-off-by: Andrzej Puzdrowski <[email protected]> (cherry picked from commit bc7bc71)
1 parent 22c2cac commit 1e75d5d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

boot/zephyr/nrf_cleanup.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#endif
1010
#include <hal/nrf_uarte.h>
1111
#include <haly/nrfy_uarte.h>
12+
#include <haly/nrfy_gpio.h>
1213
#if defined(NRF_RTC0) || defined(NRF_RTC1) || defined(NRF_RTC2)
1314
#include <hal/nrf_rtc.h>
1415
#endif
@@ -96,6 +97,21 @@ void nrf_cleanup_peripheral(void)
9697
nrfy_uarte_event_clear(current, NRF_UARTE_EVENT_RXTO);
9798
nrfy_uarte_disable(current);
9899

100+
uint32_t pin[4];
101+
102+
pin[0] = nrfy_uarte_tx_pin_get(current);
103+
pin[1] = nrfy_uarte_rx_pin_get(current);
104+
pin[2] = nrfy_uarte_rts_pin_get(current);
105+
pin[3] = nrfy_uarte_cts_pin_get(current);
106+
107+
nrfy_uarte_pins_disconnect(current);
108+
109+
for (int j = 0; j < 4; j++) {
110+
if (pin[j] != NRF_UARTE_PSEL_DISCONNECTED) {
111+
nrfy_gpio_cfg_default(pin[i]);
112+
}
113+
}
114+
99115
#if defined(NRF_DPPIC)
100116
/* Clear all SUBSCRIBE configurations. */
101117
memset((uint8_t *)current + NRF_UARTE_SUBSCRIBE_CONF_OFFS, 0,

0 commit comments

Comments
 (0)