diff options
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rng.rs | 20 | ||||
| -rw-r--r-- | embassy-time-queue-utils/src/lib.rs | 1 | ||||
| -rw-r--r-- | embassy-time-queue-utils/src/queue_generic.rs | 2 | ||||
| -rw-r--r-- | embassy-time-queue-utils/src/queue_integrated.rs | 1 | ||||
| -rw-r--r-- | embassy-time/src/delay.rs | 3 | ||||
| -rw-r--r-- | embassy-time/src/driver_mock.rs | 2 | ||||
| -rw-r--r-- | embassy-time/src/driver_std.rs | 6 | ||||
| -rw-r--r-- | embassy-time/src/driver_wasm.rs | 6 | ||||
| -rw-r--r-- | embassy-time/src/lib.rs | 1 | ||||
| -rw-r--r-- | embassy-time/src/timer.rs | 6 |
11 files changed, 41 insertions, 9 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 913da2e25..c8f1f46c2 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -98,7 +98,7 @@ pub(crate) struct TaskHeader { | |||
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /// This is essentially a `&'static TaskStorage<F>` where the type of the future has been erased. | 100 | /// This is essentially a `&'static TaskStorage<F>` where the type of the future has been erased. |
| 101 | #[derive(Clone, Copy, PartialEq)] | 101 | #[derive(Debug, Clone, Copy, PartialEq)] |
| 102 | pub struct TaskRef { | 102 | pub struct TaskRef { |
| 103 | ptr: NonNull<TaskHeader>, | 103 | ptr: NonNull<TaskHeader>, |
| 104 | } | 104 | } |
diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 312f343b9..63654639e 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs | |||
| @@ -99,13 +99,19 @@ impl<'d, T: Instance> Rng<'d, T> { | |||
| 99 | }); | 99 | }); |
| 100 | // wait for CONDRST to be set | 100 | // wait for CONDRST to be set |
| 101 | while !T::regs().cr().read().condrst() {} | 101 | while !T::regs().cr().read().condrst() {} |
| 102 | // magic number must be written immediately before every read or write access to HTCR | 102 | |
| 103 | T::regs().htcr().write(|w| w.set_htcfg(pac::rng::vals::Htcfg::MAGIC)); | 103 | // TODO for WBA6, the HTCR reg is different |
| 104 | // write recommended value according to reference manual | 104 | #[cfg(not(rng_wba6))] |
| 105 | // note: HTCR can only be written during conditioning | 105 | { |
| 106 | T::regs() | 106 | // magic number must be written immediately before every read or write access to HTCR |
| 107 | .htcr() | 107 | T::regs().htcr().write(|w| w.set_htcfg(pac::rng::vals::Htcfg::MAGIC)); |
| 108 | .write(|w| w.set_htcfg(pac::rng::vals::Htcfg::RECOMMENDED)); | 108 | // write recommended value according to reference manual |
| 109 | // note: HTCR can only be written during conditioning | ||
| 110 | T::regs() | ||
| 111 | .htcr() | ||
| 112 | .write(|w| w.set_htcfg(pac::rng::vals::Htcfg::RECOMMENDED)); | ||
| 113 | } | ||
| 114 | |||
| 109 | // finish conditioning | 115 | // finish conditioning |
| 110 | T::regs().cr().modify(|reg| { | 116 | T::regs().cr().modify(|reg| { |
| 111 | reg.set_rngen(true); | 117 | reg.set_rngen(true); |
diff --git a/embassy-time-queue-utils/src/lib.rs b/embassy-time-queue-utils/src/lib.rs index a6f66913f..08e186432 100644 --- a/embassy-time-queue-utils/src/lib.rs +++ b/embassy-time-queue-utils/src/lib.rs | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![doc = include_str!("../README.md")] | 2 | #![doc = include_str!("../README.md")] |
| 3 | #![warn(missing_docs)] | 3 | #![warn(missing_docs)] |
| 4 | #![deny(missing_debug_implementations)] | ||
| 4 | 5 | ||
| 5 | #[cfg(feature = "_generic-queue")] | 6 | #[cfg(feature = "_generic-queue")] |
| 6 | pub mod queue_generic; | 7 | pub mod queue_generic; |
diff --git a/embassy-time-queue-utils/src/queue_generic.rs b/embassy-time-queue-utils/src/queue_generic.rs index 232035bc6..bff7a4735 100644 --- a/embassy-time-queue-utils/src/queue_generic.rs +++ b/embassy-time-queue-utils/src/queue_generic.rs | |||
| @@ -34,6 +34,7 @@ impl Ord for Timer { | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | /// A timer queue with a pre-determined capacity. | 36 | /// A timer queue with a pre-determined capacity. |
| 37 | #[derive(Debug)] | ||
| 37 | pub struct ConstGenericQueue<const QUEUE_SIZE: usize> { | 38 | pub struct ConstGenericQueue<const QUEUE_SIZE: usize> { |
| 38 | queue: Vec<Timer, QUEUE_SIZE>, | 39 | queue: Vec<Timer, QUEUE_SIZE>, |
| 39 | } | 40 | } |
| @@ -119,6 +120,7 @@ const QUEUE_SIZE: usize = 128; | |||
| 119 | const QUEUE_SIZE: usize = 64; | 120 | const QUEUE_SIZE: usize = 64; |
| 120 | 121 | ||
| 121 | /// A timer queue with a pre-determined capacity. | 122 | /// A timer queue with a pre-determined capacity. |
| 123 | #[derive(Debug)] | ||
| 122 | pub struct Queue { | 124 | pub struct Queue { |
| 123 | queue: ConstGenericQueue<QUEUE_SIZE>, | 125 | queue: ConstGenericQueue<QUEUE_SIZE>, |
| 124 | } | 126 | } |
diff --git a/embassy-time-queue-utils/src/queue_integrated.rs b/embassy-time-queue-utils/src/queue_integrated.rs index 246cf1d63..748cd7843 100644 --- a/embassy-time-queue-utils/src/queue_integrated.rs +++ b/embassy-time-queue-utils/src/queue_integrated.rs | |||
| @@ -6,6 +6,7 @@ use core::task::Waker; | |||
| 6 | use embassy_executor::raw::TaskRef; | 6 | use embassy_executor::raw::TaskRef; |
| 7 | 7 | ||
| 8 | /// A timer queue, with items integrated into tasks. | 8 | /// A timer queue, with items integrated into tasks. |
| 9 | #[derive(Debug)] | ||
| 9 | pub struct Queue { | 10 | pub struct Queue { |
| 10 | head: Cell<Option<TaskRef>>, | 11 | head: Cell<Option<TaskRef>>, |
| 11 | } | 12 | } |
diff --git a/embassy-time/src/delay.rs b/embassy-time/src/delay.rs index f77859d4a..67345f726 100644 --- a/embassy-time/src/delay.rs +++ b/embassy-time/src/delay.rs | |||
| @@ -13,7 +13,8 @@ pub fn block_for(duration: Duration) { | |||
| 13 | /// the amount provided, but accuracy can be affected by many factors, including interrupt usage. | 13 | /// the amount provided, but accuracy can be affected by many factors, including interrupt usage. |
| 14 | /// Make sure to use a suitable tick rate for your use case. The tick rate is defined by the currently | 14 | /// Make sure to use a suitable tick rate for your use case. The tick rate is defined by the currently |
| 15 | /// active driver. | 15 | /// active driver. |
| 16 | #[derive(Clone)] | 16 | #[derive(Clone, Debug)] |
| 17 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 17 | pub struct Delay; | 18 | pub struct Delay; |
| 18 | 19 | ||
| 19 | impl embedded_hal_1::delay::DelayNs for Delay { | 20 | impl embedded_hal_1::delay::DelayNs for Delay { |
diff --git a/embassy-time/src/driver_mock.rs b/embassy-time/src/driver_mock.rs index bb1961bf2..bcde2a6c9 100644 --- a/embassy-time/src/driver_mock.rs +++ b/embassy-time/src/driver_mock.rs | |||
| @@ -28,6 +28,7 @@ use crate::{Duration, Instant}; | |||
| 28 | /// assert_eq!(true, has_a_second_passed(reference)); | 28 | /// assert_eq!(true, has_a_second_passed(reference)); |
| 29 | /// } | 29 | /// } |
| 30 | /// ``` | 30 | /// ``` |
| 31 | #[derive(Debug)] | ||
| 31 | pub struct MockDriver(CsMutex<RefCell<InnerMockDriver>>); | 32 | pub struct MockDriver(CsMutex<RefCell<InnerMockDriver>>); |
| 32 | 33 | ||
| 33 | embassy_time_driver::time_driver_impl!(static DRIVER: MockDriver = MockDriver::new()); | 34 | embassy_time_driver::time_driver_impl!(static DRIVER: MockDriver = MockDriver::new()); |
| @@ -80,6 +81,7 @@ impl Driver for MockDriver { | |||
| 80 | } | 81 | } |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 84 | #[derive(Debug)] | ||
| 83 | struct InnerMockDriver { | 85 | struct InnerMockDriver { |
| 84 | now: Instant, | 86 | now: Instant, |
| 85 | queue: Queue, | 87 | queue: Queue, |
diff --git a/embassy-time/src/driver_std.rs b/embassy-time/src/driver_std.rs index 87d7ef7eb..a77eed75e 100644 --- a/embassy-time/src/driver_std.rs +++ b/embassy-time/src/driver_std.rs | |||
| @@ -5,11 +5,15 @@ use std::time::{Duration as StdDuration, Instant as StdInstant}; | |||
| 5 | use embassy_time_driver::Driver; | 5 | use embassy_time_driver::Driver; |
| 6 | use embassy_time_queue_utils::Queue; | 6 | use embassy_time_queue_utils::Queue; |
| 7 | 7 | ||
| 8 | #[derive(Debug)] | ||
| 9 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 8 | struct TimeDriver { | 10 | struct TimeDriver { |
| 9 | signaler: Signaler, | 11 | signaler: Signaler, |
| 10 | inner: Mutex<Inner>, | 12 | inner: Mutex<Inner>, |
| 11 | } | 13 | } |
| 12 | 14 | ||
| 15 | #[derive(Debug)] | ||
| 16 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 13 | struct Inner { | 17 | struct Inner { |
| 14 | zero_instant: Option<StdInstant>, | 18 | zero_instant: Option<StdInstant>, |
| 15 | queue: Queue, | 19 | queue: Queue, |
| @@ -64,6 +68,8 @@ fn alarm_thread() { | |||
| 64 | } | 68 | } |
| 65 | } | 69 | } |
| 66 | 70 | ||
| 71 | #[derive(Debug)] | ||
| 72 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 67 | struct Signaler { | 73 | struct Signaler { |
| 68 | mutex: Mutex<bool>, | 74 | mutex: Mutex<bool>, |
| 69 | condvar: Condvar, | 75 | condvar: Condvar, |
diff --git a/embassy-time/src/driver_wasm.rs b/embassy-time/src/driver_wasm.rs index e3207691a..646ce170e 100644 --- a/embassy-time/src/driver_wasm.rs +++ b/embassy-time/src/driver_wasm.rs | |||
| @@ -5,6 +5,8 @@ use embassy_time_queue_utils::Queue; | |||
| 5 | use wasm_bindgen::prelude::*; | 5 | use wasm_bindgen::prelude::*; |
| 6 | use wasm_timer::Instant as StdInstant; | 6 | use wasm_timer::Instant as StdInstant; |
| 7 | 7 | ||
| 8 | #[derive(Debug)] | ||
| 9 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 8 | struct AlarmState { | 10 | struct AlarmState { |
| 9 | token: Option<f64>, | 11 | token: Option<f64>, |
| 10 | } | 12 | } |
| @@ -21,10 +23,14 @@ extern "C" { | |||
| 21 | fn clearTimeout(token: f64); | 23 | fn clearTimeout(token: f64); |
| 22 | } | 24 | } |
| 23 | 25 | ||
| 26 | #[derive(Debug)] | ||
| 27 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 24 | struct TimeDriver { | 28 | struct TimeDriver { |
| 25 | inner: Mutex<Inner>, | 29 | inner: Mutex<Inner>, |
| 26 | } | 30 | } |
| 27 | 31 | ||
| 32 | #[derive(Debug)] | ||
| 33 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 28 | struct Inner { | 34 | struct Inner { |
| 29 | alarm: AlarmState, | 35 | alarm: AlarmState, |
| 30 | zero_instant: Option<StdInstant>, | 36 | zero_instant: Option<StdInstant>, |
diff --git a/embassy-time/src/lib.rs b/embassy-time/src/lib.rs index 80a359413..77f4b344d 100644 --- a/embassy-time/src/lib.rs +++ b/embassy-time/src/lib.rs | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #![doc = include_str!("../README.md")] | 3 | #![doc = include_str!("../README.md")] |
| 4 | #![allow(clippy::new_without_default)] | 4 | #![allow(clippy::new_without_default)] |
| 5 | #![warn(missing_docs)] | 5 | #![warn(missing_docs)] |
| 6 | #![deny(missing_debug_implementations)] | ||
| 6 | 7 | ||
| 7 | //! ## Feature flags | 8 | //! ## Feature flags |
| 8 | #![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)] | 9 | #![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)] |
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index d3f1e1621..54bb9b6d8 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs | |||
| @@ -66,6 +66,8 @@ impl<F: Future> WithTimeout for F { | |||
| 66 | 66 | ||
| 67 | /// Future for the [`with_timeout`] and [`with_deadline`] functions. | 67 | /// Future for the [`with_timeout`] and [`with_deadline`] functions. |
| 68 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 68 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 69 | #[derive(Debug)] | ||
| 70 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 69 | pub struct TimeoutFuture<F> { | 71 | pub struct TimeoutFuture<F> { |
| 70 | timer: Timer, | 72 | timer: Timer, |
| 71 | fut: F, | 73 | fut: F, |
| @@ -92,6 +94,8 @@ impl<F: Future> Future for TimeoutFuture<F> { | |||
| 92 | 94 | ||
| 93 | /// A future that completes at a specified [Instant](struct.Instant.html). | 95 | /// A future that completes at a specified [Instant](struct.Instant.html). |
| 94 | #[must_use = "futures do nothing unless you `.await` or poll them"] | 96 | #[must_use = "futures do nothing unless you `.await` or poll them"] |
| 97 | #[derive(Debug)] | ||
| 98 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 95 | pub struct Timer { | 99 | pub struct Timer { |
| 96 | expires_at: Instant, | 100 | expires_at: Instant, |
| 97 | yielded_once: bool, | 101 | yielded_once: bool, |
| @@ -227,6 +231,8 @@ impl Future for Timer { | |||
| 227 | /// ## Cancel safety | 231 | /// ## Cancel safety |
| 228 | /// It is safe to cancel waiting for the next tick, | 232 | /// It is safe to cancel waiting for the next tick, |
| 229 | /// meaning no tick is lost if the Future is dropped. | 233 | /// meaning no tick is lost if the Future is dropped. |
| 234 | #[derive(Debug)] | ||
| 235 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 230 | pub struct Ticker { | 236 | pub struct Ticker { |
| 231 | expires_at: Instant, | 237 | expires_at: Instant, |
| 232 | duration: Duration, | 238 | duration: Duration, |
