Skip to content

Commit

Permalink
Adafruit Wire library already defines TinyWireM as Wire
Browse files Browse the repository at this point in the history
So, this was a little tricky.  For Adafruit Trinket and Gemma, you want
to remove the definition of Wire as TinyWireM.  If you don’t other uses
of Wire in a sketch get messed up.
But, the Arduino Gemma doesn’t use the Adafruit Wire library.  So
Arduino Gemma compiles would fail.  I made ARDUINO_AVR_GEMMA a special
case.
Version 1.0.3
  • Loading branch information
driverblock committed Oct 18, 2017
1 parent a2d97fe commit 471c883
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
7 changes: 0 additions & 7 deletions Adafruit_MCP23017.cpp
Expand Up @@ -11,13 +11,6 @@
BSD license, all text above must be included in any redistribution
****************************************************/

#ifdef __AVR_ATtiny85__
#define Wire TinyWireM //TinyWireM is now part of Adafruit Wire library
#else
#include <Wire.h>
#endif


#ifdef __AVR
#include <avr/pgmspace.h>
#elif defined(ESP8266)
Expand Down
17 changes: 12 additions & 5 deletions Adafruit_MCP23017.h
Expand Up @@ -15,11 +15,18 @@
#define _Adafruit_MCP23017_H_

// Don't forget the Wire library
//#ifdef __AVR_ATtiny85__ //TinyWireM is now part of
//#include <TinyWireM.h> // Adafruit version of Wire Library
//#else
#include <Wire.h>
//#endif
#ifndef ARDUINO_AVR_GEMMA
//TinyWireM is now part of
// Adafruit version of Wire Library, so this
// will work with Adafruit ATtiny85's
//But Arduino Gemma doesn't use that library
// We do NOT want to include Wire if it's an arduino Gemma
#include <Wire.h>
#else
#include <TinyWireM.h>
#define Wire TinyWireM
#endif


class Adafruit_MCP23017 {
public:
Expand Down
2 changes: 1 addition & 1 deletion library.properties
@@ -1,5 +1,5 @@
name=Adafruit MCP23017 Arduino Library
version=1.0.2
version=1.0.3
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Library for the MCP23017 I2C Port Expander
Expand Down

0 comments on commit 471c883

Please sign in to comment.