Skip to content

Commit

Permalink
i2s frequency relative to sysclk
Browse files Browse the repository at this point in the history
  • Loading branch information
vinsynth committed Dec 14, 2024
1 parent 854d1f3 commit ffbef93
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions embassy-rp/src/pio_programs/i2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl<'a, P: Instance, const S: usize> PioI2sOut<'a, P, S> {
data_pin: impl PioPin,
bit_clock_pin: impl PioPin,
lr_clock_pin: impl PioPin,
sysclk_frequency: u32,
sample_rate: u32,
bit_depth: u32,
channels: u32,
Expand All @@ -68,7 +67,7 @@ impl<'a, P: Instance, const S: usize> PioI2sOut<'a, P, S> {
cfg.use_program(&program.prg, &[&bit_clock_pin, &left_right_clock_pin]);
cfg.set_out_pins(&[&data_pin]);
let clock_frequency = sample_rate * bit_depth * channels;
cfg.clock_divider = (sysclk_frequency as f64 / clock_frequency as f64 / 2.).to_fixed();
cfg.clock_divider = (crate::clocks::clk_sys_freq() as f64 / clock_frequency as f64 / 2.).to_fixed();
cfg.shift_out = ShiftConfig {
threshold: 32,
direction: ShiftDirection::Left,
Expand Down

0 comments on commit ffbef93

Please sign in to comment.