@@ -191,7 +191,7 @@ TwoWire::TwoWire(int scl, int sda, WireAddressMode_t am /*= ADDRESS_MODE_7_BITS*
191191 is_master(true ),
192192 is_sci(false ),
193193 address_mode(am),
194- timeout(1 ),
194+ timeout(1000 ),
195195 transmission_begun(false ),
196196 data_too_long(false ),
197197 rx_index(0 ),
@@ -465,7 +465,7 @@ void TwoWire::end(void) {
465465
466466
467467/* -------------------------------------------------------------------------- */
468- uint8_t TwoWire::read_from (uint8_t address, uint8_t * data, uint8_t length, unsigned int timeout_ms , bool sendStop) {
468+ uint8_t TwoWire::read_from (uint8_t address, uint8_t * data, uint8_t length, unsigned int timeout_us , bool sendStop) {
469469/* -------------------------------------------------------------------------- */
470470 /* ??? does this function make sense only for MASTER ???? */
471471
@@ -480,8 +480,8 @@ uint8_t TwoWire::read_from(uint8_t address, uint8_t* data, uint8_t length, unsig
480480 err = m_read (&m_i2c_ctrl,data,length,!sendStop);
481481 }
482482 }
483- uint32_t const start = millis ();
484- while (((millis () - start) < timeout_ms ) && bus_status == WIRE_STATUS_UNSET && err == FSP_SUCCESS) {
483+ uint32_t const start = micros ();
484+ while (((micros () - start) < timeout_us ) && bus_status == WIRE_STATUS_UNSET && err == FSP_SUCCESS) {
485485
486486 }
487487 }
@@ -494,7 +494,7 @@ uint8_t TwoWire::read_from(uint8_t address, uint8_t* data, uint8_t length, unsig
494494}
495495
496496/* -------------------------------------------------------------------------- */
497- uint8_t TwoWire::write_to (uint8_t address, uint8_t * data, uint8_t length, unsigned int timeout_ms , bool sendStop) {
497+ uint8_t TwoWire::write_to (uint8_t address, uint8_t * data, uint8_t length, unsigned int timeout_us , bool sendStop) {
498498/* -------------------------------------------------------------------------- */
499499 uint8_t rv = END_TX_OK;
500500 fsp_err_t err = FSP_ERR_ASSERTION;
@@ -508,8 +508,8 @@ uint8_t TwoWire::write_to(uint8_t address, uint8_t* data, uint8_t length, unsign
508508 err = m_write (&m_i2c_ctrl,data,length,!sendStop);
509509 }
510510 }
511- uint32_t const start = millis ();
512- while (((millis () - start) < timeout_ms ) && bus_status == WIRE_STATUS_UNSET && err == FSP_SUCCESS) {
511+ uint32_t const start = micros ();
512+ while (((micros () - start) < timeout_us ) && bus_status == WIRE_STATUS_UNSET && err == FSP_SUCCESS) {
513513
514514 }
515515
@@ -836,8 +836,9 @@ void TwoWire::flush(void) {
836836}
837837
838838/* -------------------------------------------------------------------------- */
839- void TwoWire::setWireTimeout (unsigned int t) {
839+ void TwoWire::setWireTimeout (unsigned int t, bool reset_on_timeout ) {
840840/* -------------------------------------------------------------------------- */
841+ (void )reset_on_timeout;
841842 timeout = t;
842843}
843844
0 commit comments