Skip to content

Commit bede31b

Browse files
committed
Remove extra begin() to avoid compiler confusion
Fix #34
1 parent 5ef3a9f commit bede31b

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

src/SparkFun_External_EEPROM.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@
2626
#include "Arduino.h"
2727
#include "Wire.h"
2828

29-
bool ExternalEEPROM::begin(uint8_t deviceAddress, TwoWire &wirePort)
29+
bool ExternalEEPROM::begin(uint8_t deviceAddress, TwoWire &wirePort, uint8_t WP)
3030
{
31+
if(WP != 255)
32+
{
33+
pinMode(WP, OUTPUT);
34+
digitalWrite(WP, HIGH);
35+
settings.wpPin = WP;
36+
}
3137
settings.i2cPort = &wirePort; // Grab which port the user wants us to use
3238
settings.deviceAddress = deviceAddress;
3339

@@ -66,24 +72,6 @@ bool ExternalEEPROM::begin(uint8_t deviceAddress, TwoWire &wirePort)
6672

6773
return true;
6874
}
69-
bool ExternalEEPROM::begin(uint8_t deviceAddress, TwoWire &wirePort, uint8_t WP)
70-
{
71-
if(WP != 255)
72-
{
73-
pinMode(WP, OUTPUT);
74-
digitalWrite(WP, HIGH);
75-
settings.wpPin = WP;
76-
}
77-
settings.i2cPort = &wirePort; // Grab which port the user wants us to use
78-
settings.deviceAddress = deviceAddress;
79-
80-
if (isConnected() == false)
81-
{
82-
return false;
83-
}
84-
85-
return true;
86-
}
8775

8876
// Erase entire EEPROM
8977
void ExternalEEPROM::erase(uint8_t toWrite)

src/SparkFun_External_EEPROM.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class ExternalEEPROM
122122
int write(uint32_t eepromLocation, uint8_t dataToWrite);
123123
int write(uint32_t eepromLocation, const uint8_t *dataToWrite, uint16_t blockSize);
124124

125-
bool begin(uint8_t deviceAddress = 0b1010000, TwoWire &wirePort = Wire); // By default use the Wire port
126125
bool begin(uint8_t deviceAddress = 0b1010000, TwoWire &wirePort = Wire, uint8_t WP = 255); // By default use the Wire port
127126

128127
bool isConnected(uint8_t i2cAddress = 255);

0 commit comments

Comments
 (0)