File tree Expand file tree Collapse file tree 2 files changed +42
-21
lines changed Expand file tree Collapse file tree 2 files changed +42
-21
lines changed Original file line number Diff line number Diff line change @@ -172,12 +172,25 @@ impl<'a> EraseSequence<'a> {
172
172
//TODO: This should check if sector_number is valid for this device
173
173
174
174
flash. registers . cr . modify ( |_, w| unsafe {
175
- w. mer ( )
176
- . clear_bit ( )
177
- . ser ( )
178
- . set_bit ( )
179
- . snb ( )
180
- . bits ( sector_number)
175
+ #[ cfg( any(
176
+ feature = "stm32f765" ,
177
+ feature = "stm32f767" ,
178
+ feature = "stm32f769" ,
179
+ feature = "stm32f777" ,
180
+ feature = "stm32f778" ,
181
+ feature = "stm32f779" ,
182
+ ) ) ]
183
+ w. mer1 ( ) . clear_bit ( ) . mer2 ( ) . clear_bit ( ) ;
184
+ #[ cfg( not( any(
185
+ feature = "stm32f765" ,
186
+ feature = "stm32f767" ,
187
+ feature = "stm32f769" ,
188
+ feature = "stm32f777" ,
189
+ feature = "stm32f778" ,
190
+ feature = "stm32f779" ,
191
+ ) ) ) ]
192
+ w. mer ( ) . clear_bit ( ) ;
193
+ w. ser ( ) . set_bit ( ) . snb ( ) . bits ( sector_number)
181
194
} ) ;
182
195
flash. registers . cr . modify ( |_, w| w. strt ( ) . start ( ) ) ;
183
196
@@ -189,10 +202,28 @@ impl<'a> EraseSequence<'a> {
189
202
flash. check_locked_or_busy ( ) ?;
190
203
flash. clear_errors ( ) ;
191
204
192
- flash
193
- . registers
194
- . cr
195
- . modify ( |_, w| w. mer ( ) . set_bit ( ) . ser ( ) . clear_bit ( ) ) ;
205
+ flash. registers . cr . modify ( |_, w| unsafe {
206
+ #[ cfg( any(
207
+ feature = "stm32f765" ,
208
+ feature = "stm32f767" ,
209
+ feature = "stm32f769" ,
210
+ feature = "stm32f777" ,
211
+ feature = "stm32f778" ,
212
+ feature = "stm32f779" ,
213
+ ) ) ]
214
+ w. mer1 ( ) . set_bit ( ) . mer2 ( ) . set_bit ( ) ;
215
+ #[ cfg( not( any(
216
+ feature = "stm32f765" ,
217
+ feature = "stm32f767" ,
218
+ feature = "stm32f769" ,
219
+ feature = "stm32f777" ,
220
+ feature = "stm32f778" ,
221
+ feature = "stm32f779" ,
222
+ ) ) ) ]
223
+ w. mer ( ) . clear_bit ( ) ;
224
+ w. ser ( ) . clear_bit ( )
225
+ } ) ;
226
+
196
227
flash. registers . cr . modify ( |_, w| w. strt ( ) . start ( ) ) ;
197
228
198
229
Ok ( Self { flash } )
Original file line number Diff line number Diff line change @@ -160,17 +160,7 @@ pub mod qei;
160
160
#[ cfg( feature = "ltdc" ) ]
161
161
pub mod ltdc;
162
162
163
- #[ cfg( all(
164
- feature = "device-selected" ,
165
- not( any(
166
- feature = "stm32f765" ,
167
- feature = "stm32f767" ,
168
- feature = "stm32f769" ,
169
- feature = "stm32f777" ,
170
- feature = "stm32f778" ,
171
- feature = "stm32f779" ,
172
- ) )
173
- ) ) ]
163
+ #[ cfg( feature = "device-selected" ) ]
174
164
pub mod flash;
175
165
176
166
pub mod state {
You can’t perform that action at this time.
0 commit comments