usb: merge alloc_control_pipe
and into_bus
into start
.
This prevents calling `alloc_control_pipe` twice at compile time, which was always an error.
This commit is contained in:
@ -14,7 +14,7 @@ pub trait Driver<'a> {
|
||||
|
||||
/// Allocates an endpoint and specified endpoint parameters. This method is called by the device
|
||||
/// and class implementations to allocate endpoints, and can only be called before
|
||||
/// [`enable`](UsbBus::enable) is called.
|
||||
/// [`start`](UsbBus::start) is called.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
@ -37,14 +37,15 @@ pub trait Driver<'a> {
|
||||
interval: u8,
|
||||
) -> Result<Self::EndpointIn, EndpointAllocError>;
|
||||
|
||||
fn alloc_control_pipe(
|
||||
&mut self,
|
||||
max_packet_size: u16,
|
||||
) -> Result<Self::ControlPipe, EndpointAllocError>;
|
||||
|
||||
/// Enables and initializes the USB peripheral. Soon after enabling the device will be reset, so
|
||||
/// there is no need to perform a USB reset in this method.
|
||||
fn into_bus(self) -> Self::Bus;
|
||||
/// Start operation of the USB device.
|
||||
///
|
||||
/// This returns the `Bus` and `ControlPipe` instances that are used to operate
|
||||
/// the USB device. Additionally, this makes all the previously allocated endpoints
|
||||
/// start operating.
|
||||
///
|
||||
/// This consumes the `Driver` instance, so it's no longer possible to allocate more
|
||||
/// endpoints.
|
||||
fn start(self, control_max_packet_size: u16) -> (Self::Bus, Self::ControlPipe);
|
||||
|
||||
/// Indicates that `set_device_address` must be called before accepting the corresponding
|
||||
/// control transfer, not after.
|
||||
|
Reference in New Issue
Block a user