BayEOSArduino Library
BayDebug.h
1 /*
2  * Serial Debugging Class
3  *
4  * S.Holzheu (holzheu@bayceer.uni-bayreuth.de)
5  *
6  * This is a Class sending BayEOS-Frames in a human readable form
7  * helps debugging Arduino-BayEOS-Projects...
8  *
9  */
10 
11 #ifndef BayDEBUG_h
12 #define BayDEBUG_h
13 
14 #include <BayEOS.h>
15 
16 class BayEOSDebugInterface : virtual public Stream, public BayEOS {
17 public:
18  using Print::write; // pull in write(str) and write(buf, size) from Print
19  uint8_t sendPayload(void);
20 protected:
21  uint8_t _modus;
22  uint8_t _error_next;
23 private:
24  uint8_t _checksum;
25  void parse(uint8_t offset=0);
26  void parseDataFrame(uint8_t offset);
27 
28 
29 };
30 
32 public:
36  BayDebugCharbuffer(char* buffer, int size);
37  char* get(void);
38  uint8_t sendPayload(void);
39 
40 private:
41  char* _buffer;
42  char _tmp[12]; //for itoa...
43  int _size;
44  int _pos;
45  int available(void);
46  int read(void);
47  size_t write(uint8_t b);
48  int peek(void);
49  void flush(void);
50 
51 };
52 
53 
55 public:
59  BayDebug(HardwareSerial &serial);
60 
61 
71  void begin(long baud,uint8_t modus=3);
72 private:
73  HardwareSerial* _serial;
74  int available(void);
75  int read(void);
76  size_t write(uint8_t b);
77  int peek(void);
78  void flush(void);
79 
80 
81 };
82 
83 
84 
85 
86 
87 #endif
Definition: BayDebug.h:31
uint8_t sendPayload(void)
Definition: BayDebug.cpp:220
BayDebugCharbuffer(char *buffer, int size)
Definition: BayDebug.cpp:215
Definition: BayDebug.h:54
BayDebug(HardwareSerial &serial)
Definition: BayDebug.cpp:194
void begin(long baud, uint8_t modus=3)
Definition: BayDebug.cpp:189
Definition: BayDebug.h:16
uint8_t sendPayload(void)
Definition: BayDebug.cpp:169
Definition: BayEOS.h:188