diff options
Diffstat (limited to 'embassy-usb/src/class')
| -rw-r--r-- | embassy-usb/src/class/cdc_acm.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/embassy-usb/src/class/cdc_acm.rs b/embassy-usb/src/class/cdc_acm.rs index c5b1a56fe..ea9d9fb7b 100644 --- a/embassy-usb/src/class/cdc_acm.rs +++ b/embassy-usb/src/class/cdc_acm.rs | |||
| @@ -47,10 +47,10 @@ impl<'a> Default for State<'a> { | |||
| 47 | 47 | ||
| 48 | impl<'a> State<'a> { | 48 | impl<'a> State<'a> { |
| 49 | /// Create a new `State`. | 49 | /// Create a new `State`. |
| 50 | pub fn new() -> Self { | 50 | pub const fn new() -> Self { |
| 51 | Self { | 51 | Self { |
| 52 | control: MaybeUninit::uninit(), | 52 | control: MaybeUninit::uninit(), |
| 53 | shared: ControlShared::default(), | 53 | shared: ControlShared::new(), |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| @@ -92,6 +92,12 @@ struct ControlShared { | |||
| 92 | 92 | ||
| 93 | impl Default for ControlShared { | 93 | impl Default for ControlShared { |
| 94 | fn default() -> Self { | 94 | fn default() -> Self { |
| 95 | Self::new() | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | impl ControlShared { | ||
| 100 | const fn new() -> Self { | ||
| 95 | ControlShared { | 101 | ControlShared { |
| 96 | dtr: AtomicBool::new(false), | 102 | dtr: AtomicBool::new(false), |
| 97 | rts: AtomicBool::new(false), | 103 | rts: AtomicBool::new(false), |
| @@ -105,9 +111,7 @@ impl Default for ControlShared { | |||
| 105 | changed: AtomicBool::new(false), | 111 | changed: AtomicBool::new(false), |
| 106 | } | 112 | } |
| 107 | } | 113 | } |
| 108 | } | ||
| 109 | 114 | ||
| 110 | impl ControlShared { | ||
| 111 | fn changed(&self) -> impl Future<Output = ()> + '_ { | 115 | fn changed(&self) -> impl Future<Output = ()> + '_ { |
| 112 | poll_fn(|cx| { | 116 | poll_fn(|cx| { |
| 113 | if self.changed.load(Ordering::Relaxed) { | 117 | if self.changed.load(Ordering::Relaxed) { |
