aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob McWhirter <[email protected]>2021-06-03 10:13:11 -0400
committerBob McWhirter <[email protected]>2021-06-03 13:12:38 -0400
commitd4d914ea502fcd1a50a4d1f509617c0783f91740 (patch)
tree0f9e92fcf79e00b121b1488b871f6ae4ba68573b
parentbe180c1c521694193f011bba4169cebe41c8dee2 (diff)
Remove the Option around the pins Vec.
-rw-r--r--stm32-metapac/build.rs31
1 files changed, 15 insertions, 16 deletions
diff --git a/stm32-metapac/build.rs b/stm32-metapac/build.rs
index 1d0696ba9..046bc11f3 100644
--- a/stm32-metapac/build.rs
+++ b/stm32-metapac/build.rs
@@ -41,7 +41,7 @@ pub struct Peripheral {
41 #[serde(default)] 41 #[serde(default)]
42 pub clock: Option<String>, 42 pub clock: Option<String>,
43 #[serde(default)] 43 #[serde(default)]
44 pub pins: Option<Vec<Pin>>, 44 pub pins: Vec<Pin>,
45} 45}
46 46
47#[derive(Debug, Eq, PartialEq, Clone, Deserialize)] 47#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
@@ -52,11 +52,12 @@ pub struct Pin {
52} 52}
53 53
54struct BlockInfo { 54struct BlockInfo {
55 /// usart_v1/USART -> usart
55 module: String, 56 module: String,
56 // usart_v1/USART -> usart 57 /// usart_v1/USART -> v1
57 version: String, 58 version: String,
58 // usart_v1/USART -> v1 59 /// usart_v1/USART -> USART
59 block: String, // usart_v1/USART -> USART 60 block: String,
60} 61}
61 62
62impl BlockInfo { 63impl BlockInfo {
@@ -161,19 +162,17 @@ fn main() {
161 if let Some(block) = &p.block { 162 if let Some(block) = &p.block {
162 let bi = BlockInfo::parse(block); 163 let bi = BlockInfo::parse(block);
163 164
164 if let Some(pins) = &p.pins { 165 for pin in &p.pins {
165 for pin in pins { 166 let mut row = Vec::new();
166 let mut row = Vec::new(); 167 row.push(name.clone());
167 row.push(name.clone()); 168 row.push(bi.module.clone());
168 row.push(bi.module.clone()); 169 row.push(bi.block.clone());
169 row.push(bi.block.clone()); 170 row.push(pin.pin.clone());
170 row.push(pin.pin.clone()); 171 row.push(pin.signal.clone());
171 row.push(pin.signal.clone()); 172 if let Some(ref af) = pin.af {
172 if let Some(ref af) = pin.af { 173 row.push(af.clone());
173 row.push(af.clone());
174 }
175 peripheral_pins_table.push(row);
176 } 174 }
175 peripheral_pins_table.push(row);
177 } 176 }
178 177
179 178