rust-embedded / embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Apache License 2.0
2.01k stars 202 forks source link

Request to add an async interface for i2c slave device #451

Open smeenka opened 1 year ago

smeenka commented 1 year ago

The current async interface targets an I2C Master.

Hereby I propose to also create an async interface for an I2C slave device.

It would be nice that the length of on incoming message is flexible, (controlled by the master, not by the slave). The slave does get a buffer from the software, big enough to contain all possible incoming messages. If the master does send more than the size of the buffer, an error is raised. At the end of an I2C message, the actual length of the received bytes, and the actual slave address should be reported to the software.