From d4179ee2e444b42260269e4f17a18a9d16c3261f Mon Sep 17 00:00:00 2001 From: huntc Date: Fri, 12 Nov 2021 16:49:48 +1100 Subject: [PATCH] Some documentation corrections and expansion --- embassy-nrf/src/saadc.rs | 2 +- embassy/src/channel/signal.rs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/embassy-nrf/src/saadc.rs b/embassy-nrf/src/saadc.rs index bc83b5b61..617c9e041 100644 --- a/embassy-nrf/src/saadc.rs +++ b/embassy-nrf/src/saadc.rs @@ -29,7 +29,7 @@ use saadc::{ #[non_exhaustive] pub enum Error {} -/// One-shot saadc. Continuous sample mode TODO. +/// One-shot and continuous SAADC. pub struct Saadc<'d, const N: usize> { phantom: PhantomData<&'d mut peripherals::SAADC>, } diff --git a/embassy/src/channel/signal.rs b/embassy/src/channel/signal.rs index d5698732c..87922b2fd 100644 --- a/embassy/src/channel/signal.rs +++ b/embassy/src/channel/signal.rs @@ -4,8 +4,21 @@ use core::mem; use core::task::{Context, Poll, Waker}; /// Synchronization primitive. Allows creating awaitable signals that may be passed between tasks. +/// For a simple use-case where the receiver is only ever interested in the latest value of +/// something, Signals work well. For more advanced use cases, please consider [crate::channel::mpsc]. /// -/// For more advanced use cases, please consider [futures-intrusive](https://crates.io/crates/futures-intrusive) channels or mutexes. +/// Signals are generally declared as being a static const and then borrowed as required. +/// +/// ``` +/// use embassy::channel::signal::Signal; +/// +/// enum SomeCommand { +/// On, +/// Off, +/// } +/// +/// static SOME_SIGNAL: Signal = Signal::new(); +/// ``` pub struct Signal { state: UnsafeCell>, }