2
2
3
3
use crate :: { sealed, Sealed } ;
4
4
5
+ use super :: * ;
5
6
#[ cfg( feature = "uart4" ) ]
6
7
use crate :: pac:: uart4;
7
8
use crate :: pac:: usart1;
8
- use stm32f4:: { Readable , Reg , RegisterSpec , Resettable , Writable , R , W } ;
9
9
10
- pub trait UartExt : Sealed {
10
+ pub trait UartRB : Sealed {
11
11
fn cr1 ( & self ) -> & usart1:: CR1 ;
12
12
fn dr ( & self ) -> & usart1:: DR ;
13
13
fn brr ( & self ) -> & usart1:: BRR ;
@@ -21,43 +21,6 @@ pub trait UartExt: Sealed {
21
21
fn gtpr ( & self ) -> & Reg < Self :: GTPRrs > ;
22
22
}
23
23
24
- macro_rules! wrap_r {
25
- ( pub trait $TrR: ident {
26
- $( fn $f: ident( & self $( , $n: ident: u8 ) ?) -> $fr: path; ) *
27
- } ) => {
28
- pub trait $TrR {
29
- $( fn $f( & self $( , $n: u8 ) ?) -> $fr; ) *
30
- }
31
- impl <REG : reg:: $TrR> $TrR for R <REG > {
32
- $(
33
- #[ inline( always) ]
34
- fn $f( & self $( , $n: u8 ) ?) -> $fr {
35
- REG :: $f( self $( , $n) ?)
36
- }
37
- ) *
38
- }
39
- } ;
40
- }
41
-
42
- macro_rules! wrap_w {
43
- ( pub trait $TrR: ident {
44
- $( fn $f: ident( & mut self $( , $n: ident: u8 ) ?) -> $fr: path; ) *
45
- } ) => {
46
- pub trait $TrR<REG : reg:: $TrR> {
47
- $( fn $f( & mut self $( , $n: u8 ) ?) -> $fr; ) *
48
- }
49
-
50
- impl <REG : reg:: $TrR> $TrR<REG > for W <REG > {
51
- $(
52
- #[ inline( always) ]
53
- fn $f( & mut self $( , $n: u8 ) ?) -> $fr {
54
- REG :: $f( self $( , $n) ?)
55
- }
56
- ) *
57
- }
58
- } ;
59
- }
60
-
61
24
wrap_r ! {
62
25
pub trait SrR {
63
26
fn pe( & self ) -> usart1:: sr:: PE_R ;
@@ -190,42 +153,10 @@ mod reg {
190
153
}
191
154
}
192
155
193
- macro_rules! impl_reg {
194
- ( $( $r: ident -> & $rty: path; ) * ) => {
195
- $(
196
- #[ inline( always) ]
197
- fn $r( & self ) -> & $rty {
198
- self . $r( )
199
- }
200
- ) *
201
- } ;
202
- }
203
-
204
- macro_rules! impl_read {
205
- ( $( $f: ident $( : $n: ident) ? -> $fty: path; ) * ) => {
206
- $(
207
- #[ inline( always) ]
208
- fn $f( r: & R <Self > $( , $n: u8 ) ?) -> $fty {
209
- r. $f( $( $n) ?)
210
- }
211
- ) *
212
- } ;
213
- }
214
- macro_rules! impl_write {
215
- ( $( $f: ident $( : $n: ident) ? -> $fty: path; ) * ) => {
216
- $(
217
- #[ inline( always) ]
218
- fn $f( w: & mut W <Self > $( , $n: u8 ) ?) -> $fty {
219
- w. $f( $( $n) ?)
220
- }
221
- ) *
222
- } ;
223
- }
224
-
225
156
macro_rules! impl_ext {
226
157
( $( #[ $attr: meta] ) * $uart: ident) => {
227
158
impl Sealed for $uart:: RegisterBlock { }
228
- impl UartExt for $uart:: RegisterBlock {
159
+ impl UartRB for $uart:: RegisterBlock {
229
160
type SRrs = $uart:: sr:: SRrs ;
230
161
type CR2rs = $uart:: cr2:: CR2rs ;
231
162
type CR3rs = $uart:: cr3:: CR3rs ;
0 commit comments