[I2C] created new I2C driver
The goal of the driver is to solve the issues with the miosix driver while giving a nice interface. The new driver implements additional features:
- Both Standard and Fast mode are available
- More general structure, in order to support I2C2, I2C3 and I2C4 (and easy to expand to others on the need)
- 7-bit and 10-bit addressing are available
- Resilience of bus deadlocks by detection and recovery
- Avoidance of potential infinite polling on flags with limited number of checks
- Usage of the possible IRQs to optimize polling on flags (RxNE and TxE)
- Thread safety
- Possibility to change speed mode and addressing mode after initialization
- Possibility to avoid sending a STOP condition after a write in order to do a write-read transaction
DMA isn't implemented yet.
During a consultation, the slave side of the driver is decided not to be implemented: it isn't necessary for our scope and it would only add complexity to an already not-so-immediate driver.
An important thing is that when implementing a driver for a sensor that uses the I2C protocol, a soft reset during initialization should be done (if possible) in order to reset all the state machines and previous setted parameters of the slave.
Edited by Emilio Corigliano