always print debug output to both serial and segger debug port

cc @mc-hamster, this  makes USE_SEGGER optional on nrf52 targets
1.2-legacy
Kevin Hester 2020-11-13 07:48:25 +08:00
rodzic 619a48085a
commit 67e657f10f
7 zmienionych plików z 21 dodań i 7 usunięć

Wyświetl plik

@ -1,4 +1,5 @@
#include "RedirectablePrint.h"
#include "configuration.h"
#include <assert.h>
/**
@ -10,4 +11,14 @@ 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)
}

Wyświetl plik

@ -19,7 +19,7 @@ class RedirectablePrint : public Print
*/
void setDestination(Print *dest);
virtual size_t write(uint8_t c) { return dest->write(c); }
virtual size_t write(uint8_t c);
};
class NoopPrint : public Print

Wyświetl plik

@ -404,8 +404,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Always include the SEGGER code on NRF52 - because useful for debugging
#include "SEGGER_RTT.h"
// The channel we send stdout data to
#define SEGGER_STDOUT_CH 0
// Debug printing to segger console
#define SEGGER_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
#define SEGGER_MSG(...) SEGGER_RTT_printf(SEGGER_STDOUT_CH, __VA_ARGS__)
// If we are not on a NRF52840 (which has built in USB-ACM serial support) and we don't have serial pins hooked up, then we MUST
// use SEGGER for debug output

Wyświetl plik

@ -233,8 +233,8 @@ RadioInterface *rIf = NULL;
void setup()
{
#ifdef USE_SEGGER
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_TRIM);
#ifdef SEGGER_STDOUT_CH
SEGGER_RTT_ConfigUpBuffer(SEGGER_STDOUT_CH, NULL, NULL, 1024, SEGGER_RTT_MODE_NO_BLOCK_TRIM);
#endif
// Debug

Wyświetl plik

@ -243,7 +243,7 @@ External serial flash WP25R1635FZUIL0
#define PIN_SPI_SCK (0 + 19)
// To debug via the segger JLINK console rather than the CDC-ACM serial device
#define USE_SEGGER
// #define USE_SEGGER
#ifdef __cplusplus
}

Wyświetl plik

@ -147,7 +147,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define SX1262_ANT_SW (32 + 10) // P1.10
// To debug via the segger JLINK console rather than the CDC-ACM serial device
#define USE_SEGGER
// #define USE_SEGGER
#ifdef __cplusplus
}

Wyświetl plik

@ -168,7 +168,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
#define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...)
// To debug via the segger JLINK console rather than the CDC-ACM serial device
#define USE_SEGGER
// #define USE_SEGGER
#ifdef __cplusplus
}