File tree 3 files changed +22
-0
lines changed
3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## [ Unreleased]
9
9
10
+ ### Added
11
+
12
+ - RegisterBlock trait (like ` Deref ` , but don't require ` self ` instance,
13
+ only for fixed in memory peripherals)
14
+
10
15
### Fixed
11
16
12
17
- Keyword sanitizing (` async ` )
Original file line number Diff line number Diff line change 1
1
use core:: marker;
2
2
3
+ ///This trait allows to get raw pointer on derived peripheral
4
+ ///as block of registers of base peripheral (like unsafe `Deref`)
5
+ pub trait RegisterBlock {
6
+ ///Type of RegisterBlock of base peripheral
7
+ type RB ;
8
+ ///Take peripheral address as raw pointer
9
+ fn rb ( ) -> * const Self :: RB ;
10
+ }
11
+
3
12
///This trait shows that register has `read` method
4
13
///
5
14
///Registers marked with `Writable` can be also `modify`'ed
Original file line number Diff line number Diff line change @@ -76,6 +76,14 @@ pub fn render(
76
76
unsafe { & * #name_pc:: ptr( ) }
77
77
}
78
78
}
79
+ impl crate :: RegisterBlock for #name_pc {
80
+ type RB = #base:: RegisterBlock ;
81
+
82
+ #[ inline( always) ]
83
+ fn rb( ) -> * const Self :: RB {
84
+ #name_pc:: ptr( )
85
+ }
86
+ }
79
87
} ) ;
80
88
81
89
// Derived peripherals may not require re-implementation, and will instead
You can’t perform that action at this time.
0 commit comments