95 template<
typename OSTREAM>
96 void trace(OSTREAM& out,
bool hex_status =
true)
99 for (uint8_t i = 0; i < index_; ++i)
102 out << uint8_t(expected_[i]) <<
' ';
104 out << uint8_t(actual_[i]) <<
'\n';
107 for (uint8_t i = 0; i < index_; ++i)
108 out << expected_[i] <<
' ' << actual_[i] <<
'\n';
110 out <<
F(
"# OVF #") <<
'\n';
117 if (index_ >= SIZE)
return;
120 expected_[index_] = expected;
121 actual_[index_++] = actual;
140 template<
typename OSTREAM>
154 : out_{out}, trace_{trace}, hex_status_{hex_status} {}
164 out_ << uint8_t(expected) <<
' ';
166 out_ << uint8_t(actual) <<
'\n';
169 out_ << expected <<
' ' << actual <<
'\n';
212 expected_ = expected;
Class holding the latest I2C status.
Status latest_expected_status() const
Return the latest I2C expected status (may be different than actual).
Status latest_status() const
Return the latest I2C actual status.
I2CLatestStatusHolder()=default
Create an I2CLatestStatusHolder that can hold latest I2C status.
Class tracing I2C status notifications live to out.
I2CStatusLiveLogger(OSTREAM &out, STATUS trace=STATUS::TRACE_ALL, bool hex_status=true)
Create an I2CStatusLiveLogger that can trace live I2C notifications determined by trace.
Class recording I2C status notifications for later output.
I2CStatusRecorder(STATUS trace=STATUS::TRACE_ALL)
Create an I2CStatusRecorder that can record I2C status notifications determined by trace.
void trace(OSTREAM &out, bool hex_status=true)
Output all recorded I2C status notifications to out then clear all records.
void reset()
Clear all recorded notifications.
static constexpr fmtflags basefield
Bitmask constant used with setf(fmtflags, fmtflags) when changing the output base format.
static constexpr fmtflags hex
Read or write integral values using hexadecimal (0..9,A..F) base format.
#define F(ptr)
Force string constant to be stored as flash storage.
C++-like std::iostream facilities.
Defines API to ease I2C manager status tracing and debugging.
STATUS
Indicate when status should be traced.
@ TRACE_ERROR
Trace only status that differ (between expected and actual).
@ TRACE_ALL
Trace everything.
Define API to define and manage I2C devices.
Status
Transmission status codes.
@ OK
Code indicating the last called method executed as expected without any issue.