2011-03-08 22:13:54 +01:00
|
|
|
//*********************************************/
|
|
|
|
//
|
|
|
|
// File: debug.h
|
|
|
|
//
|
2011-08-31 10:34:51 +02:00
|
|
|
// Author: dlf (Metodo2 srl)
|
2011-03-08 22:13:54 +01:00
|
|
|
//
|
|
|
|
//********************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef Debug_H
|
|
|
|
#define Debug_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define PRINT_FILE_LINE() do { \
|
|
|
|
Serial.print("[");Serial.print(__FILE__); \
|
|
|
|
Serial.print("::");Serial.print(__LINE__);Serial.print("]");\
|
|
|
|
}while (0);
|
|
|
|
|
|
|
|
#ifdef _DEBUG_
|
|
|
|
|
2012-02-04 12:29:12 +01:00
|
|
|
#define INFO(format, args...) do { \
|
|
|
|
char buf[250]; \
|
|
|
|
sprintf(buf, format, args); \
|
|
|
|
Serial.println(buf); \
|
|
|
|
} while(0);
|
|
|
|
|
2011-04-05 23:24:17 +02:00
|
|
|
#define INFO1(x) do { PRINT_FILE_LINE() Serial.print("-I-");\
|
2011-03-08 22:13:54 +01:00
|
|
|
Serial.println(x); \
|
|
|
|
}while (0);
|
|
|
|
|
|
|
|
|
|
|
|
#define INFO2(x,y) do { PRINT_FILE_LINE() Serial.print("-I-");\
|
2011-04-05 23:24:17 +02:00
|
|
|
Serial.print(x,16);Serial.print(",");Serial.println(y,16); \
|
2011-03-08 22:13:54 +01:00
|
|
|
}while (0);
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define INFO1(x) do {} while(0);
|
2011-04-21 07:47:54 +02:00
|
|
|
#define INFO2(x,y) do {} while(0);
|
2011-03-08 22:13:54 +01:00
|
|
|
#define INFO(format, args...) do {} while(0);
|
|
|
|
#endif
|
|
|
|
|
2012-02-10 00:49:42 +01:00
|
|
|
#if 0
|
2011-03-08 22:13:54 +01:00
|
|
|
#define WARN(args) do { PRINT_FILE_LINE() \
|
|
|
|
Serial.print("-W-"); Serial.println(args); \
|
|
|
|
}while (0);
|
2012-02-10 00:49:42 +01:00
|
|
|
#else
|
|
|
|
#define WARN(args) do {} while (0);
|
|
|
|
#endif
|
2011-03-08 22:13:54 +01:00
|
|
|
|
2011-04-05 23:24:17 +02:00
|
|
|
#define DBG_PIN2 5
|
2011-03-08 22:13:54 +01:00
|
|
|
#define DBG_PIN 4
|
|
|
|
|
|
|
|
#define START() digitalWrite(DBG_PIN2, HIGH);
|
|
|
|
#define END() digitalWrite(DBG_PIN2, LOW);
|
|
|
|
#define SET_TRIGGER() digitalWrite(DBG_PIN, HIGH);
|
|
|
|
#define RST_TRIGGER() digitalWrite(DBG_PIN, LOW);
|
|
|
|
|
|
|
|
#define INIT_TRIGGER() pinMode(DBG_PIN, OUTPUT); \
|
2012-02-10 00:49:42 +01:00
|
|
|
pinMode(DBG_PIN2, OUTPUT); \
|
2011-03-08 22:13:54 +01:00
|
|
|
RST_TRIGGER()
|
2012-02-10 00:49:42 +01:00
|
|
|
#define TOGGLE_TRIGGER() SET_TRIGGER() \
|
2011-03-08 22:13:54 +01:00
|
|
|
delayMicroseconds(2); \
|
|
|
|
RST_TRIGGER()
|
|
|
|
|
|
|
|
#endif
|