Skip to content

Commit daa53b7

Browse files
committed
Use u64 instead of float
1 parent bb0e025 commit daa53b7

File tree

1 file changed

+2
-2
lines changed
  • port/raspberrypi/rp2xxx/src/hal

1 file changed

+2
-2
lines changed

port/raspberrypi/rp2xxx/src/hal/i2c.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ fn translate_baudrate(baud_rate: u32, freq_in: u32) ConfigError!TimingRegisterVa
109109
// that means the input clock frequency is too low (not granular enough).
110110
// This also serves as a nice sanity check that we're still in spec no matter
111111
// the baud rate.
112-
const scl_low_ns = (1_000_000_000.0 / @as(f64, @floatFromInt(freq_in))) * @as(f64, @floatFromInt(scl_lcnt_with_additions));
113-
const scl_high_ns = (1_000_000_000.0 / @as(f64, @floatFromInt(freq_in))) * @as(f64, @floatFromInt(scl_hcnt_with_additions));
112+
const scl_low_ns: u64 = @as(u64, scl_lcnt_with_additions) * 1_000_000_000 / freq_in;
113+
const scl_high_ns: u64 = @as(u64, scl_hcnt_with_additions) * 1_000_000_000 / freq_in;
114114
switch (baud_rate) {
115115
1...100_000 => {
116116
const i2c_normal_scl_low_min_ns = 4700;

0 commit comments

Comments
 (0)