Skip to content

Commit 455c2ec

Browse files
committed
STM32: I2C: remove debug code
Few debug lines were to be removed / updated. Move the printf to DEBUG_PRINTF and return the error when needed.
1 parent 517d0d9 commit 455c2ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

targets/TARGET_STM/i2c_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ int i2c_byte_read(i2c_t *obj, int last) {
621621
if ((tmpreg & I2C_CR2_RELOAD) != 0) {
622622
while (!__HAL_I2C_GET_FLAG(handle, I2C_FLAG_TCR)) {
623623
if ((timeout--) == 0) {
624-
printf("timeout in byte_read\r\n");
625-
//return 2;
624+
DEBUG_PRINTF("timeout in byte_read\r\n");
625+
return 2;
626626
}
627627
}
628628
}
@@ -688,8 +688,8 @@ int i2c_byte_write(i2c_t *obj, int data) {
688688
if ((tmpreg & I2C_CR2_RELOAD) != 0) {
689689
while (!__HAL_I2C_GET_FLAG(handle, I2C_FLAG_TCR)) {
690690
if ((timeout--) == 0) {
691-
printf("timeout in byte_write\r\n");
692-
//return 2;
691+
DEBUG_PRINTF("timeout in byte_write\r\n");
692+
return 2;
693693
}
694694
}
695695
}

0 commit comments

Comments
 (0)