Skip to content

Commit 471c883

Browse files
committed
Adafruit Wire library already defines TinyWireM as Wire
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
1 parent a2d97fe commit 471c883

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Adafruit_MCP23017.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111
BSD license, all text above must be included in any redistribution
1212
****************************************************/
1313

14-
#ifdef __AVR_ATtiny85__
15-
#define Wire TinyWireM //TinyWireM is now part of Adafruit Wire library
16-
#else
17-
#include <Wire.h>
18-
#endif
19-
20-
2114
#ifdef __AVR
2215
#include <avr/pgmspace.h>
2316
#elif defined(ESP8266)

Adafruit_MCP23017.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515
#define _Adafruit_MCP23017_H_
1616

1717
// Don't forget the Wire library
18-
//#ifdef __AVR_ATtiny85__ //TinyWireM is now part of
19-
//#include <TinyWireM.h> // Adafruit version of Wire Library
20-
//#else
21-
#include <Wire.h>
22-
//#endif
18+
#ifndef ARDUINO_AVR_GEMMA
19+
//TinyWireM is now part of
20+
// Adafruit version of Wire Library, so this
21+
// will work with Adafruit ATtiny85's
22+
//But Arduino Gemma doesn't use that library
23+
// We do NOT want to include Wire if it's an arduino Gemma
24+
#include <Wire.h>
25+
#else
26+
#include <TinyWireM.h>
27+
#define Wire TinyWireM
28+
#endif
29+
2330

2431
class Adafruit_MCP23017 {
2532
public:

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit MCP23017 Arduino Library
2-
version=1.0.2
2+
version=1.0.3
33
author=Adafruit
44
maintainer=Adafruit <info@adafruit.com>
55
sentence=Library for the MCP23017 I2C Port Expander

0 commit comments

Comments
 (0)