File tree Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ pub mod prelude {
29
29
30
30
pub use crate :: clocks:: ClocksExt ;
31
31
pub use crate :: gpio:: GpioExt ;
32
- pub use crate :: rng:: RngExt ;
33
32
pub use crate :: rtc:: RtcExt ;
34
33
pub use crate :: saadc:: SaadcExt ;
35
34
pub use crate :: spim:: SpimExt ;
Original file line number Diff line number Diff line change 3
3
//! See nRF52832 product specification, chapter 26.
4
4
5
5
6
- use core:: ops:: Deref ;
7
6
use rand_core:: { CryptoRng , RngCore } ;
8
7
9
- use crate :: target:: {
10
- rng,
11
- RNG ,
12
- } ;
13
-
14
-
15
- pub trait RngExt : Deref < Target =rng:: RegisterBlock > + Sized {
16
- fn constrain ( self ) -> Rng ;
17
- }
18
-
19
- impl RngExt for RNG {
20
- fn constrain ( self ) -> Rng {
21
- self . config . write ( |w| w. dercen ( ) . enabled ( ) ) ;
22
- Rng ( self )
23
- }
24
- }
8
+ use crate :: target:: RNG ;
25
9
26
10
27
11
/// Interface to the RNG peripheral
@@ -30,6 +14,11 @@ impl RngExt for RNG {
30
14
pub struct Rng ( RNG ) ;
31
15
32
16
impl Rng {
17
+ pub fn new ( rng : RNG ) -> Self {
18
+ rng. config . write ( |w| w. dercen ( ) . enabled ( ) ) ;
19
+ Self ( rng)
20
+ }
21
+
33
22
/// Fill the provided buffer with random bytes
34
23
///
35
24
/// Will block until the buffer is full.
You can’t perform that action at this time.
0 commit comments