@@ -342,31 +342,30 @@ impl<FI> BitReaderRaw<FI> {
342342/// Field reader.
343343///
344344/// Result of the `read` methods of fields.
345- pub type FieldReader < U = u8 , FI = u8 > = FieldReaderRaw < U , FI > ;
345+ pub type FieldReader < N = u8 , FI = u8 > = FieldReaderRaw < N , FI > ;
346346
347347/// Bit-wise field reader
348348pub type BitReader < FI = bool > = BitReaderRaw < FI > ;
349349
350- impl < U , FI > FieldReader < U , FI >
350+ impl < N , FI > FieldReader < N , FI >
351351where
352- U : Copy ,
352+ N : Copy ,
353353{
354354 /// Reads raw bits from field.
355355 #[ inline( always) ]
356- pub fn bits ( & self ) -> U {
356+ pub fn bits ( & self ) -> N {
357357 self . bits
358358 }
359359}
360360
361- impl < U , FI > PartialEq < FI > for FieldReader < U , FI >
361+ impl < N , FI > PartialEq < FI > for FieldReader < N , FI >
362362where
363- U : PartialEq ,
364363 FI : Copy ,
365- U : From < FI > ,
364+ N : PartialEq + From < FI > ,
366365{
367366 #[ inline( always) ]
368367 fn eq ( & self , other : & FI ) -> bool {
369- self . bits . eq ( & U :: from ( * other) )
368+ self . bits . eq ( & N :: from ( * other) )
370369 }
371370}
372371
@@ -405,19 +404,19 @@ pub struct Safe;
405404pub struct Unsafe ;
406405
407406#[ doc( hidden) ]
408- pub struct FieldWriterRaw < ' a , U , REG , const WI : u8 , const O : u8 , N , FI , Safety >
407+ pub struct FieldWriterRaw < ' a , REG , const WI : u8 , const O : u8 , N , FI , Safety >
409408where
410- REG : Writable + RegisterSpec < Ux = U > ,
409+ REG : Writable + RegisterSpec ,
411410 N : From < FI > ,
412411{
413412 pub ( crate ) w : & ' a mut REG :: Writer ,
414413 _field : marker:: PhantomData < ( N , FI , Safety ) > ,
415414}
416415
417- impl < ' a , U , REG , const WI : u8 , const O : u8 , N , FI , Safety >
418- FieldWriterRaw < ' a , U , REG , WI , O , N , FI , Safety >
416+ impl < ' a , REG , const WI : u8 , const O : u8 , N , FI , Safety >
417+ FieldWriterRaw < ' a , REG , WI , O , N , FI , Safety >
419418where
420- REG : Writable + RegisterSpec < Ux = U > ,
419+ REG : Writable + RegisterSpec ,
421420 N : From < FI > ,
422421{
423422 /// Creates a new instance of the writer
@@ -432,18 +431,18 @@ where
432431}
433432
434433#[ doc( hidden) ]
435- pub struct BitWriterRaw < ' a , U , REG , const O : u8 , FI , M >
434+ pub struct BitWriterRaw < ' a , REG , const O : u8 , FI , M >
436435where
437- REG : Writable + RegisterSpec < Ux = U > ,
436+ REG : Writable + RegisterSpec ,
438437 bool : From < FI > ,
439438{
440439 pub ( crate ) w : & ' a mut REG :: Writer ,
441440 _field : marker:: PhantomData < ( FI , M ) > ,
442441}
443442
444- impl < ' a , U , REG , const O : u8 , FI , M > BitWriterRaw < ' a , U , REG , O , FI , M >
443+ impl < ' a , REG , const O : u8 , FI , M > BitWriterRaw < ' a , REG , O , FI , M >
445444where
446- REG : Writable + RegisterSpec < Ux = U > ,
445+ REG : Writable + RegisterSpec ,
447446 bool : From < FI > ,
448447{
449448 /// Creates a new instance of the writer
@@ -458,24 +457,24 @@ where
458457}
459458
460459/// Write field Proxy with unsafe `bits`
461- pub type FieldWriter < ' a , U , REG , const WI : u8 , const O : u8 , N = u8 , FI = u8 > =
462- FieldWriterRaw < ' a , U , REG , WI , O , N , FI , Unsafe > ;
460+ pub type FieldWriter < ' a , REG , const WI : u8 , const O : u8 , N = u8 , FI = u8 > =
461+ FieldWriterRaw < ' a , REG , WI , O , N , FI , Unsafe > ;
463462/// Write field Proxy with safe `bits`
464- pub type FieldWriterSafe < ' a , U , REG , const WI : u8 , const O : u8 , N = u8 , FI = u8 > =
465- FieldWriterRaw < ' a , U , REG , WI , O , N , FI , Safe > ;
463+ pub type FieldWriterSafe < ' a , REG , const WI : u8 , const O : u8 , N = u8 , FI = u8 > =
464+ FieldWriterRaw < ' a , REG , WI , O , N , FI , Safe > ;
466465
467- impl < ' a , U , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriter < ' a , U , REG , WI , OF , N , FI >
466+ impl < ' a , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriter < ' a , REG , WI , OF , N , FI >
468467where
469- REG : Writable + RegisterSpec < Ux = U > ,
468+ REG : Writable + RegisterSpec ,
470469 N : From < FI > ,
471470{
472471 /// Field width
473472 pub const WIDTH : u8 = WI ;
474473}
475474
476- impl < ' a , U , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriterSafe < ' a , U , REG , WI , OF , N , FI >
475+ impl < ' a , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriterSafe < ' a , REG , WI , OF , N , FI >
477476where
478- REG : Writable + RegisterSpec < Ux = U > ,
477+ REG : Writable + RegisterSpec ,
479478 N : From < FI > ,
480479{
481480 /// Field width
@@ -488,11 +487,11 @@ macro_rules! bit_proxy {
488487 pub struct $mwv;
489488
490489 /// Bit-wise write field proxy
491- pub type $writer<' a, U , REG , const O : u8 , FI = bool > = BitWriterRaw <' a, U , REG , O , FI , $mwv>;
490+ pub type $writer<' a, REG , const O : u8 , FI = bool > = BitWriterRaw <' a, REG , O , FI , $mwv>;
492491
493- impl <' a, U , REG , const OF : u8 , FI > $writer<' a, U , REG , OF , FI >
492+ impl <' a, REG , const OF : u8 , FI > $writer<' a, REG , OF , FI >
494493 where
495- REG : Writable + RegisterSpec < Ux = U > ,
494+ REG : Writable + RegisterSpec ,
496495 bool : From <FI >,
497496 {
498497 /// Field width
@@ -503,17 +502,16 @@ macro_rules! bit_proxy {
503502
504503macro_rules! impl_bit_proxy {
505504 ( $writer: ident) => {
506- impl <' a, U , REG , const OF : u8 , FI > $writer<' a, U , REG , OF , FI >
505+ impl <' a, REG , const OF : u8 , FI > $writer<' a, REG , OF , FI >
507506 where
508- REG : Writable + RegisterSpec <Ux = U >,
509- U : RawReg ,
507+ REG : Writable + RegisterSpec ,
510508 bool : From <FI >,
511509 {
512510 /// Writes bit to the field
513511 #[ inline( always) ]
514512 pub fn bit( self , value: bool ) -> & ' a mut REG :: Writer {
515- self . w. bits &= !( U :: one( ) << OF ) ;
516- self . w. bits |= ( U :: from( value) & U :: one( ) ) << OF ;
513+ self . w. bits &= !( REG :: Ux :: one( ) << OF ) ;
514+ self . w. bits |= ( REG :: Ux :: from( value) & REG :: Ux :: one( ) ) << OF ;
517515 self . w
518516 }
519517 /// Writes `variant` to the field
@@ -533,10 +531,10 @@ bit_proxy!(BitWriter0S, Bit0S);
533531bit_proxy ! ( BitWriter1T , Bit1T ) ;
534532bit_proxy ! ( BitWriter0T , Bit0T ) ;
535533
536- impl < ' a , U , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriter < ' a , U , REG , WI , OF , N , FI >
534+ impl < ' a , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriter < ' a , REG , WI , OF , N , FI >
537535where
538- REG : Writable + RegisterSpec < Ux = U > ,
539- U : RawReg + From < N > ,
536+ REG : Writable + RegisterSpec ,
537+ REG :: Ux : From < N > ,
540538 N : From < FI > ,
541539{
542540 /// Writes raw bits to the field
@@ -546,8 +544,8 @@ where
546544 /// Passing incorrect value can cause undefined behaviour. See reference manual
547545 #[ inline( always) ]
548546 pub unsafe fn bits ( self , value : N ) -> & ' a mut REG :: Writer {
549- self . w . bits &= !( U :: mask :: < WI > ( ) << OF ) ;
550- self . w . bits |= ( U :: from ( value) & U :: mask :: < WI > ( ) ) << OF ;
547+ self . w . bits &= !( REG :: Ux :: mask :: < WI > ( ) << OF ) ;
548+ self . w . bits |= ( REG :: Ux :: from ( value) & REG :: Ux :: mask :: < WI > ( ) ) << OF ;
551549 self . w
552550 }
553551 /// Writes `variant` to the field
@@ -556,17 +554,17 @@ where
556554 unsafe { self . bits ( N :: from ( variant) ) }
557555 }
558556}
559- impl < ' a , U , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriterSafe < ' a , U , REG , WI , OF , N , FI >
557+ impl < ' a , REG , const WI : u8 , const OF : u8 , N , FI > FieldWriterSafe < ' a , REG , WI , OF , N , FI >
560558where
561- REG : Writable + RegisterSpec < Ux = U > ,
562- U : RawReg + From < N > ,
559+ REG : Writable + RegisterSpec ,
560+ REG :: Ux : From < N > ,
563561 N : From < FI > ,
564562{
565563 /// Writes raw bits to the field
566564 #[ inline( always) ]
567565 pub fn bits ( self , value : N ) -> & ' a mut REG :: Writer {
568- self . w . bits &= !( U :: mask :: < WI > ( ) << OF ) ;
569- self . w . bits |= ( U :: from ( value) & U :: mask :: < WI > ( ) ) << OF ;
566+ self . w . bits &= !( REG :: Ux :: mask :: < WI > ( ) << OF ) ;
567+ self . w . bits |= ( REG :: Ux :: from ( value) & REG :: Ux :: mask :: < WI > ( ) ) << OF ;
570568 self . w
571569 }
572570 /// Writes `variant` to the field
@@ -584,106 +582,99 @@ impl_bit_proxy!(BitWriter0S);
584582impl_bit_proxy ! ( BitWriter1T ) ;
585583impl_bit_proxy ! ( BitWriter0T ) ;
586584
587- impl < ' a , U , REG , const OF : u8 , FI > BitWriter < ' a , U , REG , OF , FI >
585+ impl < ' a , REG , const OF : u8 , FI > BitWriter < ' a , REG , OF , FI >
588586where
589- REG : Writable + RegisterSpec < Ux = U > ,
590- U : RawReg ,
587+ REG : Writable + RegisterSpec ,
591588 bool : From < FI > ,
592589{
593590 /// Sets the field bit
594591 #[ inline( always) ]
595592 pub fn set_bit ( self ) -> & ' a mut REG :: Writer {
596- self . w . bits |= U :: one ( ) << OF ;
593+ self . w . bits |= REG :: Ux :: one ( ) << OF ;
597594 self . w
598595 }
599596 /// Clears the field bit
600597 #[ inline( always) ]
601598 pub fn clear_bit ( self ) -> & ' a mut REG :: Writer {
602- self . w . bits &= !( U :: one ( ) << OF ) ;
599+ self . w . bits &= !( REG :: Ux :: one ( ) << OF ) ;
603600 self . w
604601 }
605602}
606603
607- impl < ' a , U , REG , const OF : u8 , FI > BitWriter1S < ' a , U , REG , OF , FI >
604+ impl < ' a , REG , const OF : u8 , FI > BitWriter1S < ' a , REG , OF , FI >
608605where
609- REG : Writable + RegisterSpec < Ux = U > ,
610- U : RawReg ,
606+ REG : Writable + RegisterSpec ,
611607 bool : From < FI > ,
612608{
613609 /// Sets the field bit
614610 #[ inline( always) ]
615611 pub fn set_bit ( self ) -> & ' a mut REG :: Writer {
616- self . w . bits |= U :: one ( ) << OF ;
612+ self . w . bits |= REG :: Ux :: one ( ) << OF ;
617613 self . w
618614 }
619615}
620616
621- impl < ' a , U , REG , const OF : u8 , FI > BitWriter0C < ' a , U , REG , OF , FI >
617+ impl < ' a , REG , const OF : u8 , FI > BitWriter0C < ' a , REG , OF , FI >
622618where
623- REG : Writable + RegisterSpec < Ux = U > ,
624- U : RawReg ,
619+ REG : Writable + RegisterSpec ,
625620 bool : From < FI > ,
626621{
627622 /// Clears the field bit
628623 #[ inline( always) ]
629624 pub fn clear_bit ( self ) -> & ' a mut REG :: Writer {
630- self . w . bits &= !( U :: one ( ) << OF ) ;
625+ self . w . bits &= !( REG :: Ux :: one ( ) << OF ) ;
631626 self . w
632627 }
633628}
634629
635- impl < ' a , U , REG , const OF : u8 , FI > BitWriter1C < ' a , U , REG , OF , FI >
630+ impl < ' a , REG , const OF : u8 , FI > BitWriter1C < ' a , REG , OF , FI >
636631where
637- REG : Writable + RegisterSpec < Ux = U > ,
638- U : RawReg ,
632+ REG : Writable + RegisterSpec ,
639633 bool : From < FI > ,
640634{
641635 ///Clears the field bit by passing one
642636 #[ inline( always) ]
643637 pub fn clear_bit_by_one ( self ) -> & ' a mut REG :: Writer {
644- self . w . bits |= U :: one ( ) << OF ;
638+ self . w . bits |= REG :: Ux :: one ( ) << OF ;
645639 self . w
646640 }
647641}
648642
649- impl < ' a , U , REG , const OF : u8 , FI > BitWriter0S < ' a , U , REG , OF , FI >
643+ impl < ' a , REG , const OF : u8 , FI > BitWriter0S < ' a , REG , OF , FI >
650644where
651- REG : Writable + RegisterSpec < Ux = U > ,
652- U : RawReg ,
645+ REG : Writable + RegisterSpec ,
653646 bool : From < FI > ,
654647{
655648 ///Sets the field bit by passing zero
656649 #[ inline( always) ]
657650 pub fn set_bit_by_zero ( self ) -> & ' a mut REG :: Writer {
658- self . w . bits &= !( U :: one ( ) << OF ) ;
651+ self . w . bits &= !( REG :: Ux :: one ( ) << OF ) ;
659652 self . w
660653 }
661654}
662655
663- impl < ' a , U , REG , const OF : u8 , FI > BitWriter1T < ' a , U , REG , OF , FI >
656+ impl < ' a , REG , const OF : u8 , FI > BitWriter1T < ' a , REG , OF , FI >
664657where
665- REG : Writable + RegisterSpec < Ux = U > ,
666- U : RawReg ,
658+ REG : Writable + RegisterSpec ,
667659 bool : From < FI > ,
668660{
669661 ///Toggle the field bit by passing one
670662 #[ inline( always) ]
671663 pub fn toggle_bit ( self ) -> & ' a mut REG :: Writer {
672- self . w . bits |= U :: one ( ) << OF ;
664+ self . w . bits |= REG :: Ux :: one ( ) << OF ;
673665 self . w
674666 }
675667}
676668
677- impl < ' a , U , REG , const OF : u8 , FI > BitWriter0T < ' a , U , REG , OF , FI >
669+ impl < ' a , REG , const OF : u8 , FI > BitWriter0T < ' a , REG , OF , FI >
678670where
679- REG : Writable + RegisterSpec < Ux = U > ,
680- U : RawReg ,
671+ REG : Writable + RegisterSpec ,
681672 bool : From < FI > ,
682673{
683674 ///Toggle the field bit by passing zero
684675 #[ inline( always) ]
685676 pub fn toggle_bit ( self ) -> & ' a mut REG :: Writer {
686- self . w . bits &= !( U :: one ( ) << OF ) ;
677+ self . w . bits &= !( REG :: Ux :: one ( ) << OF ) ;
687678 self . w
688679 }
689680}
0 commit comments