@@ -10,13 +10,20 @@ pub fn render() -> Result<Vec<Tokens>> {
1010 generic_items. push ( quote ! {
1111 use core:: marker;
1212
13- ///Marker trait for readable register/field
13+ ///This trait shows that register has `read` method
14+ ///
15+ ///Registers marked with `Writable` can be also `modify`'ed
1416 pub trait Readable { }
1517
16- ///Marker trait for writable register/field
18+ ///This trait shows that register has `write`, `write_with_zero` and `reset` method
19+ ///
20+ ///Registers marked with `Readable` can be also `modify`'ed
1721 pub trait Writable { }
1822
1923 ///Reset value of the register
24+ ///
25+ ///This value is initial value for `write` method.
26+ ///It can be also directly writed to register by `reset` method.
2027 pub trait ResetValue <U > {
2128 ///Reset value of the register
2229 fn reset_value( ) -> U ;
@@ -30,18 +37,22 @@ pub fn render() -> Result<Vec<Tokens>> {
3037 } ) ;
3138
3239 generic_items. push ( quote ! {
33- ///Wrapper for registers
40+ ///This structure provides access to register
3441 pub struct Reg <U , REG > {
3542 register: vcell:: VolatileCell <U >,
3643 _marker: marker:: PhantomData <REG >,
3744 }
3845
46+ unsafe impl <U : Send , REG > Send for Reg <U , REG > { }
47+
3948 impl <U , REG > Reg <U , REG >
4049 where
4150 Self : Readable ,
4251 U : Copy
4352 {
44- ///Reads the contents of the register
53+ ///Reads the contents of `Readable` register
54+ ///
55+ ///See [reading](https://rust-embedded.github.io/book/start/registers.html#reading) in book.
4556 #[ inline( always) ]
4657 pub fn read( & self ) -> R <U , Self > {
4758 R { bits: self . register. get( ) , _reg: marker:: PhantomData }
@@ -53,7 +64,7 @@ pub fn render() -> Result<Vec<Tokens>> {
5364 Self : ResetValue <U > + Writable ,
5465 U : Copy ,
5566 {
56- ///Writes the reset value to the register
67+ ///Writes the reset value to `Writable` register
5768 #[ inline( always) ]
5869 pub fn reset( & self ) {
5970 self . register. set( Self :: reset_value( ) )
@@ -67,7 +78,9 @@ pub fn render() -> Result<Vec<Tokens>> {
6778 Self : ResetValue <U > + Writable ,
6879 U : Copy
6980 {
70- ///Writes to the register
81+ ///Writes bits to `Writable` register
82+ ///
83+ ///See [writing](https://rust-embedded.github.io/book/start/registers.html#writing) in book.
7184 #[ inline( always) ]
7285 pub fn write<F >( & self , f: F )
7386 where
@@ -84,7 +97,7 @@ pub fn render() -> Result<Vec<Tokens>> {
8497 Self : Writable ,
8598 U : Copy + Default
8699 {
87- ///Writes Zero to the register
100+ ///Writes Zero to `Writable` register
88101 #[ inline( always) ]
89102 pub fn write_with_zero<F >( & self , f: F )
90103 where
@@ -102,6 +115,8 @@ pub fn render() -> Result<Vec<Tokens>> {
102115 U : Copy ,
103116 {
104117 ///Modifies the contents of the register
118+ ///
119+ ///See [modifying](https://rust-embedded.github.io/book/start/registers.html#modifying) in book.
105120 #[ inline( always) ]
106121 pub fn modify<F >( & self , f: F )
107122 where
0 commit comments