diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-01-31 22:27:19 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-01-31 22:27:19 +0100 |
| commit | ca10fe7135d10084e38038f3cd433da39e505bea (patch) | |
| tree | 075aca4a76caccd1bba95869c64bbb838969c8b1 /embassy-usb/src/class/cdc_acm.rs | |
| parent | 4c1946454874597c358e7c7d5bf555b687376a5b (diff) | |
usb: docs
Diffstat (limited to 'embassy-usb/src/class/cdc_acm.rs')
| -rw-r--r-- | embassy-usb/src/class/cdc_acm.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/embassy-usb/src/class/cdc_acm.rs b/embassy-usb/src/class/cdc_acm.rs index 84db20621..09f17456c 100644 --- a/embassy-usb/src/class/cdc_acm.rs +++ b/embassy-usb/src/class/cdc_acm.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | //! CDC-ACM class implementation, aka Serial over USB. | ||
| 2 | |||
| 1 | use core::cell::Cell; | 3 | use core::cell::Cell; |
| 2 | use core::mem::{self, MaybeUninit}; | 4 | use core::mem::{self, MaybeUninit}; |
| 3 | use core::sync::atomic::{AtomicBool, Ordering}; | 5 | use core::sync::atomic::{AtomicBool, Ordering}; |
| @@ -28,12 +30,14 @@ const REQ_SET_LINE_CODING: u8 = 0x20; | |||
| 28 | const REQ_GET_LINE_CODING: u8 = 0x21; | 30 | const REQ_GET_LINE_CODING: u8 = 0x21; |
| 29 | const REQ_SET_CONTROL_LINE_STATE: u8 = 0x22; | 31 | const REQ_SET_CONTROL_LINE_STATE: u8 = 0x22; |
| 30 | 32 | ||
| 33 | /// Internal state for CDC-ACM | ||
| 31 | pub struct State<'a> { | 34 | pub struct State<'a> { |
| 32 | control: MaybeUninit<Control<'a>>, | 35 | control: MaybeUninit<Control<'a>>, |
| 33 | shared: ControlShared, | 36 | shared: ControlShared, |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | impl<'a> State<'a> { | 39 | impl<'a> State<'a> { |
| 40 | /// Create a new `State`. | ||
| 37 | pub fn new() -> Self { | 41 | pub fn new() -> Self { |
| 38 | Self { | 42 | Self { |
| 39 | control: MaybeUninit::uninit(), | 43 | control: MaybeUninit::uninit(), |
| @@ -284,10 +288,15 @@ impl From<u8> for StopBits { | |||
| 284 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] | 288 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
| 285 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 289 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 286 | pub enum ParityType { | 290 | pub enum ParityType { |
| 291 | /// No parity bit. | ||
| 287 | None = 0, | 292 | None = 0, |
| 293 | /// Parity bit is 1 if the amount of `1` bits in the data byte is odd. | ||
| 288 | Odd = 1, | 294 | Odd = 1, |
| 295 | /// Parity bit is 1 if the amount of `1` bits in the data byte is even. | ||
| 289 | Even = 2, | 296 | Even = 2, |
| 297 | /// Parity bit is always 1 | ||
| 290 | Mark = 3, | 298 | Mark = 3, |
| 299 | /// Parity bit is always 0 | ||
| 291 | Space = 4, | 300 | Space = 4, |
| 292 | } | 301 | } |
| 293 | 302 | ||
