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> {
247247 let status = self . rb . sr ( ) . read ( ) ;
248248
249249 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+
250256 let sr = self . rb . sr ( ) ;
251257 // Give rng some time to recover from clock disturbance, this time seems to be about a handful of milliseconds
252258 for _ in 0 ..100_000 {
@@ -281,10 +287,16 @@ impl<MODE> Rng<MODE> {
281287}
282288
283289impl < MODE > core:: iter:: Iterator for Rng < MODE > {
284- type Item = Result < u32 , SeedError > ;
290+ type Item = u32 ;
285291
286292 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+ }
288300 }
289301}
290302
You can’t perform that action at this time.
0 commit comments