@@ -8,19 +8,16 @@ use core::ops::Deref;
88use core:: sync:: atomic:: { compiler_fence, Ordering :: SeqCst } ;
99
1010#[ 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 } ;
1212
1313#[ cfg( not( feature = "9160" ) ) ]
14- use crate :: pac:: { twim0, P0 , TWIM0 } ;
14+ use crate :: pac:: { twim0, TWIM0 } ;
1515
1616#[ cfg( any( feature = "52832" , feature = "52833" , feature = "52840" ) ) ]
1717use crate :: pac:: TWIM1 ;
1818
19- #[ cfg( any( feature = "52833" , feature = "52840" ) ) ]
20- use crate :: pac:: P1 ;
21-
2219use crate :: {
23- gpio:: { Floating , Input , Pin , Port } ,
20+ gpio:: { Floating , Input , Pin } ,
2421 slice_in_ram, slice_in_ram_or,
2522 target_constants:: { EASY_DMA_SIZE , FORCE_COPY_BUFFER_SIZE } ,
2623} ;
@@ -107,15 +104,15 @@ where
107104 //
108105 // The PTR field is a full 32 bits wide and accepts the full range
109106 // of values.
110- unsafe { w. ptr ( ) . bits ( buffer. as_ptr ( ) as u32 ) } ) ;
107+ w. ptr ( ) . bits ( buffer. as_ptr ( ) as u32 ) ) ;
111108 self . 0 . txd . maxcnt . write ( |w|
112109 // We're giving it the length of the buffer, so no danger of
113110 // accessing invalid memory. We have verified that the length of the
114111 // buffer fits in an `u8`, so the cast to `u8` is also fine.
115112 //
116113 // The MAXCNT field is 8 bits wide and accepts the full range of
117114 // values.
118- unsafe { w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) } ) ;
115+ w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) ) ;
119116
120117 Ok ( ( ) )
121118 }
@@ -139,7 +136,7 @@ where
139136 //
140137 // The PTR field is a full 32 bits wide and accepts the full range
141138 // of values.
142- unsafe { w. ptr ( ) . bits ( buffer. as_mut_ptr ( ) as u32 ) } ) ;
139+ w. ptr ( ) . bits ( buffer. as_mut_ptr ( ) as u32 ) ) ;
143140 self . 0 . rxd . maxcnt . write ( |w|
144141 // We're giving it the length of the buffer, so no danger of
145142 // accessing invalid memory. We have verified that the length of the
@@ -150,7 +147,7 @@ where
150147 // type than a u8, so we use a `_` cast rather than a `u8` cast.
151148 // The MAXCNT field is thus at least 8 bits wide and accepts the
152149 // full range of values that fit in a `u8`.
153- unsafe { w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) } ) ;
150+ w. maxcnt ( ) . bits ( buffer. len ( ) as _ ) ) ;
154151
155152 Ok ( ( ) )
156153 }
0 commit comments