File tree Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Expand file tree Collapse file tree 3 files changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77
88## [ Unreleased]
99
10+ - removed register writer & reader wrappers, generic ` REG ` in field writers (#731 )
1011- Updated syn to version 2 (#732 )
1112
1213## [ v0.29.0] - 2023-06-05
Original file line number Diff line number Diff line change @@ -256,7 +256,10 @@ impl<REG: Readable + Writable> Reg<REG> {
256256///
257257/// Result of the `read` methods of registers. Also used as a closure argument in the `modify`
258258/// method.
259- pub struct R < REG : RegisterSpec + ?Sized > {
259+ pub type R < REG > = RRaw < REG > ;
260+
261+ #[ doc( hidden) ]
262+ pub struct RRaw < REG : RegisterSpec > {
260263 pub ( crate ) bits : REG :: Ux ,
261264 _reg : marker:: PhantomData < REG > ,
262265}
@@ -284,25 +287,15 @@ where
284287/// Register writer.
285288///
286289/// Used as an argument to the closures in the `write` and `modify` methods of the register.
287- pub struct W < REG : RegisterSpec + ?Sized > {
290+ pub type W < REG > = WRaw < REG > ;
291+
292+ #[ doc( hidden) ]
293+ pub struct WRaw < REG : RegisterSpec > {
288294 ///Writable bits
289295 pub ( crate ) bits : REG :: Ux ,
290296 _reg : marker:: PhantomData < REG > ,
291297}
292298
293- impl < REG : RegisterSpec > W < REG > {
294- /// Writes raw bits to the register.
295- ///
296- /// # Safety
297- ///
298- /// Read datasheet or reference manual to find what values are allowed to pass.
299- #[ inline( always) ]
300- pub unsafe fn bits ( & mut self , bits : REG :: Ux ) -> & mut Self {
301- self . bits = bits;
302- self
303- }
304- }
305-
306299#[ doc( hidden) ]
307300pub struct FieldReaderRaw < FI = u8 >
308301where
Original file line number Diff line number Diff line change @@ -273,7 +273,6 @@ pub fn render_register_mod(
273273
274274 mod_items. extend ( w_impl_items) ;
275275
276- /*
277276 // the writer can be safe if:
278277 // * there is a single field that covers the entire register
279278 // * that field can represent all values
@@ -293,7 +292,7 @@ pub fn render_register_mod(
293292 #[ doc = "Writes raw bits to the register." ]
294293 #[ inline( always) ]
295294 pub fn bits( & mut self , bits: #rty) -> & mut Self {
296- unsafe { self.0. bits(bits) } ;
295+ self . bits = bits ;
297296 self
298297 }
299298 } ) ;
@@ -302,11 +301,11 @@ pub fn render_register_mod(
302301 #[ doc = "Writes raw bits to the register." ]
303302 #[ inline( always) ]
304303 pub unsafe fn bits( & mut self , bits: #rty) -> & mut Self {
305- self.0. bits( bits) ;
304+ self . bits = bits;
306305 self
307306 }
308307 } ) ;
309- }*/
308+ }
310309
311310 close. to_tokens ( & mut mod_items) ;
312311 }
You can’t perform that action at this time.
0 commit comments