aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-rp')
-rw-r--r--embassy-rp/src/uart/mod.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs
index cfbce493c..6f4e2ee07 100644
--- a/embassy-rp/src/uart/mod.rs
+++ b/embassy-rp/src/uart/mod.rs
@@ -495,57 +495,57 @@ impl<'d> UartRx<'d, Async> {
495 unreachable!("unrecognized rx error"); 495 unreachable!("unrecognized rx error");
496 } 496 }
497 497
498 /// Read from the UART, waiting for a line break. 498 /// Read from the UART, waiting for a break.
499 /// 499 ///
500 /// We read until one of the following occurs: 500 /// We read until one of the following occurs:
501 /// 501 ///
502 /// * We read `buffer.len()` bytes without a line break 502 /// * We read `buffer.len()` bytes without a break
503 /// * returns `Err(ReadToBreakError::MissingBreak(buffer.len()))` 503 /// * returns `Err(ReadToBreakError::MissingBreak(buffer.len()))`
504 /// * We read `n` bytes then a line break occurs 504 /// * We read `n` bytes then a break occurs
505 /// * returns `Ok(n)` 505 /// * returns `Ok(n)`
506 /// * We encounter some error OTHER than a line break 506 /// * We encounter some error OTHER than a break
507 /// * returns `Err(ReadToBreakError::Other(error))` 507 /// * returns `Err(ReadToBreakError::Other(error))`
508 /// 508 ///
509 /// **NOTE**: you MUST provide a buffer one byte larger than your largest expected 509 /// **NOTE**: you MUST provide a buffer one byte larger than your largest expected
510 /// message to reliably detect the framing on one single call to `read_to_break()`. 510 /// message to reliably detect the framing on one single call to `read_to_break()`.
511 /// 511 ///
512 /// * If you expect a message of 20 bytes + line break, and provide a 20-byte buffer: 512 /// * If you expect a message of 20 bytes + break, and provide a 20-byte buffer:
513 /// * The first call to `read_to_break()` will return `Err(ReadToBreakError::MissingBreak(20))` 513 /// * The first call to `read_to_break()` will return `Err(ReadToBreakError::MissingBreak(20))`
514 /// * The next call to `read_to_break()` will immediately return `Ok(0)`, from the "stale" line break 514 /// * The next call to `read_to_break()` will immediately return `Ok(0)`, from the "stale" break
515 /// * If you expect a message of 20 bytes + line break, and provide a 21-byte buffer: 515 /// * If you expect a message of 20 bytes + break, and provide a 21-byte buffer:
516 /// * The first call to `read_to_break()` will return `Ok(20)`. 516 /// * The first call to `read_to_break()` will return `Ok(20)`.
517 /// * The next call to `read_to_break()` will work as expected 517 /// * The next call to `read_to_break()` will work as expected
518 /// 518 ///
519 /// **NOTE**: In the UART context, a line break refers to a break condition (the line being held low for 519 /// **NOTE**: In the UART context, a break refers to a break condition (the line being held low for
520 /// for longer than a single character), not an ASCII line break. 520 /// for longer than a single character), not an ASCII line break.
521 pub async fn read_to_break(&mut self, buffer: &mut [u8]) -> Result<usize, ReadToBreakError> { 521 pub async fn read_to_break(&mut self, buffer: &mut [u8]) -> Result<usize, ReadToBreakError> {
522 self.read_to_break_with_count(buffer, 0).await 522 self.read_to_break_with_count(buffer, 0).await
523 } 523 }
524 524
525 /// Read from the UART, waiting for a line break as soon as at least `min_count` bytes have been read. 525 /// Read from the UART, waiting for a break as soon as at least `min_count` bytes have been read.
526 /// 526 ///
527 /// We read until one of the following occurs: 527 /// We read until one of the following occurs:
528 /// 528 ///
529 /// * We read `buffer.len()` bytes without a line break 529 /// * We read `buffer.len()` bytes without a break
530 /// * returns `Err(ReadToBreakError::MissingBreak(buffer.len()))` 530 /// * returns `Err(ReadToBreakError::MissingBreak(buffer.len()))`
531 /// * We read `n > min_count` bytes then a line break occurs 531 /// * We read `n > min_count` bytes then a break occurs
532 /// * returns `Ok(n)` 532 /// * returns `Ok(n)`
533 /// * We encounter some error OTHER than a line break 533 /// * We encounter some error OTHER than a break
534 /// * returns `Err(ReadToBreakError::Other(error))` 534 /// * returns `Err(ReadToBreakError::Other(error))`
535 /// 535 ///
536 /// If a line break occurs before `min_count` bytes have been read, the break will be ignored and the read will continue 536 /// If a break occurs before `min_count` bytes have been read, the break will be ignored and the read will continue
537 /// 537 ///
538 /// **NOTE**: you MUST provide a buffer one byte larger than your largest expected 538 /// **NOTE**: you MUST provide a buffer one byte larger than your largest expected
539 /// message to reliably detect the framing on one single call to `read_to_break()`. 539 /// message to reliably detect the framing on one single call to `read_to_break()`.
540 /// 540 ///
541 /// * If you expect a message of 20 bytes + line break, and provide a 20-byte buffer: 541 /// * If you expect a message of 20 bytes + break, and provide a 20-byte buffer:
542 /// * The first call to `read_to_break()` will return `Err(ReadToBreakError::MissingBreak(20))` 542 /// * The first call to `read_to_break()` will return `Err(ReadToBreakError::MissingBreak(20))`
543 /// * The next call to `read_to_break()` will immediately return `Ok(0)`, from the "stale" line break 543 /// * The next call to `read_to_break()` will immediately return `Ok(0)`, from the "stale" line break
544 /// * If you expect a message of 20 bytes + line break, and provide a 21-byte buffer: 544 /// * If you expect a message of 20 bytes + break, and provide a 21-byte buffer:
545 /// * The first call to `read_to_break()` will return `Ok(20)`. 545 /// * The first call to `read_to_break()` will return `Ok(20)`.
546 /// * The next call to `read_to_break()` will work as expected 546 /// * The next call to `read_to_break()` will work as expected
547 /// 547 ///
548 /// **NOTE**: In the UART context, a line break refers to a break condition (the line being held low for 548 /// **NOTE**: In the UART context, a break refers to a break condition (the line being held low for
549 /// for longer than a single character), not an ASCII line break. 549 /// for longer than a single character), not an ASCII line break.
550 pub async fn read_to_break_with_count( 550 pub async fn read_to_break_with_count(
551 &mut self, 551 &mut self,