Where are the non-blocking drivers?

I’d like to use an event-driven approach in my embedded application.

To make it work correctly, the peripheral drivers should be non-blocking. In other words: if they are sending and receiving data over I2C or SPI, they should use the i2c.transfer or spi.transfer function which is non-blocking and uses a callback to signal that the transfer is complete and not the blocking i2c.read or i2c.write functions .

However, all drivers for the peripherals I’m looking at are blocking.

Are there examples of drivers that use the non-blocking I2C or SPI api?


I do not have personal experiences with that and also do not know about examples but both APIs contain transfer method what is non-blocking according to description.

Mbed OS Reference | SPI::transfer(…) Class Reference
Mbed OS Reference | I2C::transfer(…) Class Reference

BR, Jan

Hi @JohnnyK ,

Thanks for your answer.

Indeed, the I2C and SPI provide an non-blocking interface.

However, I’m specifically looking for drivers that make use of those transfer functions.

I wrote one that uses async SPI: BNO080 - Fully featured I2C driver for Hilcrest's BNO080 a… | Mbed