jamesbowman / i2cdriver

I2CDriver open source tools
https://i2cdriver.com/
BSD 3-Clause "New" or "Revised" License
184 stars 57 forks source link

feat(i2c): add baud rate setting functionality #67

Open muman613 opened 3 months ago

muman613 commented 3 months ago

Add a new function i2c_setbaud allowing the baud rate of the I2C connection to be set. This feature provides the ability to configure the communication speed to standard values (100kbps or 400kbps). To support this, stdbool.h is included for returning boolean status from the new function. The implementation checks if the requested baud rate matches the current one, and updates it if necessary through a serialized command, with feedback obtained immediately by calling i2c_getstatus. This commit includes both the prototype in i2cdriver.h and the definition in i2cdriver.c.

muman613 commented 3 months ago

@jamesbowman , please review the code and comment if you think there is anything which needs to be changed. I have tested this code, but you should test it if you have C code using the SDK...