aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb/src/class/cdc_acm.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-01-31 22:27:19 +0100
committerDario Nieuwenhuis <[email protected]>2023-01-31 22:27:19 +0100
commitca10fe7135d10084e38038f3cd433da39e505bea (patch)
tree075aca4a76caccd1bba95869c64bbb838969c8b1 /embassy-usb/src/class/cdc_acm.rs
parent4c1946454874597c358e7c7d5bf555b687376a5b (diff)
usb: docs
Diffstat (limited to 'embassy-usb/src/class/cdc_acm.rs')
-rw-r--r--embassy-usb/src/class/cdc_acm.rs9
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
1use core::cell::Cell; 3use core::cell::Cell;
2use core::mem::{self, MaybeUninit}; 4use core::mem::{self, MaybeUninit};
3use core::sync::atomic::{AtomicBool, Ordering}; 5use core::sync::atomic::{AtomicBool, Ordering};
@@ -28,12 +30,14 @@ const REQ_SET_LINE_CODING: u8 = 0x20;
28const REQ_GET_LINE_CODING: u8 = 0x21; 30const REQ_GET_LINE_CODING: u8 = 0x21;
29const REQ_SET_CONTROL_LINE_STATE: u8 = 0x22; 31const REQ_SET_CONTROL_LINE_STATE: u8 = 0x22;
30 32
33/// Internal state for CDC-ACM
31pub struct State<'a> { 34pub struct State<'a> {
32 control: MaybeUninit<Control<'a>>, 35 control: MaybeUninit<Control<'a>>,
33 shared: ControlShared, 36 shared: ControlShared,
34} 37}
35 38
36impl<'a> State<'a> { 39impl<'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))]
286pub enum ParityType { 290pub 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