Skip to content

Commit

Permalink
Merge pull request #14915 from arduino/i2c_timing_fix
Browse files Browse the repository at this point in the history
STM32 Fix i2c_compute_timing() API
  • Loading branch information
0xc0170 authored Jul 13, 2021
2 parents 9a59145 + ccf8995 commit 16d3e99
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions targets/TARGET_STM/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,9 @@ uint32_t i2c_compute_timing(uint32_t clock_src_freq, uint32_t i2c_freq)
uint32_t speed;
uint32_t idx;

/* Reset valid timing count at the beginning of each new computation */
I2c_valid_timing_nbr = 0;

if ((clock_src_freq != 0U) && (i2c_freq != 0U)) {
for (speed = 0 ; speed <= (uint32_t)I2C_SPEED_FREQ_FAST_PLUS ; speed++) {
if ((i2c_freq >= I2C_Charac[speed].freq_min) &&
Expand Down

0 comments on commit 16d3e99

Please sign in to comment.