Skip to content

Commit 3599c72

Browse files
committed
Fully generate pins in metadata
1 parent 18648b7 commit 3599c72

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

mspm0-metapac-gen/res/metadata.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ pub struct PinCmMapping {
2222
pub pincm: u8,
2323
}
2424

25-
// This feels wrong here...
2625
#[derive(Debug, Eq, PartialEq, Clone)]
2726
pub struct PeripheralPin {
2827
pub pin: &'static str,
2928
pub signal: &'static str,
30-
pub pincm: Option<u8>,
29+
pub pf: Option<u8>,
3130
}
3231

3332
#[derive(Debug, Eq, PartialEq, Clone)]

mspm0-metapac-gen/src/metadata.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,25 @@ fn generate_peripheral(peripheral: &Peripheral) -> Option<TokenStream> {
8181
let name = &peripheral.name;
8282
let kind = &peripheral.ty.to_string();
8383

84-
let pins = Vec::<TokenStream>::new();
85-
86-
// for pin in peripheral.pins.iter() {
87-
// let name = &pin.name;
84+
let mut pins = Vec::<TokenStream>::new();
85+
86+
for pin in peripheral.pins.iter() {
87+
let name = &pin.pin;
88+
let signal = &pin.signal;
89+
let pf = match pin.pf {
90+
Some(pf) => quote! { Some(#pf) },
91+
None => quote! { None },
92+
};
8893

89-
// pins.push(quote! {
90-
// PeripheralPin {
91-
// pin: #name
92-
// }
93-
// });
94-
// }
94+
pins.push(quote! {
95+
PeripheralPin {
96+
pin: #name,
97+
signal: #signal,
98+
pf: #pf,
99+
}
100+
});
101+
}
95102

96-
// TODO: Maybe this is the wrong spot?
97103
Some(quote! {
98104
Peripheral {
99105
name: #name,

0 commit comments

Comments
 (0)