aboutsummaryrefslogtreecommitdiff
path: root/libraries/Wire/src/Wire.h
diff options
context:
space:
mode:
authorGreyson Christoforo <grey@christoforo.net>2018-02-28 20:59:45 +0000
committerMartino Facchin <m.facchin@arduino.cc>2020-06-11 15:30:04 +0200
commitdeea9293201dbab724b6b0519c35ddba3e6b92d9 (patch)
tree480a0d0d23624b58c2bcedcf7e53dddf7fda823f /libraries/Wire/src/Wire.h
parent71c3f9920102991dc7b0492482fb08d51881e44a (diff)
Introduce non compulsory Wire timeout
move timout handling into its own function change timeout from milliseconds to microseconds don't forget operating slave address or the bitrate when we reset because of a timeout Co-Authored-By: Witold Markowski <witold.a.markowski@gmail.com> fix delay datatype uint16_t --> uint32_t Update libraries/Wire/src/utility/twi.c fix mix up using TWBR instea of TWAR! Co-Authored-By: Matthijs Kooijman <matthijs@stdin.nl> Update libraries/Wire/src/utility/twi.c fix 2nd TWBR/TWAR mixup Co-Authored-By: Matthijs Kooijman <matthijs@stdin.nl> twi_stop() should use the same timeout as everywhere else all while loops are now protected by timeouts Revert "twi_stop() should use the same timeout as everywhere else" This reverts commit 68fe5f1dae1bb41183bb37eeda3fb453394a580c. make timeout counter volatile rename timeout function for improved clarity - resetting the twi interface on timeouts is now optional - timeouts in the ISR are no longer hardcoded and now obey the set timeout value - a user-readable flag is now set whenever a timeout occurs - the user can clear this flag whenever they like
Diffstat (limited to 'libraries/Wire/src/Wire.h')
-rw-r--r--libraries/Wire/src/Wire.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h
index 702f37d..c8b9a3e 100644
--- a/libraries/Wire/src/Wire.h
+++ b/libraries/Wire/src/Wire.h
@@ -17,6 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
+ Modified 2020 by Greyson Christoforo (grey@christoforo.net) to implement timeouts
*/
#ifndef TwoWire_h
@@ -54,13 +55,16 @@ class TwoWire : public Stream
void begin(int);
void end();
void setClock(uint32_t);
+ void setWireTimeoutUs(uint32_t, bool);
+ 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(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);