aboutsummaryrefslogtreecommitdiff
path: root/embassy-std
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-02-26 01:58:00 +0100
committerDario Nieuwenhuis <[email protected]>2021-02-26 01:58:00 +0100
commit17cf301d4fdc3bc0b1356ed250bfacca0d67ef3e (patch)
treeaf8f914473df09e19651660a79e19aa06e201419 /embassy-std
parent11be9170ec018dcc9284b413c5313ce7bb07159f (diff)
Remove rand(), fixes #50
Diffstat (limited to 'embassy-std')
-rw-r--r--embassy-std/Cargo.toml3
-rw-r--r--embassy-std/src/lib.rs9
2 files changed, 1 insertions, 11 deletions
diff --git a/embassy-std/Cargo.toml b/embassy-std/Cargo.toml
index 2a8028137..0a59999c0 100644
--- a/embassy-std/Cargo.toml
+++ b/embassy-std/Cargo.toml
@@ -6,5 +6,4 @@ edition = "2018"
6 6
7[dependencies] 7[dependencies]
8embassy = { version = "0.1.0", path = "../embassy", features = ["std"] } 8embassy = { version = "0.1.0", path = "../embassy", features = ["std"] }
9lazy_static = "1.4.0" 9lazy_static = "1.4.0" \ No newline at end of file
10rand_core = { version = "0.6.0", features = ["std"] }
diff --git a/embassy-std/src/lib.rs b/embassy-std/src/lib.rs
index 29f4de421..688054cb9 100644
--- a/embassy-std/src/lib.rs
+++ b/embassy-std/src/lib.rs
@@ -1,7 +1,6 @@
1use embassy::executor::{raw, Spawner}; 1use embassy::executor::{raw, Spawner};
2use embassy::time::TICKS_PER_SECOND; 2use embassy::time::TICKS_PER_SECOND;
3use embassy::time::{Alarm, Clock}; 3use embassy::time::{Alarm, Clock};
4use rand_core::{OsRng, RngCore};
5use std::marker::PhantomData; 4use std::marker::PhantomData;
6use std::mem::MaybeUninit; 5use std::mem::MaybeUninit;
7use std::ptr; 6use std::ptr;
@@ -19,13 +18,6 @@ impl Clock for StdClock {
19 } 18 }
20} 19}
21 20
22struct StdRand;
23impl embassy::rand::Rand for StdRand {
24 fn rand(&self, buf: &mut [u8]) {
25 OsRng.fill_bytes(buf);
26 }
27}
28
29static mut ALARM_AT: u64 = u64::MAX; 21static mut ALARM_AT: u64 = u64::MAX;
30 22
31pub struct StdAlarm; 23pub struct StdAlarm;
@@ -101,7 +93,6 @@ impl Executor {
101 unsafe { 93 unsafe {
102 CLOCK_ZERO.as_mut_ptr().write(StdInstant::now()); 94 CLOCK_ZERO.as_mut_ptr().write(StdInstant::now());
103 embassy::time::set_clock(&StdClock); 95 embassy::time::set_clock(&StdClock);
104 embassy::rand::set_rand(&StdRand);
105 } 96 }
106 97
107 Self { 98 Self {