@@ -20,31 +20,28 @@ enum ControlState {
20
20
Error ,
21
21
}
22
22
23
- // Maximum length of control transfer data stage in bytes. 128 bytes by default. You can define the
24
- // feature "control-buffer-256" to make it 256 bytes if you have larger control transfers.
25
- #[ cfg( not( feature = "control-buffer-256" ) ) ]
26
- const CONTROL_BUF_LEN : usize = 128 ;
27
- #[ cfg( feature = "control-buffer-256" ) ]
28
- const CONTROL_BUF_LEN : usize = 256 ;
29
-
30
23
/// Buffers and parses USB control transfers.
31
24
pub struct ControlPipe < ' a , B : UsbBus > {
32
25
ep_out : EndpointOut < ' a , B > ,
33
26
ep_in : EndpointIn < ' a , B > ,
34
27
state : ControlState ,
35
- buf : [ u8 ; CONTROL_BUF_LEN ] ,
28
+ buf : & ' a mut [ u8 ] ,
36
29
static_in_buf : Option < & ' static [ u8 ] > ,
37
30
i : usize ,
38
31
len : usize ,
39
32
}
40
33
41
34
impl < B : UsbBus > ControlPipe < ' _ , B > {
42
- pub fn new < ' a > ( ep_out : EndpointOut < ' a , B > , ep_in : EndpointIn < ' a , B > ) -> ControlPipe < ' a , B > {
35
+ pub fn new < ' a > (
36
+ buf : & ' a mut [ u8 ] ,
37
+ ep_out : EndpointOut < ' a , B > ,
38
+ ep_in : EndpointIn < ' a , B > ,
39
+ ) -> ControlPipe < ' a , B > {
43
40
ControlPipe {
44
41
ep_out,
45
42
ep_in,
46
43
state : ControlState :: Idle ,
47
- buf : [ 0 ; CONTROL_BUF_LEN ] ,
44
+ buf,
48
45
static_in_buf : None ,
49
46
i : 0 ,
50
47
len : 0 ,
0 commit comments