pub struct InterfaceAltBuilder<'a, 'd, D: Driver<'d>> { /* private fields */ }Expand description
Interface alternate setting builder.
Implementations§
Source§impl<'a, 'd, D: Driver<'d>> InterfaceAltBuilder<'a, 'd, D>
impl<'a, 'd, D: Driver<'d>> InterfaceAltBuilder<'a, 'd, D>
Sourcepub const fn interface_number(&self) -> InterfaceNumber
pub const fn interface_number(&self) -> InterfaceNumber
Get the interface number.
Sourcepub const fn alt_setting_number(&self) -> u8
pub const fn alt_setting_number(&self) -> u8
Get the alternate setting number.
Sourcepub fn descriptor(&mut self, descriptor_type: u8, descriptor: &[u8])
pub fn descriptor(&mut self, descriptor_type: u8, descriptor: &[u8])
Add a custom descriptor to this alternate setting.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn descriptors_then_patch<R>(
&mut self,
add: impl FnOnce(&mut Self) -> R,
patch: impl FnOnce(&mut [u8]),
) -> R
pub fn descriptors_then_patch<R>( &mut self, add: impl FnOnce(&mut Self) -> R, patch: impl FnOnce(&mut [u8]), ) -> R
Add one of more custom descriptors to this alternate setting, and then patch the written bytes.
Sourcepub fn bos_capability(&mut self, capability_type: u8, capability: &[u8])
pub fn bos_capability(&mut self, capability_type: u8, capability: &[u8])
Add a custom Binary Object Store (BOS) descriptor to this alternate setting.
Sourcepub fn endpoint_descriptor(
&mut self,
endpoint: &EndpointInfo,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
)
pub fn endpoint_descriptor( &mut self, endpoint: &EndpointInfo, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], )
Write a custom endpoint descriptor for a certain endpoint.
This can be necessary, if the endpoint descriptors can only be written after the endpoint was created. As an example, an endpoint descriptor may contain the address of an endpoint that was allocated earlier.
Sourcepub fn endpoint_descriptor_with_interval(
&mut self,
endpoint: &EndpointInfo,
interval: EndpointInterval,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
)
pub fn endpoint_descriptor_with_interval( &mut self, endpoint: &EndpointInfo, interval: EndpointInterval, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], )
Write a custom endpoint descriptor for a certain endpoint with a specific EndpointInterval.
Sourcepub fn endpoint_descriptor_raw(
&mut self,
endpoint: &EndpointInfo,
b_interval: u8,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
)
pub fn endpoint_descriptor_raw( &mut self, endpoint: &EndpointInfo, b_interval: u8, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], )
Write a custom endpoint descriptor with a raw bInterval byte.
The bInterval byte is written directly to the descriptor and will NOT be modified
by full-speed or high-speed rewriting passes.
Sourcepub fn alloc_endpoint_in(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
options: EndpointOptions,
) -> D::EndpointIn
pub fn alloc_endpoint_in( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, options: EndpointOptions, ) -> D::EndpointIn
Allocate an IN endpoint, without writing its descriptor.
Used for granular control over the order of endpoint and descriptor creation.
Sourcepub fn endpoint_in_interval(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointIn
pub fn endpoint_in_interval( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointIn
Allocate an IN endpoint and write its descriptor with a specific EndpointInterval.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_in(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointIn
pub fn endpoint_in( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointIn
Allocate an IN endpoint and write its descriptor.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn alloc_endpoint_out(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
options: EndpointOptions,
) -> D::EndpointOut
pub fn alloc_endpoint_out( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, options: EndpointOptions, ) -> D::EndpointOut
Allocate an OUT endpoint, without writing its descriptor.
Used for granular control over the order of endpoint and descriptor creation.
Sourcepub fn endpoint_out_interval(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointOut
pub fn endpoint_out_interval( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointOut
Allocate an OUT endpoint and write its descriptor with a specific EndpointInterval.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_out(
&mut self,
ep_type: EndpointType,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointOut
pub fn endpoint_out( &mut self, ep_type: EndpointType, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointOut
Allocate an OUT endpoint and write its descriptor.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_bulk_in(
&mut self,
ep_addr: Option<EndpointAddress>,
options: EndpointOptions,
) -> D::EndpointIn
pub fn endpoint_bulk_in( &mut self, ep_addr: Option<EndpointAddress>, options: EndpointOptions, ) -> D::EndpointIn
Allocate a BULK IN endpoint and write its descriptor.
Its max packet size is EndpointOptions::max_packet_size.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_bulk_out(
&mut self,
ep_addr: Option<EndpointAddress>,
options: EndpointOptions,
) -> D::EndpointOut
pub fn endpoint_bulk_out( &mut self, ep_addr: Option<EndpointAddress>, options: EndpointOptions, ) -> D::EndpointOut
Allocate a BULK OUT endpoint and write its descriptor.
Its max packet size is EndpointOptions::max_packet_size.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_interrupt_in_interval(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
) -> D::EndpointIn
pub fn endpoint_interrupt_in_interval( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, ) -> D::EndpointIn
Allocate an INTERRUPT IN endpoint and write its descriptor with a specific EndpointInterval.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_interrupt_in(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
) -> D::EndpointIn
pub fn endpoint_interrupt_in( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, ) -> D::EndpointIn
Allocate an INTERRUPT IN endpoint and write its descriptor.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_interrupt_out_interval(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
) -> D::EndpointOut
pub fn endpoint_interrupt_out_interval( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, ) -> D::EndpointOut
Allocate an INTERRUPT OUT endpoint and write its descriptor with a specific EndpointInterval.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_interrupt_out(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
) -> D::EndpointOut
pub fn endpoint_interrupt_out( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, ) -> D::EndpointOut
Allocate an INTERRUPT OUT endpoint and write its descriptor.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_isochronous_in_interval(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointIn
pub fn endpoint_isochronous_in_interval( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointIn
Allocate an ISOCHRONOUS IN endpoint and write its descriptor with a specific EndpointInterval.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_isochronous_in(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointIn
pub fn endpoint_isochronous_in( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointIn
Allocate an ISOCHRONOUS IN endpoint and write its descriptor.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_isochronous_out_interval(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval: EndpointInterval,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointOut
pub fn endpoint_isochronous_out_interval( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval: EndpointInterval, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointOut
Allocate an ISOCHRONOUS OUT endpoint and write its descriptor with a specific EndpointInterval.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.
Sourcepub fn endpoint_isochronous_out(
&mut self,
ep_addr: Option<EndpointAddress>,
max_packet_size: u16,
interval_ms: u8,
synchronization_type: SynchronizationType,
usage_type: UsageType,
extra_fields: &[u8],
options: EndpointOptions,
) -> D::EndpointOut
pub fn endpoint_isochronous_out( &mut self, ep_addr: Option<EndpointAddress>, max_packet_size: u16, interval_ms: u8, synchronization_type: SynchronizationType, usage_type: UsageType, extra_fields: &[u8], options: EndpointOptions, ) -> D::EndpointOut
Allocate an ISOCHRONOUS OUT endpoint and write its descriptor.
Descriptors are written in the order builder functions are called. Note that some classes care about the order.