Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4dd5f9

Browse files
committed
refactor(i2c): simplify constructor
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent47246c9 commitb4dd5f9

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
voidrecoverBus(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
voidsetSCL(uint32_t scl)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp