Skip to content

Commit c8b96ad

Browse files
committed
i2c initialization sequence
1 parent 2344777 commit c8b96ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/i2c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ macro_rules! i2c {
202202
let timing_bits = config.timing_bits(rcc.clocks.apb_clk);
203203
i2c.timingr.write(|w| unsafe { w.bits(timing_bits) });
204204

205-
// Enable pins
206-
sda.setup();
207-
scl.setup();
208-
209205
// Enable the I2C processing
210206
i2c.cr1.modify(|_, w| unsafe {
211207
w.pe()
@@ -216,6 +212,10 @@ macro_rules! i2c {
216212
.bit(!config.analog_filter)
217213
});
218214

215+
// Enable pins
216+
sda.setup();
217+
scl.setup();
218+
219219
I2c { i2c, sda, scl }
220220
}
221221

0 commit comments

Comments
 (0)