diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-08-22 14:43:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-22 14:43:56 +0000 |
commit | 61356181b223e95f289ca3af3a038a699cde2112 (patch) | |
tree | 2633607c1d62ed6f7482ee596325c9da24cb566e /embassy-nrf/src/buffered_uarte.rs | |
parent | 53fbd0efb3e77e1e3de948afde2b5bf1a5a9735f (diff) | |
parent | 3e155d2ec366379584bf7ba4a447109555aa0d77 (diff) | |
download | embassy-61356181b223e95f289ca3af3a038a699cde2112.zip |
Merge #918
918: Doc warnings r=Dirbaio a=lulf
Fixing a few doc warnings in embassy-executor, embassy-time, embassy-usb and embassy-nrf. There are more left, but I need a break :D
Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
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 21ff1d73..08dfcbcf 100644 --- a/embassy-nrf/src/buffered_uarte.rs +++ b/embassy-nrf/src/buffered_uarte.rs @@ -45,8 +45,10 @@ enum TxState { Transmitting(usize), } +/// A type for storing the state of the UARTE peripheral that can be stored in a static. pub struct State<'d, U: UarteInstance, T: TimerInstance>(StateStorage<StateInner<'d, U, T>>); impl<'d, U: UarteInstance, T: TimerInstance> State<'d, U, T> { + /// Create an instance for storing UARTE peripheral state. pub fn new() -> Self { Self(StateStorage::new()) } @@ -75,6 +77,12 @@ pub struct BufferedUarte<'d, U: UarteInstance, T: TimerInstance> { impl<'d, U: UarteInstance, T: TimerInstance> Unpin for BufferedUarte<'d, U, T> {} impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { + /// Create a new instance of a BufferedUarte. + /// + /// See the [module documentation](crate::buffered_uarte) for more details about the intended use. + /// + /// 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 + /// can return early if there is no data to receive. pub fn new( state: &'d mut State<'d, U, T>, peri: impl Peripheral<P = U> + 'd, @@ -178,6 +186,7 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarte<'d, U, T> { } } + /// Adjust the baud rate to the provided value. pub fn set_baudrate(&mut self, baudrate: Baudrate) { self.inner.with(|state| { let r = U::regs(); |