diff options
| author | vinsynth <[email protected]> | 2024-12-14 11:02:18 -0500 |
|---|---|---|
| committer | vinsynth <[email protected]> | 2024-12-14 11:02:18 -0500 |
| commit | ffbef9316d523724d050f32e800668a56e534657 (patch) | |
| tree | 8ddda3acda53ed827a39afa88e57f3e084e40635 /embassy-rp/src/pio_programs | |
| parent | 854d1f3743e8759095bbcd25fb0d73884562ee9d (diff) | |
i2s frequency relative to sysclk
Diffstat (limited to 'embassy-rp/src/pio_programs')
| -rw-r--r-- | embassy-rp/src/pio_programs/i2s.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs index 8989afb4c..87fb2e19f 100644 --- a/embassy-rp/src/pio_programs/i2s.rs +++ b/embassy-rp/src/pio_programs/i2s.rs | |||
| @@ -51,7 +51,6 @@ impl<'a, P: Instance, const S: usize> PioI2sOut<'a, P, S> { | |||
| 51 | data_pin: impl PioPin, | 51 | data_pin: impl PioPin, |
| 52 | bit_clock_pin: impl PioPin, | 52 | bit_clock_pin: impl PioPin, |
| 53 | lr_clock_pin: impl PioPin, | 53 | lr_clock_pin: impl PioPin, |
| 54 | sysclk_frequency: u32, | ||
| 55 | sample_rate: u32, | 54 | sample_rate: u32, |
| 56 | bit_depth: u32, | 55 | bit_depth: u32, |
| 57 | channels: u32, | 56 | channels: u32, |
| @@ -68,7 +67,7 @@ impl<'a, P: Instance, const S: usize> PioI2sOut<'a, P, S> { | |||
| 68 | cfg.use_program(&program.prg, &[&bit_clock_pin, &left_right_clock_pin]); | 67 | cfg.use_program(&program.prg, &[&bit_clock_pin, &left_right_clock_pin]); |
| 69 | cfg.set_out_pins(&[&data_pin]); | 68 | cfg.set_out_pins(&[&data_pin]); |
| 70 | let clock_frequency = sample_rate * bit_depth * channels; | 69 | let clock_frequency = sample_rate * bit_depth * channels; |
| 71 | cfg.clock_divider = (sysclk_frequency as f64 / clock_frequency as f64 / 2.).to_fixed(); | 70 | cfg.clock_divider = (crate::clocks::clk_sys_freq() as f64 / clock_frequency as f64 / 2.).to_fixed(); |
| 72 | cfg.shift_out = ShiftConfig { | 71 | cfg.shift_out = ShiftConfig { |
| 73 | threshold: 32, | 72 | threshold: 32, |
| 74 | direction: ShiftDirection::Left, | 73 | direction: ShiftDirection::Left, |
