diff options
| author | huntc <[email protected]> | 2021-11-12 16:49:48 +1100 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-11-22 12:26:11 +1100 |
| commit | d4179ee2e444b42260269e4f17a18a9d16c3261f (patch) | |
| tree | d9f66e9614fbcea4a6447a2739dab4904ed6023e | |
| parent | 10a3a8bbed24425832becc83d07651bb3682a021 (diff) | |
Some documentation corrections and expansion
| -rw-r--r-- | embassy-nrf/src/saadc.rs | 2 | ||||
| -rw-r--r-- | 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::{ | |||
| 29 | #[non_exhaustive] | 29 | #[non_exhaustive] |
| 30 | pub enum Error {} | 30 | pub enum Error {} |
| 31 | 31 | ||
| 32 | /// One-shot saadc. Continuous sample mode TODO. | 32 | /// One-shot and continuous SAADC. |
| 33 | pub struct Saadc<'d, const N: usize> { | 33 | pub struct Saadc<'d, const N: usize> { |
| 34 | phantom: PhantomData<&'d mut peripherals::SAADC>, | 34 | phantom: PhantomData<&'d mut peripherals::SAADC>, |
| 35 | } | 35 | } |
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; | |||
| 4 | use core::task::{Context, Poll, Waker}; | 4 | use core::task::{Context, Poll, Waker}; |
| 5 | 5 | ||
| 6 | /// Synchronization primitive. Allows creating awaitable signals that may be passed between tasks. | 6 | /// Synchronization primitive. Allows creating awaitable signals that may be passed between tasks. |
| 7 | /// For a simple use-case where the receiver is only ever interested in the latest value of | ||
| 8 | /// something, Signals work well. For more advanced use cases, please consider [crate::channel::mpsc]. | ||
| 7 | /// | 9 | /// |
| 8 | /// For more advanced use cases, please consider [futures-intrusive](https://crates.io/crates/futures-intrusive) channels or mutexes. | 10 | /// Signals are generally declared as being a static const and then borrowed as required. |
| 11 | /// | ||
| 12 | /// ``` | ||
| 13 | /// use embassy::channel::signal::Signal; | ||
| 14 | /// | ||
| 15 | /// enum SomeCommand { | ||
| 16 | /// On, | ||
| 17 | /// Off, | ||
| 18 | /// } | ||
| 19 | /// | ||
| 20 | /// static SOME_SIGNAL: Signal<SomeCommand> = Signal::new(); | ||
| 21 | /// ``` | ||
| 9 | pub struct Signal<T> { | 22 | pub struct Signal<T> { |
| 10 | state: UnsafeCell<State<T>>, | 23 | state: UnsafeCell<State<T>>, |
| 11 | } | 24 | } |
