Skip to content

Modified Arduino Wire library which implements basic timeout.

License

Notifications You must be signed in to change notification settings

freespace/SBWire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SBWire

Modified Arduino Wire library which implements basic timeout using loop counting. The default timeout is approximately 100 us and is calculated using F_CPU.

This library has been tested by holding SDA high, which blocks the standard Wire library, while SBWire timesout and continues execution. When SDA is restored, I2C communication is not established until the slave is rebooted.

Usage

Simply replace

#include <Wire.h>

With

#include <SBWire.h>

The API is exactly the same.

There is a basic C function to controlling the loop count, twi_setMaxLoops(uint16_t maxloops).

Timeout Behaviour

On timeout, twi_stop() is called followed by twi_init() in an attempt to restart the bus.

About

Modified Arduino Wire library which implements basic timeout.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published