diff options
| author | xoviat <[email protected]> | 2023-06-19 15:52:33 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-06-19 15:52:33 -0500 |
| commit | aaad9068156305e5f6f41ee4013e025083bd0668 (patch) | |
| tree | 67a08c8a512e8791433891a3b6deec813fc4c578 /embassy-sync | |
| parent | 35083b262b364387713f4273649b62180123182c (diff) | |
| parent | 3c70f799a28f5f28d84fa8ee8b4b232f5e9aad82 (diff) | |
Merge branch 'main' of https://github.com/embassy-rs/embassy into can
Diffstat (limited to 'embassy-sync')
| -rw-r--r-- | embassy-sync/Cargo.toml | 2 | ||||
| -rw-r--r-- | embassy-sync/src/fmt.rs | 3 | ||||
| -rw-r--r-- | embassy-sync/src/pipe.rs | 10 |
3 files changed, 11 insertions, 4 deletions
diff --git a/embassy-sync/Cargo.toml b/embassy-sync/Cargo.toml index bc06b92cd..340724eab 100644 --- a/embassy-sync/Cargo.toml +++ b/embassy-sync/Cargo.toml | |||
| @@ -45,4 +45,4 @@ futures-util = { version = "0.3.17", features = [ "channel" ] } | |||
| 45 | 45 | ||
| 46 | # Enable critical-section implementation for std, for tests | 46 | # Enable critical-section implementation for std, for tests |
| 47 | critical-section = { version = "1.1", features = ["std"] } | 47 | critical-section = { version = "1.1", features = ["std"] } |
| 48 | static_cell = "1.0" | 48 | static_cell = "1.1" |
diff --git a/embassy-sync/src/fmt.rs b/embassy-sync/src/fmt.rs index f8bb0a035..066970813 100644 --- a/embassy-sync/src/fmt.rs +++ b/embassy-sync/src/fmt.rs | |||
| @@ -195,9 +195,6 @@ macro_rules! unwrap { | |||
| 195 | } | 195 | } |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | #[cfg(feature = "defmt-timestamp-uptime")] | ||
| 199 | defmt::timestamp! {"{=u64:us}", crate::time::Instant::now().as_micros() } | ||
| 200 | |||
| 201 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] | 198 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] |
| 202 | pub struct NoneError; | 199 | pub struct NoneError; |
| 203 | 200 | ||
diff --git a/embassy-sync/src/pipe.rs b/embassy-sync/src/pipe.rs index ee27cdec8..db6ebb08b 100644 --- a/embassy-sync/src/pipe.rs +++ b/embassy-sync/src/pipe.rs | |||
| @@ -294,6 +294,16 @@ where | |||
| 294 | WriteFuture { pipe: self, buf } | 294 | WriteFuture { pipe: self, buf } |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | /// Write all bytes to the pipe. | ||
| 298 | /// | ||
| 299 | /// This method writes all bytes from `buf` into the pipe | ||
| 300 | pub async fn write_all(&self, mut buf: &[u8]) { | ||
| 301 | while !buf.is_empty() { | ||
| 302 | let n = self.write(buf).await; | ||
| 303 | buf = &buf[n..]; | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 297 | /// Attempt to immediately write some bytes to the pipe. | 307 | /// Attempt to immediately write some bytes to the pipe. |
| 298 | /// | 308 | /// |
| 299 | /// This method will either write a nonzero amount of bytes to the pipe immediately, | 309 | /// This method will either write a nonzero amount of bytes to the pipe immediately, |
