aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-06-27 01:27:32 +0000
committerGitHub <[email protected]>2025-06-27 01:27:32 +0000
commitfee70dee9988302f325752d2adbc3c4f140a2ec0 (patch)
tree4b0563224b18107146b0d0a12781cf9c03b91ae9 /examples
parent9ee01d9cc6081e53ea17af88904b40294bdda3e8 (diff)
parent686bdae937c26a006ee79b89931a6966141066dd (diff)
Merge pull request #4349 from melvdlin/stm32h723-example-fix
[stm32h723]: fix spdifrx example
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32h723/src/bin/spdifrx.rs24
1 files changed, 12 insertions, 12 deletions
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
8use defmt::{info, trace}; 8use defmt::{info, trace};
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_futures::select::{self, select, Either}; 10use embassy_futures::select::{select, Either};
11use embassy_stm32::spdifrx::{self, Spdifrx}; 11use embassy_stm32::spdifrx::{self, Spdifrx};
12use embassy_stm32::{bind_interrupts, peripherals, sai}; 12use embassy_stm32::{bind_interrupts, peripherals, sai, Peri};
13use grounded::uninit::GroundedArrayCell; 13use grounded::uninit::GroundedArrayCell;
14use hal::sai::*; 14use hal::sai::*;
15use {defmt_rtt as _, embassy_stm32 as hal, panic_probe as _}; 15use {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")]
28static mut SPDIFRX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); 28static SPDIFRX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit();
29 29
30#[unsafe(link_section = ".sram4")] 30#[unsafe(link_section = ".sram4")]
31static mut SAI_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); 31static SAI_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit();
32 32
33#[embassy_executor::main] 33#[embassy_executor::main]
34async fn main(_spawner: Spawner) { 34async 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).
146fn new_spdif_receiver<'d>( 146fn 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).
158fn new_sai_transmitter<'d>( 158fn 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();