diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-12-09 19:46:19 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-09 19:46:19 +0000 |
| commit | 337e6e264e27908356ec65a80bf3ea779c01b7ab (patch) | |
| tree | 1b282ccffd6af3cd3089401e33a68b85207a05ed | |
| parent | a68574cea2b284e8694da377805b7dd13154bbdf (diff) | |
| parent | c578c48c062fcad76c006157b1f1c02cc8c80390 (diff) | |
Merge pull request #4975 from tonarino/cdm-adm-control
Expose `dtr()` and `rts()` on `cdc_acm::ControlChanged`
| -rw-r--r-- | embassy-usb/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | embassy-usb/src/class/cdc_acm.rs | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/embassy-usb/CHANGELOG.md b/embassy-usb/CHANGELOG.md index f90875166..431f4ddde 100644 --- a/embassy-usb/CHANGELOG.md +++ b/embassy-usb/CHANGELOG.md | |||
| @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 11 | - Add support for USB HID Boot Protocol Mode | 11 | - Add support for USB HID Boot Protocol Mode |
| 12 | - Bump usbd-hid from 0.8.1 to 0.9.0 | 12 | - Bump usbd-hid from 0.8.1 to 0.9.0 |
| 13 | - Fix a bug where CDC ACM BufferedReceiver repeats data when its future is dropped | 13 | - Fix a bug where CDC ACM BufferedReceiver repeats data when its future is dropped |
| 14 | - Expose `dtr()` and `rts()` on `cdc_acm::ControlChanged` | ||
| 14 | 15 | ||
| 15 | ## 0.5.1 - 2025-08-26 | 16 | ## 0.5.1 - 2025-08-26 |
| 16 | 17 | ||
diff --git a/embassy-usb/src/class/cdc_acm.rs b/embassy-usb/src/class/cdc_acm.rs index c990b679e..ab2311f4e 100644 --- a/embassy-usb/src/class/cdc_acm.rs +++ b/embassy-usb/src/class/cdc_acm.rs | |||
| @@ -366,6 +366,16 @@ impl<'d> ControlChanged<'d> { | |||
| 366 | pub async fn control_changed(&self) { | 366 | pub async fn control_changed(&self) { |
| 367 | self.control.changed().await; | 367 | self.control.changed().await; |
| 368 | } | 368 | } |
| 369 | |||
| 370 | /// Gets the DTR (data terminal ready) state | ||
| 371 | pub fn dtr(&self) -> bool { | ||
| 372 | self.control.dtr.load(Ordering::Relaxed) | ||
| 373 | } | ||
| 374 | |||
| 375 | /// Gets the RTS (request to send) state | ||
| 376 | pub fn rts(&self) -> bool { | ||
| 377 | self.control.rts.load(Ordering::Relaxed) | ||
| 378 | } | ||
| 369 | } | 379 | } |
| 370 | 380 | ||
| 371 | /// CDC ACM class packet sender. | 381 | /// CDC ACM class packet sender. |
