File tree 4 files changed +21
-1
lines changed
4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
8
8
## [ Unreleased]
9
9
10
10
### Added
11
-
11
+ - A nonblocking trait for interfacing with random number generation hardware.
12
12
13
13
### Changed
14
14
- The current versions of ` InputPin ` have been proven. These are ` digital::v1::InputPin `
Original file line number Diff line number Diff line change @@ -689,6 +689,7 @@ pub mod blocking;
689
689
pub mod digital;
690
690
pub mod fmt;
691
691
pub mod prelude;
692
+ pub mod rng;
692
693
pub mod serial;
693
694
pub mod spi;
694
695
pub mod timer;
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ pub use digital::OutputPin as _embedded_hal_digital_OutputPin;
25
25
#[ cfg( feature = "unproven" ) ]
26
26
#[ allow( deprecated) ]
27
27
pub use digital:: ToggleableOutputPin as _embedded_hal_digital_ToggleableOutputPin;
28
+ #[ cfg( feature = "unproven" ) ]
29
+ pub use rng:: Read as _embedded_hal_rng_Read;
28
30
pub use serial:: Read as _embedded_hal_serial_Read;
29
31
pub use serial:: Write as _embedded_hal_serial_Write;
30
32
pub use spi:: FullDuplex as _embedded_hal_spi_FullDuplex;
Original file line number Diff line number Diff line change
1
+ //! Random Number Generator Interface
2
+
3
+ #[ cfg( feature = "unproven" ) ]
4
+ use nb;
5
+
6
+ /// Nonblocking stream of random bytes.
7
+ #[ cfg( feature = "unproven" ) ]
8
+ // reason: No implementation or users yet
9
+ pub trait Read {
10
+ /// An enumeration of RNG errors.
11
+ ///
12
+ /// For infallible implementations, will be `Infallible`
13
+ type Error ;
14
+
15
+ /// Get a number of bytes from the RNG.
16
+ fn read ( & mut self , buf : & mut [ u8 ] ) -> nb:: Result < usize , Self :: Error > ;
17
+ }
You can’t perform that action at this time.
0 commit comments