Skip to content

Class OpenSkyhawk::I2cHealth

ClassList > OpenSkyhawk > I2cHealth

Per-device I2C circuit breaker. Mix into any class that talks to an I2C device. More...

  • #include <I2cHealth.h>

Inherited by the following classes: OpenSkyhawk::DrumDisplay

Public Functions

Type Name
bool i2cHealthy () const
Breaker state — true while the device last probed reachable.

Protected Static Attributes

Type Name
constexpr uint32_t I2C_RETRY_MS = 2000
Back-off between retries once tripped (ms). A couple of seconds keeps the bus quiet.

Protected Functions

Type Name
virtual bool i2cProbe () = 0
Contract: probe this device's reachability (e.g. the mux ACKs and the device ACKs).
bool i2cReachable ()
Gate for every I2C op. Rate-limits the probe while tripped; trips/heals on the result.
~I2cHealth () = default

Detailed Description

Usage: class Foo : public OutputBase , public I2cHealth { bool i2cProbe() override {...} }; then if (!i2cReachable()) return; before any I2C transaction.

Public Functions Documentation

function i2cHealthy

Breaker state — true while the device last probed reachable.

inline bool OpenSkyhawk::I2cHealth::i2cHealthy () const

Protected Static Attributes Documentation

variable I2C_RETRY_MS

Back-off between retries once tripped (ms). A couple of seconds keeps the bus quiet.

constexpr uint32_t OpenSkyhawk::I2cHealth::I2C_RETRY_MS;

Protected Functions Documentation

function i2cProbe

Contract: probe this device's reachability (e.g. the mux ACKs and the device ACKs).

virtual bool OpenSkyhawk::I2cHealth::i2cProbe () = 0

Returns:

true if reachable. The implementer records any fault detail it wants to report.

Note:

Must be cheap — a single address probe, no payload — and must not throw or block beyond one bounded I2C transaction.


function i2cReachable

Gate for every I2C op. Rate-limits the probe while tripped; trips/heals on the result.

inline bool OpenSkyhawk::I2cHealth::i2cReachable () 

Returns:

true → safe to talk to the device; false → skip the op (dead/absent, backing off).


function ~I2cHealth

OpenSkyhawk::I2cHealth::~I2cHealth () = default


The documentation for this class was generated from the following file Firmware/Libraries/PanelGroup/Helpers/I2cHealth/I2cHealth.h