@@ -12,16 +12,19 @@ pub trait Readable {}
12
12
/// Registers marked with `Readable` can be also `modify`'ed.
13
13
pub trait Writable { }
14
14
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
+ }
15
21
/// Reset value of the register.
16
22
///
17
23
/// This value is the initial value for the `write` method. It can also be directly written to the
18
24
/// 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 {
23
26
/// Reset value of the register.
24
- fn reset_value ( ) -> Self :: Type ;
27
+ fn reset_value ( ) -> Self :: Ux ;
25
28
}
26
29
27
30
/// This structure provides volatile access to registers.
73
76
}
74
77
}
75
78
79
+ impl < U , REG > RawType for Reg < U , REG >
80
+ where
81
+ U : Copy ,
82
+ {
83
+ type Ux = U ;
84
+ }
85
+
76
86
impl < U , REG > Reg < U , REG >
77
87
where
78
- Self : ResetValue < Type = U > + Writable ,
88
+ Self : ResetValue + RawType < Ux = U > + Writable ,
79
89
U : Copy ,
80
90
{
81
91
/// Writes the reset value to `Writable` register.
89
99
90
100
impl < U , REG > Reg < U , REG >
91
101
where
92
- Self : ResetValue < Type = U > + Writable ,
93
- U : Copy ,
102
+ Self : ResetValue + RawType < Ux = U > + Writable ,
103
+ U : Copy
94
104
{
95
105
/// Writes bits to a `Writable` register.
96
106
///
0 commit comments