Fix SAMD I2C frequency check

This commit is contained in:
Dan Halbert 2022-07-29 19:07:33 -04:00
parent 8b2f061563
commit 1348cb435b

View File

@ -123,7 +123,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
// The maximum frequency divisor gives a clock rate of around 48MHz/2/255 // The maximum frequency divisor gives a clock rate of around 48MHz/2/255
// but set_baudrate does not diagnose this problem. (This is not the // but set_baudrate does not diagnose this problem. (This is not the
// exact cutoff, but no frequency well under 100kHz is available) // exact cutoff, but no frequency well under 100kHz is available)
if (frequency < 95000 && if (frequency < 95000 ||
i2c_m_sync_set_baudrate(&self->i2c_desc, 0, frequency / 1000) != ERR_NONE) { i2c_m_sync_set_baudrate(&self->i2c_desc, 0, frequency / 1000) != ERR_NONE) {
reset_pin_number(sda->number); reset_pin_number(sda->number);
reset_pin_number(scl->number); reset_pin_number(scl->number);