11use core:: marker;
22
33/// Raw register type
4- pub trait Register {
4+ pub trait RegisterSpec {
55 /// Raw register type (`u8`, `u16`, `u32`, ...).
66 type Ux : Copy ;
77}
88
99/// Trait implemented by readable registers to enable the `read` method.
1010///
1111/// Registers marked with `Writable` can be also `modify`'ed.
12- pub trait Readable : Register { }
12+ pub trait Readable : RegisterSpec { }
1313
1414/// Trait implemented by writeable registers.
1515///
1616/// This enables the `write`, `write_with_zero` and `reset` methods.
1717///
1818/// Registers marked with `Readable` can be also `modify`'ed.
19- pub trait Writable : Register { }
19+ pub trait Writable : RegisterSpec { }
2020
2121/// Reset value of the register.
2222///
2323/// This value is the initial value for the `write` method. It can also be directly written to the
2424/// register by using the `reset` method.
25- pub trait Resettable : Register {
25+ pub trait Resettable : RegisterSpec {
2626 /// Reset value of the register.
2727 fn reset_value ( ) -> Self :: Ux ;
2828}
2929
3030/// This structure provides volatile access to registers.
31- pub struct Reg < REG : Register > {
31+ pub struct Reg < REG : RegisterSpec > {
3232 register : vcell:: VolatileCell < REG :: Ux > ,
3333 _marker : marker:: PhantomData < REG > ,
3434}
3535
36- unsafe impl < REG : Register > Send for Reg < REG > where REG :: Ux : Send { }
36+ unsafe impl < REG : RegisterSpec > Send for Reg < REG > where REG :: Ux : Send { }
3737
38- impl < REG : Register > Reg < REG > {
38+ impl < REG : RegisterSpec > Reg < REG > {
3939 /// Returns the underlying memory address of register.
4040 ///
4141 /// ```ignore
@@ -174,20 +174,20 @@ impl<REG: Readable + Writable> Reg<REG> {
174174///
175175/// Result of the `read` methods of registers. Also used as a closure argument in the `modify`
176176/// method.
177- pub struct R < REG : Register > {
177+ pub struct R < REG : RegisterSpec > {
178178 pub ( crate ) bits : REG :: Ux ,
179179 _reg : marker:: PhantomData < REG > ,
180180}
181181
182- impl < REG : Register > R < REG > {
182+ impl < REG : RegisterSpec > R < REG > {
183183 /// Reads raw bits from register.
184184 #[ inline( always) ]
185185 pub fn bits ( & self ) -> REG :: Ux {
186186 self . bits
187187 }
188188}
189189
190- impl < REG : Register , FI > PartialEq < FI > for R < REG >
190+ impl < REG : RegisterSpec , FI > PartialEq < FI > for R < REG >
191191where
192192 REG :: Ux : PartialEq ,
193193 FI : Copy + Into < REG :: Ux > ,
@@ -201,13 +201,13 @@ where
201201/// Register writer.
202202///
203203/// Used as an argument to the closures in the `write` and `modify` methods of the register.
204- pub struct W < REG : Register > {
204+ pub struct W < REG : RegisterSpec > {
205205 ///Writable bits
206206 pub ( crate ) bits : REG :: Ux ,
207207 _reg : marker:: PhantomData < REG > ,
208208}
209209
210- impl < REG : Register > W < REG > {
210+ impl < REG : RegisterSpec > W < REG > {
211211 /// Writes raw bits to the register.
212212 #[ inline( always) ]
213213 pub unsafe fn bits ( & mut self , bits : REG :: Ux ) -> & mut Self {
0 commit comments