Remove the Option around the pins Vec.
This commit is contained in:
parent
be180c1c52
commit
d4d914ea50
@ -41,7 +41,7 @@ pub struct Peripheral {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub clock: Option<String>,
|
pub clock: Option<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub pins: Option<Vec<Pin>>,
|
pub pins: Vec<Pin>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
|
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
|
||||||
@ -52,11 +52,12 @@ pub struct Pin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct BlockInfo {
|
struct BlockInfo {
|
||||||
|
/// usart_v1/USART -> usart
|
||||||
module: String,
|
module: String,
|
||||||
// usart_v1/USART -> usart
|
/// usart_v1/USART -> v1
|
||||||
version: String,
|
version: String,
|
||||||
// usart_v1/USART -> v1
|
/// usart_v1/USART -> USART
|
||||||
block: String, // usart_v1/USART -> USART
|
block: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockInfo {
|
impl BlockInfo {
|
||||||
@ -161,19 +162,17 @@ fn main() {
|
|||||||
if let Some(block) = &p.block {
|
if let Some(block) = &p.block {
|
||||||
let bi = BlockInfo::parse(block);
|
let bi = BlockInfo::parse(block);
|
||||||
|
|
||||||
if let Some(pins) = &p.pins {
|
for pin in &p.pins {
|
||||||
for pin in pins {
|
let mut row = Vec::new();
|
||||||
let mut row = Vec::new();
|
row.push(name.clone());
|
||||||
row.push(name.clone());
|
row.push(bi.module.clone());
|
||||||
row.push(bi.module.clone());
|
row.push(bi.block.clone());
|
||||||
row.push(bi.block.clone());
|
row.push(pin.pin.clone());
|
||||||
row.push(pin.pin.clone());
|
row.push(pin.signal.clone());
|
||||||
row.push(pin.signal.clone());
|
if let Some(ref af) = pin.af {
|
||||||
if let Some(ref af) = pin.af {
|
row.push(af.clone());
|
||||||
row.push(af.clone());
|
|
||||||
}
|
|
||||||
peripheral_pins_table.push(row);
|
|
||||||
}
|
}
|
||||||
|
peripheral_pins_table.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user