periph icon indicating copy to clipboard operation
periph copied to clipboard

conn: Support common or canonical errors on buses

Open tve opened this issue 9 years ago • 1 comments

conn.i2c should have an i2c.NoAckError defined such that an app can tell whether an error indicates that the device did not ack a transfer. An example for this is polling an eeprom until it's ready (done with the previous write). conn.onewire has onewire.BusError to indicate that there was a problem on the 1-wire bus, which frequently happens with long buses that have poor electrical control (e.g. to high a slew rate). Maybe it would be worth to have a conn.NoResponseError that is generic across buses. (All these errors should follow the "interface" pattern in order to decouple types, i.e., the app tests whether an error implements an interface as opposed to testing the error's concrete type.)

tve avatar Nov 23 '16 22:11 tve

Maybe it would be worth to have a conn.NoResponseError that is generic across buses.

yes, anything common should be in package conn.

maruel avatar Nov 23 '16 22:11 maruel

Ported to https://github.com/periph/conn/issues/35.

maruel avatar Sep 20 '23 17:09 maruel