Skip to content

Commit 48fcb38

Browse files
jmchiappafpistm
authored andcommitted
Wire : New "begin" method for late call configuration (#838)
1 parent 8d34eff commit 48fcb38

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: libraries/Wire/src/Wire.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ TwoWire::TwoWire(uint8_t sda, uint8_t scl)
5959

6060
// Public Methods //////////////////////////////////////////////////////////////
6161

62+
void TwoWire::begin(uint8_t sda, uint8_t scl)
63+
{
64+
_i2c.sda = digitalPinToPinName(sda);
65+
_i2c.scl = digitalPinToPinName(scl);
66+
begin();
67+
}
68+
6269
void TwoWire::begin(bool generalCall)
6370
{
6471
begin(MASTER_ADDRESS, generalCall);

Diff for: libraries/Wire/src/Wire.h

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class TwoWire : public Stream {
8585
_i2c.sda = sda;
8686
};
8787
void begin(bool generalCall = false);
88+
void begin(uint8_t, uint8_t);
8889
void begin(uint8_t, bool generalCall = false);
8990
void begin(int, bool generalCall = false);
9091
void end();

0 commit comments

Comments
 (0)