diff options
| author | vinsynth <[email protected]> | 2024-12-14 00:32:47 -0500 |
|---|---|---|
| committer | vinsynth <[email protected]> | 2024-12-14 00:32:47 -0500 |
| commit | 854d1f3743e8759095bbcd25fb0d73884562ee9d (patch) | |
| tree | f731a364009b27864a9b5cef713fcfbad5da0751 /embassy-rp/src/pio_programs | |
| parent | 45d9bd57575d9391a68334a2f3966b92032d5dc6 (diff) | |
add sysclk frequency argument to PioI2Out::new
Diffstat (limited to 'embassy-rp/src/pio_programs')
| -rw-r--r-- | embassy-rp/src/pio_programs/i2s.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/embassy-rp/src/pio_programs/i2s.rs b/embassy-rp/src/pio_programs/i2s.rs index e3f1f89d4..8989afb4c 100644 --- a/embassy-rp/src/pio_programs/i2s.rs +++ b/embassy-rp/src/pio_programs/i2s.rs | |||
| @@ -51,6 +51,7 @@ 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, | ||
| 54 | sample_rate: u32, | 55 | sample_rate: u32, |
| 55 | bit_depth: u32, | 56 | bit_depth: u32, |
| 56 | channels: u32, | 57 | channels: u32, |
| @@ -67,7 +68,7 @@ impl<'a, P: Instance, const S: usize> PioI2sOut<'a, P, S> { | |||
| 67 | cfg.use_program(&program.prg, &[&bit_clock_pin, &left_right_clock_pin]); | 68 | cfg.use_program(&program.prg, &[&bit_clock_pin, &left_right_clock_pin]); |
| 68 | cfg.set_out_pins(&[&data_pin]); | 69 | cfg.set_out_pins(&[&data_pin]); |
| 69 | let clock_frequency = sample_rate * bit_depth * channels; | 70 | let clock_frequency = sample_rate * bit_depth * channels; |
| 70 | cfg.clock_divider = (125_000_000. / clock_frequency as f64 / 2.).to_fixed(); | 71 | cfg.clock_divider = (sysclk_frequency as f64 / clock_frequency as f64 / 2.).to_fixed(); |
| 71 | cfg.shift_out = ShiftConfig { | 72 | cfg.shift_out = ShiftConfig { |
| 72 | threshold: 32, | 73 | threshold: 32, |
| 73 | direction: ShiftDirection::Left, | 74 | direction: ShiftDirection::Left, |
