diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-06-27 01:27:32 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-27 01:27:32 +0000 |
| commit | fee70dee9988302f325752d2adbc3c4f140a2ec0 (patch) | |
| tree | 4b0563224b18107146b0d0a12781cf9c03b91ae9 | |
| parent | 9ee01d9cc6081e53ea17af88904b40294bdda3e8 (diff) | |
| parent | 686bdae937c26a006ee79b89931a6966141066dd (diff) | |
Merge pull request #4349 from melvdlin/stm32h723-example-fix
[stm32h723]: fix spdifrx example
| -rwxr-xr-x | ci.sh | 1 | ||||
| -rw-r--r-- | examples/stm32h723/src/bin/spdifrx.rs | 24 |
2 files changed, 13 insertions, 12 deletions
| @@ -246,6 +246,7 @@ cargo batch \ | |||
| 246 | --- build --release --manifest-path examples/stm32h5/Cargo.toml --target thumbv8m.main-none-eabihf --artifact-dir out/examples/stm32h5 \ | 246 | --- build --release --manifest-path examples/stm32h5/Cargo.toml --target thumbv8m.main-none-eabihf --artifact-dir out/examples/stm32h5 \ |
| 247 | --- build --release --manifest-path examples/stm32h7/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h7 \ | 247 | --- build --release --manifest-path examples/stm32h7/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h7 \ |
| 248 | --- build --release --manifest-path examples/stm32h7b0/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h7b0 \ | 248 | --- build --release --manifest-path examples/stm32h7b0/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h7b0 \ |
| 249 | --- build --release --manifest-path examples/stm32h723/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h723 \ | ||
| 249 | --- build --release --manifest-path examples/stm32h735/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h735 \ | 250 | --- build --release --manifest-path examples/stm32h735/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h735 \ |
| 250 | --- build --release --manifest-path examples/stm32h755cm4/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h755cm4 \ | 251 | --- build --release --manifest-path examples/stm32h755cm4/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h755cm4 \ |
| 251 | --- build --release --manifest-path examples/stm32h755cm7/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h755cm7 \ | 252 | --- build --release --manifest-path examples/stm32h755cm7/Cargo.toml --target thumbv7em-none-eabi --artifact-dir out/examples/stm32h755cm7 \ |
diff --git a/examples/stm32h723/src/bin/spdifrx.rs b/examples/stm32h723/src/bin/spdifrx.rs index a04d7cb34..6d29e8a4d 100644 --- a/examples/stm32h723/src/bin/spdifrx.rs +++ b/examples/stm32h723/src/bin/spdifrx.rs | |||
| @@ -7,9 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | use defmt::{info, trace}; | 8 | use defmt::{info, trace}; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_futures::select::{self, select, Either}; | 10 | use embassy_futures::select::{select, Either}; |
| 11 | use embassy_stm32::spdifrx::{self, Spdifrx}; | 11 | use embassy_stm32::spdifrx::{self, Spdifrx}; |
| 12 | use embassy_stm32::{bind_interrupts, peripherals, sai}; | 12 | use embassy_stm32::{bind_interrupts, peripherals, sai, Peri}; |
| 13 | use grounded::uninit::GroundedArrayCell; | 13 | use grounded::uninit::GroundedArrayCell; |
| 14 | use hal::sai::*; | 14 | use hal::sai::*; |
| 15 | use {defmt_rtt as _, embassy_stm32 as hal, panic_probe as _}; | 15 | use {defmt_rtt as _, embassy_stm32 as hal, panic_probe as _}; |
| @@ -25,10 +25,10 @@ const DMA_BUFFER_LENGTH: usize = HALF_DMA_BUFFER_LENGTH * 2; // 2 half-blocks | |||
| 25 | 25 | ||
| 26 | // DMA buffers must be in special regions. Refer https://embassy.dev/book/#_stm32_bdma_only_working_out_of_some_ram_regions | 26 | // DMA buffers must be in special regions. Refer https://embassy.dev/book/#_stm32_bdma_only_working_out_of_some_ram_regions |
| 27 | #[unsafe(link_section = ".sram1")] | 27 | #[unsafe(link_section = ".sram1")] |
| 28 | static mut SPDIFRX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); | 28 | static SPDIFRX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); |
| 29 | 29 | ||
| 30 | #[unsafe(link_section = ".sram4")] | 30 | #[unsafe(link_section = ".sram4")] |
| 31 | static mut SAI_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); | 31 | static SAI_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); |
| 32 | 32 | ||
| 33 | #[embassy_executor::main] | 33 | #[embassy_executor::main] |
| 34 | async fn main(_spawner: Spawner) { | 34 | async fn main(_spawner: Spawner) { |
| @@ -144,9 +144,9 @@ async fn main(_spawner: Spawner) { | |||
| 144 | /// | 144 | /// |
| 145 | /// Used (again) after dropping the SPDIFRX instance, in case of errors (e.g. source disconnect). | 145 | /// Used (again) after dropping the SPDIFRX instance, in case of errors (e.g. source disconnect). |
| 146 | fn new_spdif_receiver<'d>( | 146 | fn new_spdif_receiver<'d>( |
| 147 | spdifrx: &'d mut peripherals::SPDIFRX1, | 147 | spdifrx: Peri<'d, peripherals::SPDIFRX1>, |
| 148 | input_pin: &'d mut peripherals::PD7, | 148 | input_pin: Peri<'d, peripherals::PD7>, |
| 149 | dma: &'d mut peripherals::DMA2_CH7, | 149 | dma: Peri<'d, peripherals::DMA2_CH7>, |
| 150 | buf: &'d mut [u32], | 150 | buf: &'d mut [u32], |
| 151 | ) -> Spdifrx<'d, peripherals::SPDIFRX1> { | 151 | ) -> Spdifrx<'d, peripherals::SPDIFRX1> { |
| 152 | Spdifrx::new(spdifrx, Irqs, spdifrx::Config::default(), input_pin, dma, buf) | 152 | Spdifrx::new(spdifrx, Irqs, spdifrx::Config::default(), input_pin, dma, buf) |
| @@ -156,11 +156,11 @@ fn new_spdif_receiver<'d>( | |||
| 156 | /// | 156 | /// |
| 157 | /// Used (again) after dropping the SAI4 instance, in case of errors (e.g. buffer overrun). | 157 | /// Used (again) after dropping the SAI4 instance, in case of errors (e.g. buffer overrun). |
| 158 | fn new_sai_transmitter<'d>( | 158 | fn new_sai_transmitter<'d>( |
| 159 | sai: &'d mut peripherals::SAI4, | 159 | sai: Peri<'d, peripherals::SAI4>, |
| 160 | sck: &'d mut peripherals::PD13, | 160 | sck: Peri<'d, peripherals::PD13>, |
| 161 | sd: &'d mut peripherals::PC1, | 161 | sd: Peri<'d, peripherals::PC1>, |
| 162 | fs: &'d mut peripherals::PD12, | 162 | fs: Peri<'d, peripherals::PD12>, |
| 163 | dma: &'d mut peripherals::BDMA_CH0, | 163 | dma: Peri<'d, peripherals::BDMA_CH0>, |
| 164 | buf: &'d mut [u32], | 164 | buf: &'d mut [u32], |
| 165 | ) -> Sai<'d, peripherals::SAI4, u32> { | 165 | ) -> Sai<'d, peripherals::SAI4, u32> { |
| 166 | let mut sai_config = hal::sai::Config::default(); | 166 | let mut sai_config = hal::sai::Config::default(); |
