diff options
| author | Ulf Lilleengen <[email protected]> | 2022-08-22 10:36:33 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2022-08-22 16:37:35 +0200 |
| commit | 3e155d2ec366379584bf7ba4a447109555aa0d77 (patch) | |
| tree | e1a6a8340354ea67316697bf737bd08ec0ab7d00 /embassy-nrf/src/buffered_uarte.rs | |
| parent | 5fddff849eea74fb240147432a1739ae1759cb6c (diff) | |
nRF documentation warning fixes
Diffstat (limited to 'embassy-nrf/src/buffered_uarte.rs')
| -rw-r--r-- | embassy-nrf/src/buffered_uarte.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/embassy-nrf/src/buffered_uarte.rs b/embassy-nrf/src/buffered_uarte.rs index 21ff1d73b..08dfcbcf9 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs | |||
| @@ -45,8 +45,10 @@ enum TxState { | |||
| 45 | Transmitting(usize), | 45 | Transmitting(usize), |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /// A type for storing the state of the UARTE peripheral that can be stored in a static. | ||
| 48 | pub struct State<'d, U: UarteInstance, T: TimerInstance>(StateStorage<StateInner<'d, U, T>>); | 49 | pub struct State<'d, U: UarteInstance, T: TimerInstance>(StateStorage<StateInner<'d, U, T>>); |
| 49 | impl<'d, U: UarteInstance, T: TimerInstance> State<'d, U, T> { | 50 | impl<'d, U: UarteInstance, T: TimerInstance> State<'d, U, T> { |
| 51 | /// Create an instance for storing UARTE peripheral state. | ||
| 50 | pub fn new() -> Self { | 52 | pub fn new() -> Self { |
| 51 | Self(StateStorage::new()) | 53 | Self(StateStorage::new()) |
| 52 | } | 54 | } |
| @@ -75,6 +77,12 @@ pub struct BufferedUarte<'d, U: UarteInstance, T: TimerInstance> { | |||
| 75 | impl<'d, U: UarteInstance, T: TimerInstance> Unpin for BufferedUarte<'d, U, T> {} | 77 | impl<'d, U: UarteInstance, T: TimerInstance> Unpin for BufferedUarte<'d, U, T> {} |
| 76 | 78 | ||
| 77 | impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { | 79 | impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { |
| 80 | /// Create a new instance of a BufferedUarte. | ||
| 81 | /// | ||
| 82 | /// See the [module documentation](crate::buffered_uarte) for more details about the intended use. | ||
| 83 | /// | ||
| 84 | /// The BufferedUarte uses the provided state to store the buffers and peripheral state. The timer and ppi channels are used to 'emulate' idle line detection so that read operations | ||
| 85 | /// can return early if there is no data to receive. | ||
| 78 | pub fn new( | 86 | pub fn new( |
| 79 | state: &'d mut State<'d, U, T>, | 87 | state: &'d mut State<'d, U, T>, |
| 80 | peri: impl Peripheral<P = U> + 'd, | 88 | peri: impl Peripheral<P = U> + 'd, |
| @@ -178,6 +186,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { | |||
| 178 | } | 186 | } |
| 179 | } | 187 | } |
| 180 | 188 | ||
| 189 | /// Adjust the baud rate to the provided value. | ||
| 181 | pub fn set_baudrate(&mut self, baudrate: Baudrate) { | 190 | pub fn set_baudrate(&mut self, baudrate: Baudrate) { |
| 182 | self.inner.with(|state| { | 191 | self.inner.with(|state| { |
| 183 | let r = U::regs(); | 192 | let r = U::regs(); |
