nanoI2CSlaveExpander
ARDUINO Nano v3 used as I2C slace digital and analog io expander for ESP8266 and others...
debugSerialPort.h
Go to the documentation of this file.
1 /**
2 * @file debugSerialPort.h
3 * @author J.SORANZO
4 * @date about september 2018
5 * @copyright 2018 CC0
6 * @version gitversionning
7 * @brief all macros that i use tu print debug message on ARUDINO
8 */
9 
10 #ifndef DEBUGSERIALPORT_H
11 #define DEBUGSERIALPORT_H
12 
13 /**
14 * @def DEBUG
15 Debug mode switch. If it is defined we are in debug mode
16 
17 else we ar in no debug mode
18 */
19 // #define DEBUG
20 //comment to pass in non debug mode
21 
22 /**
23 * @def DEBUGPORT
24 The name of the serial port to display debug message
25 * @def DEBUGSPEED
26 the speed in bauds of the debug port
27 */
28 #define DEBUGPORT Serial
29 #define DEBUGSPEED 9600
30 
31 /**
32 * @def sp(X)
33 sp macro for Serial.print
34 * @def spl(X)
35 for Serial.println
36 */
37 #define sp(X) DEBUGPORT.print(X)
38 #define spl(X) DEBUGPORT.println(X)
39 
40 #ifdef DEBUG
41 #define DSP(X) sp(X)
42 #define DSPL(X) spl(X)
43 #define DSPF(X) sp(F(X))
44 #define DSPLF(X) spl(F(X))
45 #else
46 #define DSP(X)
47 #define DSPL(X)
48 #define DSPF(X)
49 #define DSPLF(X)
50 #endif
51 
52 #ifdef DEBUG
53 /**
54 * @def DEFDPROMPT(X)
55 * @brief define the dPrompt String variable
56 
57 Define the dPrompt String. I use to display a prompt before debug message
58 This allow to know wher i am in the code.
59 
60 Generaly i use it at the begining of the function that i want to debug
61 */
62 #define DEFDPROMPT(X) String dPrompt = F("<Volab "); \
63  dPrompt += X; dPrompt += F(" : > ");
64 #else
65 #define DEFDPROMPT(X) String dPrompt = "";
66 #endif
67 
68 #endif
69