Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
SimpleLog.hxx
Go to the documentation of this file.
1
36#ifndef _FREERTOS_DRIVERS_COMMON_SIMPLELOG_HXX_
37#define _FREERTOS_DRIVERS_COMMON_SIMPLELOG_HXX_
38
43template <typename C> class SimpleLog
44{
45public:
46 SimpleLog()
47 : log_(0)
48 {
49 }
50
53 void log(uint8_t value)
54 {
55 log_ <<= 8;
56 log_ |= value;
57 }
58
59private:
62};
63
66
68template <class T, int N> class LogRing
69{
70public:
71 void add(T data)
72 {
73 data_[next_++] = data;
74 if (next_ >= N)
75 {
76 next_ = 0;
77 }
78 }
79
80private:
81 T data_[N];
82 unsigned next_ {0};
83};
84
85#endif // _FREERTOS_DRIVERS_COMMON_SIMPLELOG_HXX_
SimpleLog< uint64_t > LogBuffer
Actual class that keeps 8 log entries of one byte each.
Definition SimpleLog.hxx:65
Alternative for hundreds of entries.
Definition SimpleLog.hxx:69
A very simple logging mechanism of driver events that is capable of logging a few entries of an 8-bit...
Definition SimpleLog.hxx:44
void log(uint8_t value)
Append a byte worth of data to the end of the log buffer.
Definition SimpleLog.hxx:53
C log_
The raw log buffer.
Definition SimpleLog.hxx:61