Skip to content

Commit 65eeac1

Browse files
committed
fix Wire::pins compatibility (#167)
1 parent 34b09f7 commit 65eeac1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libraries/Wire/Wire.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ uint8_t TwoWire::transmitting = 0;
4545
void (*TwoWire::user_onRequest)(void);
4646
void (*TwoWire::user_onReceive)(int);
4747

48+
static int default_sda_pin = SDA;
49+
static int default_scl_pin = SCL;
50+
4851
// Constructors ////////////////////////////////////////////////////////////////
4952

5053
TwoWire::TwoWire(){}
@@ -57,11 +60,12 @@ void TwoWire::begin(int sda, int scl){
5760
}
5861

5962
void TwoWire::pins(int sda, int scl){
60-
twi_init(sda, scl);
63+
default_sda_pin = sda;
64+
default_scl_pin = scl;
6165
}
6266

6367
void TwoWire::begin(void){
64-
begin(SDA, SCL);
68+
begin(default_sda_pin, default_scl_pin);
6569
}
6670

6771
void TwoWire::begin(uint8_t address){

0 commit comments

Comments
 (0)