@@ -12,16 +12,19 @@ pub trait Readable {}
1212/// Registers marked with `Readable` can be also `modify`'ed.
1313pub trait Writable { }
1414
15+
16+ /// Raw register type (autoimplemented for `Reg` type)
17+ pub trait RawType {
18+ /// Raw register type (`u8`, `u16`, `u32`, ...).
19+ type Ux : Copy ;
20+ }
1521/// Reset value of the register.
1622///
1723/// This value is the initial value for the `write` method. It can also be directly written to the
1824/// register by using the `reset` method.
19- pub trait ResetValue {
20- /// Raw register type (`u8`, `u16`, `u32`, ...).
21- type Type ;
22-
25+ pub trait ResetValue : RawType {
2326 /// Reset value of the register.
24- fn reset_value ( ) -> Self :: Type ;
27+ fn reset_value ( ) -> Self :: Ux ;
2528}
2629
2730/// This structure provides volatile access to registers.
7376 }
7477}
7578
79+ impl < U , REG > RawType for Reg < U , REG >
80+ where
81+ U : Copy ,
82+ {
83+ type Ux = U ;
84+ }
85+
7686impl < U , REG > Reg < U , REG >
7787where
78- Self : ResetValue < Type = U > + Writable ,
88+ Self : ResetValue + RawType < Ux = U > + Writable ,
7989 U : Copy ,
8090{
8191 /// Writes the reset value to `Writable` register.
8999
90100impl < U , REG > Reg < U , REG >
91101where
92- Self : ResetValue < Type = U > + Writable ,
93- U : Copy ,
102+ Self : ResetValue + RawType < Ux = U > + Writable ,
103+ U : Copy
94104{
95105 /// Writes bits to a `Writable` register.
96106 ///
0 commit comments