Skip to content

Commit b4dd5f9

Browse files
committed
refactor(i2c): simplify constructor
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 47246c9 commit b4dd5f9

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

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

-12
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ static const uint8_t MASTER_ADDRESS = 0x01;
3333

3434
// Constructors ////////////////////////////////////////////////////////////////
3535

36-
TwoWire::TwoWire()
37-
{
38-
memset((void *)&_i2c, 0, sizeof(_i2c));
39-
_i2c.sda = digitalPinToPinName(SDA);
40-
_i2c.scl = digitalPinToPinName(SCL);
41-
42-
txBuffer = nullptr;
43-
txBufferAllocated = 0;
44-
rxBuffer = nullptr;
45-
rxBufferAllocated = 0;
46-
}
47-
4836
TwoWire::TwoWire(uint32_t sda, uint32_t scl)
4937
{
5038
memset((void *)&_i2c, 0, sizeof(_i2c));

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ class TwoWire : public Stream {
7676
void recoverBus(void);
7777

7878
public:
79-
TwoWire();
80-
TwoWire(uint32_t sda, uint32_t scl);
79+
TwoWire(uint32_t sda = SDA, uint32_t scl = SCL);
8180
~TwoWire();
8281
// setSCL/SDA have to be called before begin()
8382
void setSCL(uint32_t scl)

0 commit comments

Comments
 (0)