@@ -95,178 +95,6 @@ pub trait Resettable: RegisterSpec {
9595    } 
9696} 
9797
98- /// This structure provides volatile access to registers. 
99- #[ repr( transparent) ]  
100- pub  struct  Reg < REG :  RegisterSpec >  { 
101-     register :  vcell:: VolatileCell < REG :: Ux > , 
102-     _marker :  marker:: PhantomData < REG > , 
103- } 
104- 
105- unsafe  impl < REG :  RegisterSpec >  Send  for  Reg < REG >  where  REG :: Ux :  Send  { } 
106- 
107- impl < REG :  RegisterSpec >  Reg < REG >  { 
108-     /// Returns the underlying memory address of register. 
109-      /// 
110-      /// ```ignore 
111-      /// let reg_ptr = periph.reg.as_ptr(); 
112-      /// ``` 
113-      #[ inline( always) ]  
114-     pub  fn  as_ptr ( & self )  -> * mut  REG :: Ux  { 
115-         self . register . as_ptr ( ) 
116-     } 
117- } 
118- 
119- impl < REG :  Readable >  Reg < REG >  { 
120-     /// Reads the contents of a `Readable` register. 
121-      /// 
122-      /// You can read the raw contents of a register by using `bits`: 
123-      /// ```ignore 
124-      /// let bits = periph.reg.read().bits(); 
125-      /// ``` 
126-      /// or get the content of a particular field of a register: 
127-      /// ```ignore 
128-      /// let reader = periph.reg.read(); 
129-      /// let bits = reader.field1().bits(); 
130-      /// let flag = reader.field2().bit_is_set(); 
131-      /// ``` 
132-      #[ inline( always) ]  
133-     pub  fn  read ( & self )  -> R < REG >  { 
134-         R  { 
135-             bits :  self . register . get ( ) , 
136-             _reg :  marker:: PhantomData , 
137-         } 
138-     } 
139- } 
140- 
141- impl < REG :  Resettable  + Writable >  Reg < REG >  { 
142-     /// Writes the reset value to `Writable` register. 
143-      /// 
144-      /// Resets the register to its initial state. 
145-      #[ inline( always) ]  
146-     pub  fn  reset ( & self )  { 
147-         self . register . set ( REG :: RESET_VALUE ) 
148-     } 
149- 
150-     /// Writes bits to a `Writable` register. 
151-      /// 
152-      /// You can write raw bits into a register: 
153-      /// ```ignore 
154-      /// periph.reg.write(|w| unsafe { w.bits(rawbits) }); 
155-      /// ``` 
156-      /// or write only the fields you need: 
157-      /// ```ignore 
158-      /// periph.reg.write(|w| w 
159-      ///     .field1().bits(newfield1bits) 
160-      ///     .field2().set_bit() 
161-      ///     .field3().variant(VARIANT) 
162-      /// ); 
163-      /// ``` 
164-      /// or an alternative way of saying the same: 
165-      /// ```ignore 
166-      /// periph.reg.write(|w| { 
167-      ///     w.field1().bits(newfield1bits); 
168-      ///     w.field2().set_bit(); 
169-      ///     w.field3().variant(VARIANT) 
170-      /// }); 
171-      /// ``` 
172-      /// In the latter case, other fields will be set to their reset value. 
173-      #[ inline( always) ]  
174-     pub  fn  write < F > ( & self ,  f :  F ) 
175-     where 
176-         F :  FnOnce ( & mut  W < REG > )  -> & mut  W < REG > , 
177-     { 
178-         self . register . set ( 
179-             f ( & mut  W  { 
180-                 bits :  REG :: RESET_VALUE  &  !REG :: ONE_TO_MODIFY_FIELDS_BITMAP 
181-                     | REG :: ZERO_TO_MODIFY_FIELDS_BITMAP , 
182-                 _reg :  marker:: PhantomData , 
183-             } ) 
184-             . bits , 
185-         ) ; 
186-     } 
187- } 
188- 
189- impl < REG :  Writable >  Reg < REG >  { 
190-     /// Writes 0 to a `Writable` register. 
191-      /// 
192-      /// Similar to `write`, but unused bits will contain 0. 
193-      /// 
194-      /// # Safety 
195-      /// 
196-      /// Unsafe to use with registers which don't allow to write 0. 
197-      #[ inline( always) ]  
198-     pub  unsafe  fn  write_with_zero < F > ( & self ,  f :  F ) 
199-     where 
200-         F :  FnOnce ( & mut  W < REG > )  -> & mut  W < REG > , 
201-     { 
202-         self . register . set ( 
203-             f ( & mut  W  { 
204-                 bits :  REG :: Ux :: default ( ) , 
205-                 _reg :  marker:: PhantomData , 
206-             } ) 
207-             . bits , 
208-         ) ; 
209-     } 
210- } 
211- 
212- impl < REG :  Readable  + Writable >  Reg < REG >  { 
213-     /// Modifies the contents of the register by reading and then writing it. 
214-      /// 
215-      /// E.g. to do a read-modify-write sequence to change parts of a register: 
216-      /// ```ignore 
217-      /// periph.reg.modify(|r, w| unsafe { w.bits( 
218-      ///    r.bits() | 3 
219-      /// ) }); 
220-      /// ``` 
221-      /// or 
222-      /// ```ignore 
223-      /// periph.reg.modify(|_, w| w 
224-      ///     .field1().bits(newfield1bits) 
225-      ///     .field2().set_bit() 
226-      ///     .field3().variant(VARIANT) 
227-      /// ); 
228-      /// ``` 
229-      /// or an alternative way of saying the same: 
230-      /// ```ignore 
231-      /// periph.reg.modify(|_, w| { 
232-      ///     w.field1().bits(newfield1bits); 
233-      ///     w.field2().set_bit(); 
234-      ///     w.field3().variant(VARIANT) 
235-      /// }); 
236-      /// ``` 
237-      /// Other fields will have the value they had before the call to `modify`. 
238-      #[ inline( always) ]  
239-     pub  fn  modify < F > ( & self ,  f :  F ) 
240-     where 
241-         for < ' w >  F :  FnOnce ( & R < REG > ,  & ' w  mut  W < REG > )  -> & ' w  mut  W < REG > , 
242-     { 
243-         let  bits = self . register . get ( ) ; 
244-         self . register . set ( 
245-             f ( 
246-                 & R  { 
247-                     bits, 
248-                     _reg :  marker:: PhantomData , 
249-                 } , 
250-                 & mut  W  { 
251-                     bits :  bits &  !REG :: ONE_TO_MODIFY_FIELDS_BITMAP 
252-                         | REG :: ZERO_TO_MODIFY_FIELDS_BITMAP , 
253-                     _reg :  marker:: PhantomData , 
254-                 } , 
255-             ) 
256-             . bits , 
257-         ) ; 
258-     } 
259- } 
260- 
261- impl < REG :  Readable >  core:: fmt:: Debug  for  crate :: generic:: Reg < REG > 
262- where 
263-     R < REG > :  core:: fmt:: Debug 
264- { 
265-     fn  fmt ( & self ,  f :  & mut  core:: fmt:: Formatter < ' _ > )  -> core:: fmt:: Result  { 
266-         core:: fmt:: Debug :: fmt ( & self . read ( ) ,  f) 
267-     } 
268- } 
269- 
27098#[ doc( hidden) ]  
27199pub  mod  raw { 
272100    use  super :: { marker,  BitM ,  FieldSpec ,  RegisterSpec ,  Unsafe ,  Writable } ; 
0 commit comments