Skip to content

Commit f478466

Browse files
Added Wire.end() for bit banged version (TwoWire.cpp)
1 parent 0444a36 commit f478466

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

STM32F1/libraries/Wire/Wire.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,18 @@ void TwoWire::begin(uint8 self_addr) {
184184
set_sda(HIGH);
185185
}
186186

187+
void TwoWire::end()
188+
{
189+
if (this->scl_pin)
190+
{
191+
pinMode(this->scl_pin, INPUT);
192+
}
193+
if (this->sda_pin)
194+
{
195+
pinMode(this->sda_pin, INPUT);
196+
}
197+
}
198+
187199
TwoWire::~TwoWire() {
188200
this->scl_pin=0;
189201
this->sda_pin=0;

STM32F1/libraries/Wire/Wire.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ class TwoWire : public WireBase {
111111
* Shifts out the data through SDA and clocks SCL for the slave device
112112
*/
113113
void i2c_shift_out(uint8);
114+
115+
116+
117+
114118
protected:
115119
/*
116120
* Processes the incoming I2C message defined by WireBase
@@ -130,6 +134,11 @@ class TwoWire : public WireBase {
130134
*/
131135
void begin(uint8 = 0x00);
132136

137+
/*
138+
* Sets pins SDA and SCL to INPUT
139+
*/
140+
void end();
141+
133142
/*
134143
* If object is destroyed, set pin numbers to 0.
135144
*/

0 commit comments

Comments
 (0)