@@ -258,15 +258,21 @@ pub trait CompRefPin {
258258 fn aref ( & self ) -> EXTREFSEL_A ;
259259}
260260
261- macro_rules! analog_pins {
262- ( $( $pin: path => ( $ain: expr, $aref : expr ) , ) +) => {
261+ macro_rules! comp_input_pins {
262+ ( $( $pin: path => $ain: expr, ) +) => {
263263 $(
264264 impl CompInputPin for $pin {
265265 fn ain( & self ) -> PSEL_A {
266266 $ain
267267 }
268268 }
269+ ) *
270+ } ;
271+ }
269272
273+ macro_rules! comp_ref_pins {
274+ ( $( $pin: path => $aref: expr, ) +) => {
275+ $(
270276 impl CompRefPin for $pin {
271277 fn aref( & self ) -> EXTREFSEL_A {
272278 $aref
@@ -276,25 +282,36 @@ macro_rules! analog_pins {
276282 } ;
277283}
278284
285+ comp_ref_pins ! {
286+ P0_02 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE0 ,
287+ P0_03 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE1 ,
288+ P0_04 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE2 ,
289+ P0_05 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE3 ,
290+ P0_28 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE4 ,
291+ P0_29 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE5 ,
292+ P0_30 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE6 ,
293+ P0_31 <Input <Floating >> => EXTREFSEL_A :: ANALOGREFERENCE7 ,
294+ }
295+
279296#[ cfg( not( feature = "52810" ) ) ]
280- analog_pins ! {
281- P0_02 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT0 , EXTREFSEL_A :: ANALOGREFERENCE0 ) ,
282- P0_03 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT1 , EXTREFSEL_A :: ANALOGREFERENCE1 ) ,
283- P0_04 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT2 , EXTREFSEL_A :: ANALOGREFERENCE2 ) ,
284- P0_05 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT3 , EXTREFSEL_A :: ANALOGREFERENCE3 ) ,
285- P0_28 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT4 , EXTREFSEL_A :: ANALOGREFERENCE4 ) ,
286- P0_29 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT5 , EXTREFSEL_A :: ANALOGREFERENCE5 ) ,
287- P0_30 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT6 , EXTREFSEL_A :: ANALOGREFERENCE6 ) ,
288- P0_31 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT7 , EXTREFSEL_A :: ANALOGREFERENCE7 ) ,
297+ comp_input_pins ! {
298+ P0_02 <Input <Floating >> => PSEL_A :: ANALOGINPUT0 ,
299+ P0_03 <Input <Floating >> => PSEL_A :: ANALOGINPUT1 ,
300+ P0_04 <Input <Floating >> => PSEL_A :: ANALOGINPUT2 ,
301+ P0_05 <Input <Floating >> => PSEL_A :: ANALOGINPUT3 ,
302+ P0_28 <Input <Floating >> => PSEL_A :: ANALOGINPUT4 ,
303+ P0_29 <Input <Floating >> => PSEL_A :: ANALOGINPUT5 ,
304+ P0_30 <Input <Floating >> => PSEL_A :: ANALOGINPUT6 ,
305+ P0_31 <Input <Floating >> => PSEL_A :: ANALOGINPUT7 ,
289306}
290307
291308#[ cfg( feature = "52810" ) ]
292- analog_pins ! {
293- P0_02 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT0 , EXTREFSEL_A :: ANALOGREFERENCE0 ) ,
294- P0_03 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT1 , EXTREFSEL_A :: ANALOGREFERENCE1 ) ,
295- P0_04 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT2 , EXTREFSEL_A :: ANALOGREFERENCE2 ) ,
296- P0_05 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT3 , EXTREFSEL_A :: ANALOGREFERENCE3 ) ,
297- P0_28 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT4 , EXTREFSEL_A :: ANALOGREFERENCE4 ) ,
298- P0_29 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT5 , EXTREFSEL_A :: ANALOGREFERENCE5 ) ,
299- P0_30 <Input <Floating >> => ( PSEL_A :: ANALOGINPUT6 , EXTREFSEL_A :: ANALOGREFERENCE6 ) ,
309+ comp_input_pins ! {
310+ P0_02 <Input <Floating >> => PSEL_A :: ANALOGINPUT0 ,
311+ P0_03 <Input <Floating >> => PSEL_A :: ANALOGINPUT1 ,
312+ P0_04 <Input <Floating >> => PSEL_A :: ANALOGINPUT2 ,
313+ P0_05 <Input <Floating >> => PSEL_A :: ANALOGINPUT3 ,
314+ P0_28 <Input <Floating >> => PSEL_A :: ANALOGINPUT4 ,
315+ P0_29 <Input <Floating >> => PSEL_A :: ANALOGINPUT5 ,
316+ P0_30 <Input <Floating >> => PSEL_A :: ANALOGINPUT6 ,
300317}
0 commit comments