File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,12 @@ impl<MODE> Rng<MODE> {
247
247
let status = self . rb . sr ( ) . read ( ) ;
248
248
249
249
if status. cecs ( ) . bit ( ) {
250
+ #[ cfg( feature = "log" ) ]
251
+ log:: warn!( "RNG Clock error detected, retrying" ) ;
252
+
253
+ #[ cfg( feature = "defmt" ) ]
254
+ defmt:: warn!( "RNG Clock error detected, retrying" ) ;
255
+
250
256
let sr = self . rb . sr ( ) ;
251
257
// Give rng some time to recover from clock disturbance, this time seems to be about a handful of milliseconds
252
258
for _ in 0 ..100_000 {
@@ -281,10 +287,16 @@ impl<MODE> Rng<MODE> {
281
287
}
282
288
283
289
impl < MODE > core:: iter:: Iterator for Rng < MODE > {
284
- type Item = Result < u32 , SeedError > ;
290
+ type Item = u32 ;
285
291
286
292
fn next ( & mut self ) -> Option < Self :: Item > {
287
- Some ( self . value ( ) )
293
+ loop {
294
+ match self . value ( ) {
295
+ Ok ( x) => return Some ( x) ,
296
+ // We recover automatically from a seed error, so try again
297
+ Err ( SeedError ) => ( ) ,
298
+ }
299
+ }
288
300
}
289
301
}
290
302
You can’t perform that action at this time.
0 commit comments