Skip to content

Commit

Permalink
refactor(i2c): simplify constructor
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Nov 12, 2024
1 parent 47246c9 commit b4dd5f9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
12 changes: 0 additions & 12 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ static const uint8_t MASTER_ADDRESS = 0x01;

// Constructors ////////////////////////////////////////////////////////////////

TwoWire::TwoWire()
{
memset((void *)&_i2c, 0, sizeof(_i2c));
_i2c.sda = digitalPinToPinName(SDA);
_i2c.scl = digitalPinToPinName(SCL);

txBuffer = nullptr;
txBufferAllocated = 0;
rxBuffer = nullptr;
rxBufferAllocated = 0;
}

TwoWire::TwoWire(uint32_t sda, uint32_t scl)
{
memset((void *)&_i2c, 0, sizeof(_i2c));
Expand Down
3 changes: 1 addition & 2 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class TwoWire : public Stream {
void recoverBus(void);

public:
TwoWire();
TwoWire(uint32_t sda, uint32_t scl);
TwoWire(uint32_t sda = SDA, uint32_t scl = SCL);
~TwoWire();
// setSCL/SDA have to be called before begin()
void setSCL(uint32_t scl)
Expand Down

0 comments on commit b4dd5f9

Please sign in to comment.