@@ -8,19 +8,16 @@ use core::ops::Deref;
8
8
use core:: sync:: atomic:: { compiler_fence, Ordering :: SeqCst } ;
9
9
10
10
#[ cfg( feature = "9160" ) ]
11
- use crate :: pac:: { twim0_ns as twim0, P0_NS as P0 , TWIM0_NS as TWIM0 } ;
11
+ use crate :: pac:: { twim0_ns as twim0, TWIM0_NS as TWIM0 } ;
12
12
13
13
#[ cfg( not( feature = "9160" ) ) ]
14
- use crate :: pac:: { twim0, P0 , TWIM0 } ;
14
+ use crate :: pac:: { twim0, TWIM0 } ;
15
15
16
16
#[ cfg( any( feature = "52832" , feature = "52833" , feature = "52840" ) ) ]
17
17
use crate :: pac:: TWIM1 ;
18
18
19
- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
20
- use crate :: pac:: P1 ;
21
-
22
19
use crate :: {
23
- gpio:: { Floating , Input , Pin , Port } ,
20
+ gpio:: { Floating , Input , Pin } ,
24
21
slice_in_ram, slice_in_ram_or,
25
22
target_constants:: { EASY_DMA_SIZE , FORCE_COPY_BUFFER_SIZE } ,
26
23
} ;
@@ -107,15 +104,15 @@ where
107
104
//
108
105
// The PTR field is a full 32 bits wide and accepts the full range
109
106
// of values.
110
- unsafe { w. ptr ( ) . bits ( buffer. as_ptr ( ) as u32 ) } ) ;
107
+ w. ptr ( ) . bits ( buffer. as_ptr ( ) as u32 ) ) ;
111
108
self . 0 . txd . maxcnt . write ( |w|
112
109
// We're giving it the length of the buffer, so no danger of
113
110
// accessing invalid memory. We have verified that the length of the
114
111
// buffer fits in an `u8`, so the cast to `u8` is also fine.
115
112
//
116
113
// The MAXCNT field is 8 bits wide and accepts the full range of
117
114
// values.
118
- unsafe { w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) } ) ;
115
+ w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) ) ;
119
116
120
117
Ok ( ( ) )
121
118
}
@@ -139,7 +136,7 @@ where
139
136
//
140
137
// The PTR field is a full 32 bits wide and accepts the full range
141
138
// of values.
142
- unsafe { w. ptr ( ) . bits ( buffer. as_mut_ptr ( ) as u32 ) } ) ;
139
+ w. ptr ( ) . bits ( buffer. as_mut_ptr ( ) as u32 ) ) ;
143
140
self . 0 . rxd . maxcnt . write ( |w|
144
141
// We're giving it the length of the buffer, so no danger of
145
142
// accessing invalid memory. We have verified that the length of the
@@ -150,7 +147,7 @@ where
150
147
// type than a u8, so we use a `_` cast rather than a `u8` cast.
151
148
// The MAXCNT field is thus at least 8 bits wide and accepts the
152
149
// full range of values that fit in a `u8`.
153
- unsafe { w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) } ) ;
150
+ w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) ) ;
154
151
155
152
Ok ( ( ) )
156
153
}
0 commit comments