mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-04 19:59:55 +00:00
67e657f10f
cc @mc-hamster, this makes USE_SEGGER optional on nrf52 targets
24 lines
508 B
C++
24 lines
508 B
C++
#include "RedirectablePrint.h"
|
|
#include "configuration.h"
|
|
#include <assert.h>
|
|
|
|
/**
|
|
* A printer that doesn't go anywhere
|
|
*/
|
|
NoopPrint noopPrint;
|
|
|
|
void RedirectablePrint::setDestination(Print *_dest)
|
|
{
|
|
assert(_dest);
|
|
dest = _dest;
|
|
}
|
|
|
|
size_t RedirectablePrint::write(uint8_t c)
|
|
{
|
|
#ifdef SEGGER_STDOUT_CH
|
|
SEGGER_RTT_PutCharSkip(SEGGER_STDOUT_CH, c);
|
|
#endif
|
|
|
|
dest->write(c);
|
|
return 1; // We always claim one was written, rather than trusting what the serial port said (which could be zero)
|
|
} |