Natalia ab61e9c03a I2C sw driver with support of multiple buses, Slow, Fast, FastPlus, and user-defined speed selection (#2465)
* I2C driver speed-up, i2c.SLOW, i2c.FAST and user-defined speed selection

* - Multiple buses (up to 10) with different speeds on each bus
- Standard(Slow, 100kHz), Fast(400kHz) and FastPlus(1MHz) modes or an 
arbitrary clock speed
- Sharing SDA line over multiple I²C buses to save available pins
- GPIO16 pin can be used as SCL pin, but it does not support clock 
stretching and selected bus will be limited to FAST speed.

* Dynamic memory allocation, error checks, simplification, timing tweaks.

* Separated the code of old driver for better compatibility and simplicity

* Change of driver interface

* Add bus status check in setup(); simplify getDC(); remove unnesessary lines in ACK read/write

* Fix for moved doc file and trailing whitespaces
2019-04-05 06:56:11 +02:00

13 lines
392 B
C

#ifndef __I2C_MASTER_H__
#define __I2C_MASTER_H__
uint32 i2c_master_setup(uint16 id, uint8 sda, uint8 scl, uint32 speed);
void i2c_master_init(uint16 id);
bool i2c_master_configured(uint16 id);
void i2c_master_stop(uint16 id);
void i2c_master_start(uint16 id);
uint8 i2c_master_readByte(uint16 id, sint16 ack);
uint8 i2c_master_writeByte(uint16 id, uint8 wrdata);
#endif //__I2C_MASTER_H__