Skip to content

Commit 0c87941

Browse files
committed
Revert "Added the repeated-start feature in I2C driver (stm32duino#590)"
This reverts commit 2280453.
1 parent 5937f3e commit 0c87941

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

Diff for: cores/arduino/stm32/twi.c

-16
Original file line numberDiff line numberDiff line change
@@ -740,16 +740,8 @@ i2c_status_e i2c_master_write(i2c_t *obj, uint8_t dev_address,
740740
return i2c_IsDeviceReady(obj, dev_address, 1);
741741
}
742742

743-
#if defined(I2C_OTHER_FRAME)
744-
uint32_t XferOptions = obj->handle.XferOptions; // save XferOptions value, because handle can be modified by HAL, which cause issue in case of NACK from slave
745-
#endif
746-
747743
do {
748-
#if defined(I2C_OTHER_FRAME)
749-
if (HAL_I2C_Master_Seq_Transmit_IT(&(obj->handle), dev_address, data, size, XferOptions) == HAL_OK) {
750-
#else
751744
if (HAL_I2C_Master_Transmit_IT(&(obj->handle), dev_address, data, size) == HAL_OK) {
752-
#endif
753745
ret = I2C_OK;
754746
// wait for transfer completion
755747
while ((HAL_I2C_GetState(&(obj->handle)) != HAL_I2C_STATE_READY)
@@ -811,16 +803,8 @@ i2c_status_e i2c_master_read(i2c_t *obj, uint8_t dev_address, uint8_t *data, uin
811803
uint32_t tickstart = HAL_GetTick();
812804
uint32_t delta = 0;
813805

814-
#if defined(I2C_OTHER_FRAME)
815-
uint32_t XferOptions = obj->handle.XferOptions; // save XferOptions value, because handle can be modified by HAL, which cause issue in case of NACK from slave
816-
#endif
817-
818806
do {
819-
#if defined(I2C_OTHER_FRAME)
820-
if (HAL_I2C_Master_Seq_Receive_IT(&(obj->handle), dev_address, data, size, XferOptions) == HAL_OK) {
821-
#else
822807
if (HAL_I2C_Master_Receive_IT(&(obj->handle), dev_address, data, size) == HAL_OK) {
823-
#endif
824808
ret = I2C_OK;
825809
// wait for transfer completion
826810
while ((HAL_I2C_GetState(&(obj->handle)) != HAL_I2C_STATE_READY)

Diff for: libraries/Wire/src/Wire.cpp

-22
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ void TwoWire::setClock(uint32_t frequency)
116116

117117
uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddress, uint8_t isize, uint8_t sendStop)
118118
{
119-
#if !defined(I2C_OTHER_FRAME)
120119
UNUSED(sendStop);
121-
#endif
122-
123120
if (_i2c.isMaster == 1) {
124121
allocateRxBuffer(quantity);
125122
// error if no memory block available to allocate the buffer
@@ -149,15 +146,6 @@ uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddres
149146

150147
// perform blocking read into buffer
151148
uint8_t read = 0;
152-
153-
#if defined(I2C_OTHER_FRAME)
154-
if (sendStop == 0) {
155-
_i2c.handle.XferOptions = I2C_OTHER_FRAME ;
156-
} else {
157-
_i2c.handle.XferOptions = I2C_OTHER_AND_LAST_FRAME;
158-
}
159-
#endif
160-
161149
if (I2C_OK == i2c_master_read(&_i2c, address << 1, rxBuffer, quantity)) {
162150
read = quantity;
163151
}
@@ -223,18 +211,8 @@ void TwoWire::beginTransmission(int address)
223211
//
224212
uint8_t TwoWire::endTransmission(uint8_t sendStop)
225213
{
226-
#if !defined(I2C_OTHER_FRAME)
227214
UNUSED(sendStop);
228-
#endif
229215
int8_t ret = 4;
230-
// check transfer options and store it in the I2C handle
231-
#if defined(I2C_OTHER_FRAME)
232-
if (sendStop == 0) {
233-
_i2c.handle.XferOptions = I2C_OTHER_FRAME ;
234-
} else {
235-
_i2c.handle.XferOptions = I2C_OTHER_AND_LAST_FRAME;
236-
}
237-
#endif
238216

239217
if (_i2c.isMaster == 1) {
240218
// transmit buffer (blocking)

0 commit comments

Comments
 (0)