8000 Allow changing I2C clock speed while running (#459) · gsexton/arduino-pico@c404660 · GitHub
[go: up one dir, main page]

Skip to content

Commit c404660

Browse files
Allow changing I2C clock speed while running (earlephilhower#459)
Fixes earlephilhower#458
1 parent baf925f commit c404660

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

libraries/Wire/src/Wire.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ bool TwoWire::setSCL(pin_size_t pin) {
8383

8484
void TwoWire::setClock(uint32_t hz) {
8585
_clkHz = hz;
86+
if (_running) {
87+
i2c_set_baudrate(_i2c, hz);
88+
}
8689
}
8790

8891
// Master mode

0 commit comments

Comments
 (0)
0