File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 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/).
77
88## [ Unreleased]
99
10+ ### Added
11+
12+ - RegisterBlock trait (like ` Deref ` , but don't require ` self ` instance,
13+ only for fixed in memory peripherals)
14+
1015### Fixed
1116
1217- Keyword sanitizing (` async ` )
Original file line number Diff line number Diff line change 11use core:: marker;
22
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+
312///This trait shows that register has `read` method
413///
514///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(
7676 unsafe { & * #name_pc:: ptr( ) }
7777 }
7878 }
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+ }
7987 } ) ;
8088
8189 // Derived peripherals may not require re-implementation, and will instead
You can’t perform that action at this time.
0 commit comments