From bbc017f5ba3c0fc3373976d4ef7e28237899d733 Mon Sep 17 00:00:00 2001 From: Greyson Christoforo Date: Sat, 9 Jan 2021 11:31:39 +0000 Subject: fix twi_manageTimeoutFlag function description --- libraries/Wire/src/utility/twi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libraries/Wire/src') diff --git a/libraries/Wire/src/utility/twi.c b/libraries/Wire/src/utility/twi.c index e8a41a2..d223760 100644 --- a/libraries/Wire/src/utility/twi.c +++ b/libraries/Wire/src/utility/twi.c @@ -490,7 +490,7 @@ void twi_handleTimeout(bool reset){ * Desc returns true if twi has seen a timeout * optionally clears the timeout flag * Input clear_flag: true if we should reset the hardware - * Output none + * Output the value of twi_timed_out_flag when the function was called */ bool twi_manageTimeoutFlag(bool clear_flag){ bool flag = twi_timed_out_flag; -- cgit v1.2.3-18-g5258 From 4b35c44064ad638c63bae7aa337002fbcc665ffb Mon Sep 17 00:00:00 2001 From: ArkadyGamza Date: Thu, 25 Feb 2021 15:55:51 +0000 Subject: Declare TwoWire functions as virtual To make alternative implementations of the TwoWire class (e.g. SoftwareWire for software I2C) work properly being passed to libraries that expect TwoWire type. --- libraries/Wire/src/Wire.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'libraries/Wire/src') diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index e70d72e..30299ca 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -50,31 +50,31 @@ class TwoWire : public Stream static void onReceiveService(uint8_t*, int); public: TwoWire(); - void begin(); - void begin(uint8_t); - void begin(int); - void end(); - void setClock(uint32_t); - void setWireTimeout(uint32_t timeout = 25000, bool reset_with_timeout = false); - bool getWireTimeoutFlag(void); - void clearWireTimeoutFlag(void); - void beginTransmission(uint8_t); - void beginTransmission(int); - uint8_t endTransmission(void); - uint8_t endTransmission(uint8_t); - uint8_t requestFrom(uint8_t, uint8_t); - uint8_t requestFrom(uint8_t, uint8_t, uint8_t); - uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t); - uint8_t requestFrom(int, int); - uint8_t requestFrom(int, int, int); + virtual void begin(); + virtual void begin(uint8_t); + virtual void begin(int); + virtual void end(); + virtual void setClock(uint32_t); + virtual void setWireTimeout(uint32_t timeout = 25000, bool reset_with_timeout = false); + virtual bool getWireTimeoutFlag(void); + virtual void clearWireTimeoutFlag(void); + virtual void beginTransmission(uint8_t); + virtual void beginTransmission(int); + virtual uint8_t endTransmission(void); + virtual uint8_t endTransmission(uint8_t); + virtual uint8_t requestFrom(uint8_t, uint8_t); + virtual uint8_t requestFrom(uint8_t, uint8_t, uint8_t); + virtual uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t); + virtual uint8_t requestFrom(int, int); + virtual uint8_t requestFrom(int, int, int); virtual size_t write(uint8_t); virtual size_t write(const uint8_t *, size_t); virtual int available(void); virtual int read(void); virtual int peek(void); virtual void flush(void); - void onReceive( void (*)(int) ); - void onRequest( void (*)(void) ); + virtual void onReceive( void (*)(int) ); + virtual void onRequest( void (*)(void) ); inline size_t write(unsigned long n) { return write((uint8_t)n); } inline size_t write(long n) { return write((uint8_t)n); } -- cgit v1.2.3-18-g5258 From 1ac42f7ac0c365cfa4d901889ff6d4c23d3b4796 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 26 May 2021 13:19:49 +0200 Subject: Revert "Declare TwoWire functions as virtual" (#412) --- libraries/Wire/src/Wire.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'libraries/Wire/src') diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index 30299ca..e70d72e 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -50,31 +50,31 @@ class TwoWire : public Stream static void onReceiveService(uint8_t*, int); public: TwoWire(); - virtual void begin(); - virtual void begin(uint8_t); - virtual void begin(int); - virtual void end(); - virtual void setClock(uint32_t); - virtual void setWireTimeout(uint32_t timeout = 25000, bool reset_with_timeout = false); - virtual bool getWireTimeoutFlag(void); - virtual void clearWireTimeoutFlag(void); - virtual void beginTransmission(uint8_t); - virtual void beginTransmission(int); - virtual uint8_t endTransmission(void); - virtual uint8_t endTransmission(uint8_t); - virtual uint8_t requestFrom(uint8_t, uint8_t); - virtual uint8_t requestFrom(uint8_t, uint8_t, uint8_t); - virtual uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t); - virtual uint8_t requestFrom(int, int); - virtual uint8_t requestFrom(int, int, int); + void begin(); + void begin(uint8_t); + void begin(int); + void end(); + void setClock(uint32_t); + void setWireTimeout(uint32_t timeout = 25000, bool reset_with_timeout = false); + bool getWireTimeoutFlag(void); + void clearWireTimeoutFlag(void); + void beginTransmission(uint8_t); + void beginTransmission(int); + uint8_t endTransmission(void); + uint8_t endTransmission(uint8_t); + uint8_t requestFrom(uint8_t, uint8_t); + uint8_t requestFrom(uint8_t, uint8_t, uint8_t); + uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t); + uint8_t requestFrom(int, int); + uint8_t requestFrom(int, int, int); virtual size_t write(uint8_t); virtual size_t write(const uint8_t *, size_t); virtual int available(void); virtual int read(void); virtual int peek(void); virtual void flush(void); - virtual void onReceive( void (*)(int) ); - virtual void onRequest( void (*)(void) ); + void onReceive( void (*)(int) ); + void onRequest( void (*)(void) ); inline size_t write(unsigned long n) { return write((uint8_t)n); } inline size_t write(long n) { return write((uint8_t)n); } -- cgit v1.2.3-18-g5258 From 8b327d7bede1c1245db99daeba4e168c92c11194 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 26 May 2021 04:35:59 -0700 Subject: Correct typos in comments and documentation --- libraries/Wire/src/Wire.cpp | 4 ++-- libraries/Wire/src/utility/twi.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'libraries/Wire/src') diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index c407776..001d924 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -100,7 +100,7 @@ void TwoWire::setClock(uint32_t clock) * when `clearWireTimeoutFlag()` or `setWireTimeoutUs()` is called. * * Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master - * to complete its transaction. So make sure to adapt the timeout to accomodate for those cases if needed. + * to complete its transaction. So make sure to adapt the timeout to accommodate for those cases if needed. * A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol), * but (much) shorter values will usually also work. * @@ -120,7 +120,7 @@ void TwoWire::setWireTimeout(uint32_t timeout, bool reset_with_timeout){ /*** * Returns the TWI timeout flag. * - * @return true if timeout has occured since the flag was last cleared. + * @return true if timeout has occurred since the flag was last cleared. */ bool TwoWire::getWireTimeoutFlag(void){ return(twi_manageTimeoutFlag(false)); diff --git a/libraries/Wire/src/utility/twi.c b/libraries/Wire/src/utility/twi.c index d223760..e09a33c 100644 --- a/libraries/Wire/src/utility/twi.c +++ b/libraries/Wire/src/utility/twi.c @@ -175,7 +175,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen } twi_state = TWI_MRX; twi_sendStop = sendStop; - // reset error state (0xFF.. no error occured) + // reset error state (0xFF.. no error occurred) twi_error = 0xFF; // initialize buffer iteration vars @@ -183,7 +183,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen twi_masterBufferLength = length-1; // This is not intuitive, read on... // On receive, the previously configured ACK/NACK setting is transmitted in // response to the received byte before the interrupt is signalled. - // Therefor we must actually set NACK when the _next_ to last byte is + // Therefore we must actually set NACK when the _next_ to last byte is // received, causing that NACK to be sent in response to receiving the last // expected byte of data. @@ -269,7 +269,7 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait } twi_state = TWI_MTX; twi_sendStop = sendStop; - // reset error state (0xFF.. no error occured) + // reset error state (0xFF.. no error occurred) twi_error = 0xFF; // initialize buffer iteration vars @@ -294,7 +294,7 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait // We need to remove ourselves from the repeated start state before we enable interrupts, // since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning // up. Also, don't enable the START interrupt. There may be one pending from the - // repeated start that we sent outselves, and that would really confuse things. + // repeated start that we sent ourselves, and that would really confuse things. twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR startMicros = micros(); do { @@ -411,7 +411,7 @@ void twi_stop(void) // send stop condition TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO); - // wait for stop condition to be exectued on bus + // wait for stop condition to be executed on bus // TWINT is not set after a stop condition! // We cannot use micros() from an ISR, so approximate the timeout with cycle-counted delays const uint8_t us_per_loop = 8; -- cgit v1.2.3-18-g5258