File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,12 @@ impl Rng<Running> {
136
136
///
137
137
/// Returns an [`RngError`] if the RNG is not ready or reports an error condition.
138
138
///
139
+ /// Once the RNG is ready, 4 consecutive 32 bit reads can be performed without blocking,
140
+ /// at which point the internal FIFO will be refilled after 216 periods of the AHB clock
141
+ /// (RM0440 26.7.3)
142
+ ///
143
+ /// While the RNG is filling the FIFO, the function will return [`RngError::NotReady`].
144
+ ///
139
145
/// For blocking reads use [`read_blocking()`]
140
146
pub fn read_non_blocking ( & self ) -> Result < u32 , RngError > {
141
147
// Read the SR register to check if there is an error condition,
@@ -153,7 +159,10 @@ impl Rng<Running> {
153
159
154
160
if status. drdy ( ) . bit_is_set ( ) {
155
161
// Data is ready. Read the DR register and return the value.
156
- Ok ( unsafe { ( * RNG :: ptr ( ) ) . dr ( ) . read ( ) . bits ( ) } )
162
+ match unsafe { ( * RNG :: ptr ( ) ) . dr ( ) . read ( ) . bits ( ) } {
163
+ 0 => Err ( RngError :: SeedError ) ,
164
+ data => Ok ( data) ,
165
+ }
157
166
} else {
158
167
Err ( RngError :: NotReady )
159
168
}
You can’t perform that action at this time.
0 commit comments