Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void TwoWire::begin(bool generalCall)
begin(MASTER_ADDRESS, generalCall);
}

void TwoWire::begin(uint8_t address, bool generalCall)
void TwoWire::begin(uint8_t address, bool generalCall, bool NoStretchMode)
{
rxBufferIndex = 0;
rxBufferLength = 0;
Expand All @@ -83,6 +83,8 @@ void TwoWire::begin(uint8_t address, bool generalCall)

_i2c.generalCall = (generalCall == true) ? 1 : 0;

_i2c.NoStretchMode = (NoStretchMode == true) ? 1 : 0;

recoverBus(); // in case I2C bus (device) is stuck after a reset for example

i2c_custom_init(&_i2c, 100000, I2C_ADDRESSINGMODE_7BIT, ownAddress);
Expand All @@ -96,9 +98,9 @@ void TwoWire::begin(uint8_t address, bool generalCall)
}
}

void TwoWire::begin(int address, bool generalCall)
void TwoWire::begin(int address, bool generalCall, bool NoStretchMode)
{
begin((uint8_t)address, generalCall);
begin((uint8_t)address, generalCall, NoStretchMode);
}

void TwoWire::end(void)
Expand Down
4 changes: 2 additions & 2 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class TwoWire : public Stream {
};
void begin(bool generalCall = false);
void begin(uint32_t, uint32_t);
void begin(uint8_t, bool generalCall = false);
void begin(int, bool generalCall = false);
void begin(uint8_t, bool generalCall = false, bool NoStretchMode = false);
void begin(int, bool generalCall = false, bool NoStretchMode = false);
void end();
void setClock(uint32_t);
void beginTransmission(uint8_t);
Expand Down
2 changes: 1 addition & 1 deletion libraries/Wire/src/utility/twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ void i2c_custom_init(i2c_t *obj, uint32_t timing, uint32_t addressingMode, uint3
handle->Init.AddressingMode = addressingMode;
handle->Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
handle->Init.GeneralCallMode = (obj->generalCall == 0) ? I2C_GENERALCALL_DISABLE : I2C_GENERALCALL_ENABLE;
handle->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
handle->Init.NoStretchMode = (obj->NoStretchMode == 0) ? I2C_NOSTRETCH_DISABLE : I2C_NOSTRETCH_ENABLE;

handle->State = HAL_I2C_STATE_RESET;

Expand Down
1 change: 1 addition & 0 deletions libraries/Wire/src/utility/twi.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ struct i2c_s {
volatile uint8_t slaveMode;
uint8_t isMaster;
uint8_t generalCall;
uint8_t NoStretchMode;
};

///@brief I2C state
Expand Down