Skip to content

Commit a0489e1

Browse files
committed
Prevent system hanging when writing to UART before enabling.
1 parent b978788 commit a0489e1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cores/nRF5/Uart.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ int Uart::read()
224224

225225
size_t Uart::write(const uint8_t data)
226226
{
227+
if (!nrfUart->ENABLE) {
228+
return 0;
229+
}
230+
227231
nrfUart->TXD = data;
228232

229233
while(!nrfUart->EVENTS_TXDRDY);

0 commit comments

Comments
 (0)