pub struct Device<'a, C: HostController> { /* private fields */ }Expand description
An enumerated device.
Implementations§
Source§impl<'a, C: HostController> Device<'a, C>
impl<'a, C: HostController> Device<'a, C>
Sourcepub fn address(&self) -> DeviceAddress
pub fn address(&self) -> DeviceAddress
The address the device answers to.
Sourcepub fn descriptor(&self) -> &DeviceDescriptor
pub fn descriptor(&self) -> &DeviceDescriptor
The device descriptor read while enumerating.
Sourcepub fn configuration(&self) -> Configuration<'_>
pub fn configuration(&self) -> Configuration<'_>
The configuration descriptor together with its interface and endpoint descriptors.
Sourcepub fn control(&self, request: &Request, buffer: &mut [u8]) -> HostResult<usize>
pub fn control(&self, request: &Request, buffer: &mut [u8]) -> HostResult<usize>
Run one control transfer.
buffer must hold request.length bytes. The returned count is the
number of bytes the device actually sent, which may be less than
requested.
Sourcepub fn set_configuration(&self, value: u8) -> HostResult<()>
pub fn set_configuration(&self, value: u8) -> HostResult<()>
Select a configuration.
The endpoints of the device are only usable after this request succeeded.
Sourcepub fn read_string(&self, index: u8, out: &mut [u8]) -> HostResult<usize>
pub fn read_string(&self, index: u8, out: &mut [u8]) -> HostResult<usize>
Read a string descriptor and convert it to UTF-8.
Returns the number of bytes written to out. Strings longer than
thirty-two characters and output that does not fit are truncated at a
character boundary.
Sourcepub fn open(&self, endpoint: &EndpointDescriptor) -> HostResult<Pipe<'a, C>>
pub fn open(&self, endpoint: &EndpointDescriptor) -> HostResult<Pipe<'a, C>>
Open the endpoint described by endpoint.
Sourcepub fn clear_halt(&self, pipe: &Pipe<'a, C>) -> HostResult<()>
pub fn clear_halt(&self, pipe: &Pipe<'a, C>) -> HostResult<()>
Clear the halt condition of pipe and restart its data toggle.
Called after a transfer failed with HostError::Stall.