PicoLowLevel
Loading...
Searching...
No Matches
SerialDebug Class Reference

Debug class that allows a finer control over serial debug. More...

#include <Debug.h>

Public Member Functions

 SerialDebug (HardwareSerial *serial=&Serial)
 
void print (String st, Levels level)
 Sends a string to the Serial port with a debug level, only if it is lower than the setted one.
 
void println (String st, Levels level)
 Sends a line to the serial port with a debug level, only if it is lower than the setted one.
 
void print (String st)
 Sends a debug string to the serial port, only debug is accepted.
 
void println (String st)
 Sends a debug line to the serial port, only debug is accepted.
 
template<class T >
void print (T any, Levels level)
 
template<class T >
void println (T any, Levels level)
 
template<class T >
void print (T any)
 
template<class T >
void println (T any)
 
void delayd (int t)
 Delay used only in debug.
 
void setLevel (Levels lvl)
 Sets the level to be used for the debug.
 
void setSerial (HardwareSerial *serial)
 

Detailed Description

Debug class that allows a finer control over serial debug.

Any message can have a level given by the Levels enum. Only messages with level lower than the one set by using setLevel(Levels lvl) are printed. The level is also written before the message in the serial output so even when all levels are being printed it's easy to distinguish and eventually remove unnecessary output.

Constructor & Destructor Documentation

◆ SerialDebug()

SerialDebug::SerialDebug ( HardwareSerial *  serial = &Serial)
inline

Member Function Documentation

◆ delayd()

void SerialDebug::delayd ( int  t)

Delay used only in debug.

This should be used to avoid errors while running in competition.

Parameters
tTime to wait in microseconds.

◆ print() [1/4]

void SerialDebug::print ( String  st)

Sends a debug string to the serial port, only debug is accepted.

The debug level will be sent only if it's a new line.

Parameters
stString to print.
Here is the call graph for this function:

◆ print() [2/4]

void SerialDebug::print ( String  st,
Levels  level 
)

Sends a string to the Serial port with a debug level, only if it is lower than the setted one.

The debug level will be sent only if it's a new line.

Parameters
stString to print.
levelDebug level.
Here is the caller graph for this function:

◆ print() [3/4]

template<class T >
void SerialDebug::print ( any)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [4/4]

template<class T >
void SerialDebug::print ( any,
Levels  level 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ println() [1/4]

void SerialDebug::println ( String  st)

Sends a debug line to the serial port, only debug is accepted.

The debug level will be sent only if it's a new line.

Parameters
stString to print.
Here is the call graph for this function:

◆ println() [2/4]

void SerialDebug::println ( String  st,
Levels  level 
)

Sends a line to the serial port with a debug level, only if it is lower than the setted one.

The debug level will be sent only if it's a new line.

Parameters
stString to print.
levelDebug level.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ println() [3/4]

template<class T >
void SerialDebug::println ( any)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ println() [4/4]

template<class T >
void SerialDebug::println ( any,
Levels  level 
)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLevel()

void SerialDebug::setLevel ( Levels  level)

Sets the level to be used for the debug.

Parameters
lvlDebug level.
Here is the caller graph for this function:

◆ setSerial()

void SerialDebug::setSerial ( HardwareSerial *  serial)

The documentation for this class was generated from the following files: