Skip to content

Commit

Permalink
esp32/i2c: Use idf function for calculating main timeout.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
  • Loading branch information
pi-anl committed Sep 16, 2024
1 parent f1bdac3 commit 919c85f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ports/esp32/machine_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void machine_hw_i2c_init(machine_hw_i2c_obj_t *self, uint32_t freq, uint3
.master.clk_speed = freq,
};
i2c_param_config(self->port, &conf);
int timeout = I2C_SCLK_FREQ / 1000000 * timeout_us;
int timeout = i2c_ll_calculate_timeout_us_to_reg_val(I2C_SCLK_FREQ, timeout_us);
i2c_set_timeout(self->port, (timeout > I2C_LL_MAX_TIMEOUT) ? I2C_LL_MAX_TIMEOUT : timeout);
i2c_driver_install(self->port, I2C_MODE_MASTER, 0, 0, 0);
}
Expand Down

0 comments on commit 919c85f

Please sign in to comment.