Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to use SBWIRE to avoid well-known I2C hangup problems with Wire lib #160

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion RTClib.cpp
Expand Up @@ -41,15 +41,17 @@
This version: MIT (see LICENSE)
*/
/**************************************************************************/
#include "RTClib.h"

#ifdef __AVR_ATtiny85__
#include <TinyWireM.h>
#define Wire TinyWireM
#elif defined USE_SBWIRE // Uncomment #define in RTClib.h to fix I2C lockups
#include <SBWire.h>
#else
#include <Wire.h>
#endif

#include "RTClib.h"
#ifdef __AVR__
#include <avr/pgmspace.h>
#elif defined(ESP8266)
Expand Down
3 changes: 3 additions & 0 deletions RTClib.h
Expand Up @@ -25,6 +25,9 @@
#include <Arduino.h>
class TimeSpan;

// uncomment next line to use SBWire, which fixes Wire library lockup problems
//#define USE_SBWIRE

/** Registers */
#define PCF8523_ADDRESS 0x68 ///< I2C address for PCF8523
#define PCF8523_CLKOUTCONTROL 0x0F ///< Timer and CLKOUT control register
Expand Down