diff --git a/stm32-data-gen/src/dma.rs b/stm32-data-gen/src/dma.rs index 6c217e8e1..61178db5c 100644 --- a/stm32-data-gen/src/dma.rs +++ b/stm32-data-gen/src/dma.rs @@ -164,6 +164,7 @@ impl DmaChannels { signal: request.to_string(), channel: None, dmamux: Some(req_dmamux.to_string()), + remap: None, request: Some(request_num), dma: None, }) @@ -246,6 +247,16 @@ impl DmaChannels { let parts: Vec<_> = original_target_name.split(':').collect(); let target_name = parts[0]; + let remap = if parts.len() > 1 && parts[1].contains("Remap") { + match parts[1].chars().last().unwrap() { + '0' => Some(false), + '1' => Some(true), + _ => None, + } + } else { + None + }; + // Chips with single DAC refer to channels by DAC1/DAC2 let target_name = match target_name { "DAC1" => "DAC_CH1", @@ -274,6 +285,7 @@ impl DmaChannels { signal: request.to_string(), channel: Some(format!("{dma_peri_name}_CH{channel_name}")), dmamux: None, + remap, request: requests.get(&original_target_name).copied(), dma: None, }; @@ -339,6 +351,7 @@ impl DmaChannels { dma: Some(instance.to_string()), channel: None, dmamux: None, + remap: None, request: Some(request_num), }); } diff --git a/stm32-data-serde/src/lib.rs b/stm32-data-serde/src/lib.rs index b45cbc128..06f971413 100644 --- a/stm32-data-serde/src/lib.rs +++ b/stm32-data-serde/src/lib.rs @@ -228,6 +228,8 @@ pub mod chip { #[serde(skip_serializing_if = "Option::is_none")] pub dmamux: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub remap: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub request: Option, } } diff --git a/stm32-metapac-gen/res/src/metadata.rs b/stm32-metapac-gen/res/src/metadata.rs index 96802ed6e..7b98bf563 100644 --- a/stm32-metapac-gen/res/src/metadata.rs +++ b/stm32-metapac-gen/res/src/metadata.rs @@ -243,5 +243,6 @@ pub struct PeripheralDmaChannel { pub channel: Option<&'static str>, pub dmamux: Option<&'static str>, pub dma: Option<&'static str>, + pub remap: Option, pub request: Option, } diff --git a/stm32-metapac-gen/src/data.rs b/stm32-metapac-gen/src/data.rs index dc24d63fe..9b2457985 100644 --- a/stm32-metapac-gen/src/data.rs +++ b/stm32-metapac-gen/src/data.rs @@ -449,6 +449,7 @@ pub struct PeripheralDmaChannel { pub signal: String, pub channel: Option, pub dmamux: Option, + pub remap: Option, pub dma: Option, pub request: Option, }