Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cores/esp32/esp32-hal-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ esp_err_t i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t frequency){
} else if(frequency > 1000000UL){
frequency = 1000000UL;
}
log_i("Initialising I2C Master: sda=%d scl=%d freq=%d", sda, scl, frequency);

i2c_config_t conf = { };
conf.mode = I2C_MODE_MASTER;
Expand Down
17 changes: 15 additions & 2 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,21 @@ class TwoWire: public Stream
//call setPins() first, so that begin() can be called without arguments from libraries
bool setPins(int sda, int scl);

bool begin(int sda=-1, int scl=-1, uint32_t frequency=0); // returns true, if successful init of i2c bus
bool begin(uint8_t slaveAddr, int sda=-1, int scl=-1, uint32_t frequency=0);
bool begin(int sda, int scl, uint32_t frequency=0); // returns true, if successful init of i2c bus
bool begin(uint8_t slaveAddr, int sda, int scl, uint32_t frequency);
// Explicit Overload for Arduino MainStream API compatibility
inline bool begin()
{
return begin(-1, -1, static_cast<uint32_t>(0));
}
inline bool begin(uint8_t addr)
{
return begin(addr, -1, -1, 0);
}
inline bool begin(int addr)
{
return begin(static_cast<uint8_t>(addr), -1, -1, 0);
}
bool end();

void setTimeOut(uint16_t timeOutMillis); // default timeout of i2c transactions is 50ms
Expand Down