Skip to content

Commit 89e0601

Browse files
committed
Update I2CTarget.c
Correction of the timeout value range needed to set the timeout to 'forever'. The line 162 checks timeout for a value of 0 while the function definition defaults timeout to -1. In the current version of the code timeout is only checked for a value of 0 or in the 'else if' part for a value of > 0. So, values of <0 will not be taken in to account. That is the reason of my modification.
1 parent 0417663 commit 89e0601

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shared-bindings/i2ctarget/I2CTarget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ STATIC mp_obj_t i2ctarget_i2c_target_request(size_t n_args, const mp_obj_t *pos_
159159

160160
bool forever = false;
161161
uint64_t timeout_end = 0;
162-
if (timeout_ms == 0) {
162+
if (timeout_ms <= 0) {
163163
forever = true;
164164
} else if (timeout_ms > 0) {
165165
timeout_end = common_hal_time_monotonic_ms() + timeout_ms;

0 commit comments

Comments
 (0)