File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff 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 ) ]
2726pub 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 ) ]
Original file line number Diff line number Diff 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,
You can’t perform that action at this time.
0 commit comments