@@ -20,31 +20,28 @@ enum ControlState {
2020 Error ,
2121}
2222
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-
3023/// Buffers and parses USB control transfers.
3124pub struct ControlPipe < ' a , B : UsbBus > {
3225 ep_out : EndpointOut < ' a , B > ,
3326 ep_in : EndpointIn < ' a , B > ,
3427 state : ControlState ,
35- buf : [ u8 ; CONTROL_BUF_LEN ] ,
28+ buf : & ' a mut [ u8 ] ,
3629 static_in_buf : Option < & ' static [ u8 ] > ,
3730 i : usize ,
3831 len : usize ,
3932}
4033
4134impl < 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 > {
4340 ControlPipe {
4441 ep_out,
4542 ep_in,
4643 state : ControlState :: Idle ,
47- buf : [ 0 ; CONTROL_BUF_LEN ] ,
44+ buf,
4845 static_in_buf : None ,
4946 i : 0 ,
5047 len : 0 ,
0 commit comments