Correct issue with port speed not changing.
The current implementation will not change speed if Wire.setClock is called after begin() since the flags are only applied when the port is enabled from being disabled. Corrected that by adding 2 lines to disable the port, and then enable it again with the new settings. Tested and confirmed the new speed is applied.
This commit is contained in:
parent
81100beeea
commit
799f2b3b8a
|
@ -97,7 +97,8 @@ void HardWire::setClock(uint32_t frequencyHz)
|
||||||
dev_flags &= ~I2C_FAST_MODE;// clear FAST_MODE bit
|
dev_flags &= ~I2C_FAST_MODE;// clear FAST_MODE bit
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
i2c_disable(sel_hard);
|
||||||
|
i2c_master_enable(sel_hard, dev_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
HardWire Wire(1);
|
HardWire Wire(1);
|
||||||
|
|
Loading…
Reference in New Issue