Skip to content

Commit f231655

Browse files
authored
Merge pull request #3635 from bcostm/fix_i2c
STM32 I2C : Fix bug in i2c_byte_read function
2 parents 5d09014 + c1f7128 commit f231655

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

targets/TARGET_STM/i2c_api.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,9 @@ int i2c_byte_read(i2c_t *obj, int last) {
627627
}
628628
}
629629

630-
/* Enable reload mode as we don't know how many bytes will eb sent */
631-
handle->Instance->CR2 |= I2C_CR2_RELOAD;
632-
/* Set transfer size to 1 */
633-
handle->Instance->CR2 |= (I2C_CR2_NBYTES & (1 << 16));
630+
/* Enable reload mode as we don't know how many bytes will be sent */
631+
/* and set transfer size to 1 */
632+
tmpreg |= I2C_CR2_RELOAD | (I2C_CR2_NBYTES & (1 << 16));
634633
/* Set the prepared configuration */
635634
handle->Instance->CR2 = tmpreg;
636635

0 commit comments

Comments
 (0)