@@ -102,7 +102,7 @@ impl<REG: Resettable + Writable> Reg<REG> {
102
102
#[ inline( always) ]
103
103
pub fn write < F > ( & self , f : F )
104
104
where
105
- F : FnOnce ( & mut REG :: Writer ) -> & mut REG :: Writer ,
105
+ F : FnOnce ( & mut REG :: Writer ) -> & mut W < REG >
106
106
{
107
107
self . register . set (
108
108
f ( & mut REG :: Writer :: from ( W {
@@ -124,7 +124,7 @@ where
124
124
#[ inline( always) ]
125
125
pub fn write_with_zero < F > ( & self , f : F )
126
126
where
127
- F : FnOnce ( & mut REG :: Writer ) -> & mut REG :: Writer ,
127
+ F : FnOnce ( & mut REG :: Writer ) -> & mut W < REG >
128
128
{
129
129
self . register . set (
130
130
( * f ( & mut REG :: Writer :: from ( W {
@@ -157,7 +157,7 @@ impl<REG: Readable + Writable> Reg<REG> {
157
157
#[ inline( always) ]
158
158
pub fn modify < F > ( & self , f : F )
159
159
where
160
- for < ' w > F : FnOnce ( & REG :: Reader , & ' w mut REG :: Writer ) -> & ' w mut REG :: Writer ,
160
+ for < ' w > F : FnOnce ( & REG :: Reader , & ' w mut REG :: Writer ) -> & ' w mut W < REG >
161
161
{
162
162
let bits = self . register . get ( ) ;
163
163
self . register . set (
@@ -216,8 +216,9 @@ pub struct W<REG: RegisterSpec + ?Sized> {
216
216
impl < REG : RegisterSpec > W < REG > {
217
217
/// Writes raw bits to the register.
218
218
#[ inline( always) ]
219
- pub unsafe fn bits ( & mut self , bits : REG :: Ux ) {
219
+ pub unsafe fn bits ( & mut self , bits : REG :: Ux ) -> & mut Self {
220
220
self . bits = bits;
221
+ self
221
222
}
222
223
}
223
224
0 commit comments