Skip to content

Commit b4dd5f9

Browse files
committed
refactor(i2c): simplify constructor
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 47246c9 commit b4dd5f9

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

libraries/Wire/src/Wire.cpp

Lines changed: 0 additions & 12 deletions
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));

libraries/Wire/src/Wire.h

Lines changed: 1 addition & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy