embassy_stm32_plus/builder/usb/acm_state.rs
1use embassy_usb::class::cdc_acm::State;
2
3/// acm state
4pub struct AcmState<'a> {
5 pub state: State<'a>,
6 /// full-speed devices, `max_packet_size` has to be one of 8, 16, 32 or 64.
7 pub max_packet_size: u16,
8}
9
10/// custom method
11impl<'a> AcmState<'a> {
12 /// full-speed devices, `max_packet_size` has to be one of 8, 16, 32 or 64.
13 pub fn new(state: State<'a>, max_packet_size: u16) -> Self {
14 Self { state, max_packet_size }
15 }
16}
17
18/// support default
19impl<'a> Default for AcmState<'a> {
20 fn default() -> Self {
21 Self {
22 state: State::new(),
23 max_packet_size: 64,
24 }
25 }
26}