I'm working on project where I2C Slave functionality is required. As I found in this forum and in documentation there is no support for I2C Slave mode so i had to implement it by myself. Im working with STM32F446RE microcontroller, but I think my API is abstract enough to be ported on other microcontrollers.
here is modified driver files and example of it usage:
Don't forget to define STM32_I2C_SLAVE_ENABLE in halconf.h
Code: Select all
/**
* @brief Enables I2C slave mode.
*/
#if !defined(STM32_I2C_SLAVE_ENABLE) || defined(__DOXYGEN__)
#define STM32_I2C_SLAVE_ENABLE TRUE
#endifI know some developers would like to have separated I2C Slave driver but i think it is better to extend existing I2C driver because some Master code can be reused for Slave mode.
For my application it works well but feel free to make any suggestions and/or corrections.