Hi,
This is the function to deinitialize the i2c. When you do not need the i2c function, you can call it.
The other usage is this: when the mcu has few pins, you may use different peripheral function at the same pin. For example, the pin has i2c and spi function. You can configure the pin as i2c at firstly , and then deinitialize the i2c. Configure the pin as spi. Finally, you can deinitialize the spi and configure the pin as i2c. This is called Time division multiplexing.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi,
This is the function to deinitialize the i2c. When you do not need the i2c function, you can call it.
The other usage is this: when the mcu has few pins, you may use different peripheral function at the same pin. For example, the pin has i2c and spi function. You can configure the pin as i2c at firstly , and then deinitialize the i2c. Configure the pin as spi. Finally, you can deinitialize the spi and configure the pin as i2c. This is called Time division multiplexing.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
I understand the function of "I2C_MasterDeinit" but why would you use it in a practical application? There's two aspects to this question:
The first is, wouldn't it be much more efficient to simply change the pin muxes to the new function and ignore using Deinit all together? Maybe some SRAM resources would be freed, but I don't know how much would be saved vs the Flash space taken up by the method's code.
Secondly, I know it's just your example, but I would never recommend that you share pins devoted to an I2C device with anything else - I2C devices run on an open drain "dotted AND" bus which means that I2C devices could attempt to drive the bus low if the signals to other devices cause them to respond.
I know that when you're in an IO limited situation you need to start coming up with creative solutions to the problem, but implementing multiple bus types on the same IO pins should be discouraged.
Thanks, have a great day too