-
- Downloads
[I2C] Created new low-level (for stm32f4) and high-level I2C drivers
Low-level driver features (specific for the stm32f4 family): - 7-bit (tested) and 10-bit (not tested yet) addressing; - Speed modes: Standard (100kHz clock) and Fast (400kHz clock); - Compatibility with all I2C peripherals till I2C4 (easy to extend to additional ones); - Internal configuration of the pins in order to avoid forgetting to set them to ALTERNATE_OD mode (so, avoiding possibility of short-circuits between master and slave); - The configurations of the slave (slave address, addressing mode and speed mode) we want to communicate with are setted before each read/write on the bus; - Support for the reStart condition when wanting to write and then read from the same slave; - Usage of interrupts when possible; In two cases we need polling anyway (limited to a parameter to avoid infinite polling): . I2C_SR2_BUSY doesn't generate an interrupt and we can't communicate with the bus in BUSY state. . I2C_SR1_SB do generate an interrupt, but its handling is a bit tricky since other interrupts are generated in the case of a reStart condition; also, using the interrupt for this, there would be the risk of a deadlock. - Resilience to bus deadlocks; High-level driver features: - Resilience to bus deadlocks embedded before any operation on the bus; - Implementation of higher level methods for using the bus; - Possibility to have a synchronized version of the driver;
Showing
- CMakeLists.txt 6 additions, 0 deletionsCMakeLists.txt
- cmake/boardcore.cmake 2 additions, 1 deletioncmake/boardcore.cmake
- src/shared/drivers/i2c/I2C.cpp 94 additions, 0 deletionssrc/shared/drivers/i2c/I2C.cpp
- src/shared/drivers/i2c/I2C.h 189 additions, 0 deletionssrc/shared/drivers/i2c/I2C.h
- src/shared/drivers/i2c/I2CDriver.cpp 750 additions, 0 deletionssrc/shared/drivers/i2c/I2CDriver.cpp
- src/shared/drivers/i2c/I2CDriver.h 227 additions, 0 deletionssrc/shared/drivers/i2c/I2CDriver.h
- src/tests/drivers/i2c/test-i2c-driver.cpp 129 additions, 0 deletionssrc/tests/drivers/i2c/test-i2c-driver.cpp
- src/tests/drivers/i2c/test-i2c.cpp 127 additions, 0 deletionssrc/tests/drivers/i2c/test-i2c.cpp
Loading
Please register or sign in to comment