Skip to content

Commit 9208733

Browse files
authored
RP2040 handle the 500Khz case (#706)
1 parent 3880986 commit 9208733

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ pub fn apply(config: Config) void {
6060
});
6161

6262
if (config.sample_frequency) |sample_frequency| {
63+
assert(sample_frequency <= 500_000);
6364
const cycles = (48_000_000 * 256) / @as(u64, sample_frequency);
6465
ADC.DIV.write(.{
6566
.FRAC = @as(u8, @truncate(cycles)),
66-
.INT = @as(u16, @intCast((cycles >> 8) - 1)),
67+
.INT = @as(u16, @intCast((cycles >> 8))),
6768
});
6869
}
6970

0 commit comments

Comments
 (0)