@@ -62,10 +62,7 @@ fn merge_pins_by_port(pins: &[gpio::Pin]) -> Result<Vec<Port>> {
62
62
fn gen_gpio_macro_call ( ports : & [ Port ] , feature : & str ) -> Result < ( ) > {
63
63
println ! ( "gpio!({{" ) ;
64
64
65
- let mut pac_modules: Vec < _ > = ports. iter ( ) . map ( |port| get_port_pac_module ( port, feature) ) . collect ( ) ;
66
- pac_modules. sort ( ) ;
67
- pac_modules. dedup ( ) ;
68
- println ! ( " pacs: [{}]," , pac_modules. join( ", " ) ) ;
65
+ gen_pac_list ( ports, feature) ;
69
66
70
67
println ! ( " ports: [" ) ;
71
68
for port in ports {
@@ -77,6 +74,16 @@ fn gen_gpio_macro_call(ports: &[Port], feature: &str) -> Result<()> {
77
74
Ok ( ( ) )
78
75
}
79
76
77
+ fn gen_pac_list ( ports : & [ Port ] , feature : & str ) {
78
+ let mut pac_modules: Vec < _ > = ports
79
+ . iter ( )
80
+ . map ( |port| get_port_pac_module ( port, feature) )
81
+ . collect ( ) ;
82
+ pac_modules. sort_unstable ( ) ;
83
+ pac_modules. dedup ( ) ;
84
+ println ! ( " pacs: [{}]," , pac_modules. join( ", " ) ) ;
85
+ }
86
+
80
87
fn gen_port ( port : & Port , feature : & str ) -> Result < ( ) > {
81
88
let pac_module = get_port_pac_module ( port, feature) ;
82
89
@@ -117,10 +124,7 @@ fn gen_pin(pin: &gpio::Pin) -> Result<()> {
117
124
118
125
println ! (
119
126
" {} => {{ reset: {}, afr: {}, af: {:?} }}," ,
120
- nr,
121
- reset_mode,
122
- afr,
123
- af_numbers,
127
+ nr, reset_mode, afr, af_numbers,
124
128
) ;
125
129
126
130
Ok ( ( ) )
@@ -142,7 +146,7 @@ fn get_pin_af_numbers(pin: &gpio::Pin) -> Result<Vec<u8>> {
142
146
numbers. push ( signal. af ( ) ?) ;
143
147
}
144
148
145
- numbers. sort ( ) ;
149
+ numbers. sort_unstable ( ) ;
146
150
numbers. dedup ( ) ;
147
151
148
152
Ok ( numbers)
0 commit comments