Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
8 changes: 6 additions & 2 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ TwoWire::TwoWire(int scl, int sda, WireAddressMode_t am /*= ADDRESS_MODE_7_BITS*
is_master(true),
is_sci(false),
address_mode(am),
timeout(1000),
timeout(1),
transmission_begun(false),
data_too_long(false),
rx_index(0),
Expand Down Expand Up @@ -835,7 +835,11 @@ void TwoWire::flush(void) {
while(bus_status != WIRE_STATUS_TX_COMPLETED && bus_status != WIRE_STATUS_TRANSACTION_ABORTED) {}
}


/* -------------------------------------------------------------------------- */
void TwoWire::setTimeout(unsigned int t) {
/* -------------------------------------------------------------------------- */
timeout = t;
}


#if WIRE_HOWMANY > 0
Expand Down
2 changes: 2 additions & 0 deletions libraries/Wire/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class TwoWire : public arduino::HardwareI2C {
void onRequest( void (*)(void) );

void setBusStatus(WireStatus_t);
/* set timeout in ms for I2C communication */
void setTimeout(unsigned int t);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


inline size_t write(unsigned long n) { return write((uint8_t)n); }
inline size_t write(long n) { return write((uint8_t)n); }
Expand Down
Loading