gracefully end() uart, wait for TX & RX phy to power down before disable it
this save around 900uA of power consumption
This commit is contained in:
1 parent
3dda52f494
commit
798c390f66
1 file changed
+6
@@ -156,9 +156,15 @@ void Uart::end()
|
||||
|
||||
nrfUart->INTENCLR = UARTE_INTENSET_ENDRX_Msk | UARTE_INTENSET_ENDTX_Msk;
|
||||
|
||||
nrfUart->EVENTS_RXTO = 0;
|
||||
nrfUart->EVENTS_TXSTOPPED = 0;
|
||||
|
||||
nrfUart->TASKS_STOPRX = 0x1UL;
|
||||
nrfUart->TASKS_STOPTX = 0x1UL;
|
||||
|
||||
// Wait for TXSTOPPED event and for RXTO event
|
||||
while ( !(nrfUart->EVENTS_TXSTOPPED && nrfUart->EVENTS_RXTO) ) yield();
|
||||
|
||||
nrfUart->ENABLE = UARTE_ENABLE_ENABLE_Disabled;
|
||||
|
||||
nrfUart->PSEL.TXD = 0xFFFFFFFF;
|
||||
|
||||
Reference in new issue
Block a user