diff options
| author | Matt Bhagat-Conway <[email protected]> | 2025-07-03 10:31:28 -0400 |
|---|---|---|
| committer | Matt Bhagat-Conway <[email protected]> | 2025-07-03 10:31:28 -0400 |
| commit | 388eee221e16717fe47913d26a1f6ed4cd35d4bc (patch) | |
| tree | 250edaf46e91d52ed477a49e2f2378a7e10ff4e8 | |
| parent | 4727c07a0830db45fb4424e2c861c6c44efa4fb1 (diff) | |
add note about UART line breaks being different from ASCII
| -rw-r--r-- | embassy-rp/src/uart/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/embassy-rp/src/uart/mod.rs b/embassy-rp/src/uart/mod.rs index c3a15fda5..b730d33e3 100644 --- a/embassy-rp/src/uart/mod.rs +++ b/embassy-rp/src/uart/mod.rs | |||
| @@ -515,6 +515,9 @@ impl<'d> UartRx<'d, Async> { | |||
| 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 + line 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 | /// | ||
| 519 | /// **NOTE**: In the UART context, a line break refers to a break condition (the line being held low for | ||
| 520 | /// for longer than a single character), not an ASCII line break. | ||
| 518 | 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> { |
| 519 | self.read_to_break_with_count(buffer, 0).await | 522 | self.read_to_break_with_count(buffer, 0).await |
| 520 | } | 523 | } |
| @@ -541,6 +544,9 @@ impl<'d> UartRx<'d, Async> { | |||
| 541 | /// * 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 + line break, and provide a 21-byte buffer: |
| 542 | /// * The first call to `read_to_break()` will return `Ok(20)`. | 545 | /// * The first call to `read_to_break()` will return `Ok(20)`. |
| 543 | /// * The next call to `read_to_break()` will work as expected | 546 | /// * The next call to `read_to_break()` will work as expected |
| 547 | /// | ||
| 548 | /// **NOTE**: In the UART context, a line break refers to a break condition (the line being held low for | ||
| 549 | /// for longer than a single character), not an ASCII line break. | ||
| 544 | pub async fn read_to_break_with_count( | 550 | pub async fn read_to_break_with_count( |
| 545 | &mut self, | 551 | &mut self, |
| 546 | buffer: &mut [u8], | 552 | buffer: &mut [u8], |
