I'd propose little improvement for your library - it is add possibility to instantiate multiple instances of I2C bus object. It allows use more then one I2C bus with different IO lines simultaneously.
My proposition is to use pointer to structure wich descripts I2C bus instance. This structure (casted to void pointer for hide internal bus data from end user) used as handle for manipulate single instanse of I2C bus. Each instance of I2C bus should be binded to different couple GPIO lines.
Also I used semaphore as latch to lock I2C bus to avoid interleaving requests within one transaction to different devices.
Unfortunately I can't offer clean diff of changes with your code because I made a lot changes when adapted your code to use with esp8266_rtos_sdk and formated code style.
Hi At first, thank very much for your job!
I'd propose little improvement for your library - it is add possibility to instantiate multiple instances of I2C bus object. It allows use more then one I2C bus with different IO lines simultaneously.
My proposition is to use pointer to structure wich descripts I2C bus instance. This structure (casted to void pointer for hide internal bus data from end user) used as handle for manipulate single instanse of I2C bus. Each instance of I2C bus should be binded to different couple GPIO lines.
Also I used semaphore as latch to lock I2C bus to avoid interleaving requests within one transaction to different devices.
Unfortunately I can't offer clean diff of changes with your code because I made a lot changes when adapted your code to use with esp8266_rtos_sdk and formated code style.
You could see changed library at my test project: https://github.com/sacculus/aircontrol.v2.x.x/include/brzo_i2c.h https://github.com/sacculus/aircontrol.v2.x.x/user/brzo_i2c.c