11use core:: marker;
22
33/// Generic peripheral accessor
4- pub struct Periph < RB , PER > {
5- _marker : marker:: PhantomData < ( RB , PER ) > ,
4+ pub struct Periph < PER : PeripheralSpec > {
5+ _marker : marker:: PhantomData < PER > ,
66}
77
88pub trait PeripheralSpec {
9+ type RB ;
910 ///Pointer to the register block
1011 const ADDRESS : usize ;
1112 ///Debug name
1213 const NAME : & str ;
1314}
1415
15- unsafe impl < RB , PER > Send for Periph < RB , PER > { }
16+ unsafe impl < PER : PeripheralSpec > Send for Periph < PER > { }
1617
17- impl < RB , PER : PeripheralSpec > core:: fmt:: Debug for Periph < RB , PER > {
18+ impl < PER : PeripheralSpec > core:: fmt:: Debug for Periph < PER > {
1819 fn fmt ( & self , f : & mut core:: fmt:: Formatter ) -> core:: fmt:: Result {
1920 f. debug_struct ( PER :: NAME ) . finish ( )
2021 }
2122}
2223
23- impl < RB , PER : PeripheralSpec > Periph < RB , PER > {
24+ impl < PER : PeripheralSpec > Periph < PER > {
2425 ///Pointer to the register block
25- pub const PTR : * const RB = PER :: ADDRESS as * const _ ;
26+ pub const PTR : * const PER :: RB = PER :: ADDRESS as * const _ ;
2627
2728 ///Return the pointer to the register block
2829 #[ inline( always) ]
29- pub const fn ptr ( ) -> * const RB {
30+ pub const fn ptr ( ) -> * const PER :: RB {
3031 Self :: PTR
3132 }
3233
@@ -50,8 +51,8 @@ impl<RB, PER: PeripheralSpec> Periph<RB, PER> {
5051 }
5152}
5253
53- impl < RB , PER : PeripheralSpec > core:: ops:: Deref for Periph < RB , PER > {
54- type Target = RB ;
54+ impl < PER : PeripheralSpec > core:: ops:: Deref for Periph < PER > {
55+ type Target = PER :: RB ;
5556
5657 #[ inline( always) ]
5758 fn deref ( & self ) -> & Self :: Target {
0 commit comments