Skip to content

Commit

Permalink
Prevent system hanging when writing to UART before enabling.
Browse files Browse the repository at this point in the history
  • Loading branch information
h2zero committed Feb 28, 2024
1 parent b978788 commit a0489e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cores/nRF5/Uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ int Uart::read()

size_t Uart::write(const uint8_t data)
{
if (!nrfUart->ENABLE) {
return 0;
}

nrfUart->TXD = data;

while(!nrfUart->EVENTS_TXDRDY);
Expand Down

0 comments on commit a0489e1

Please sign in to comment.