Struct usbd_dfu::DFUClass[][src]

pub struct DFUClass<B: UsbBus, M: DFUMemIO> { /* fields omitted */ }
Expand description

DFU protocol USB class implementation for usb-device library.

Implementations

impl<B: UsbBus, M: DFUMemIO> DFUClass<B, M>[src]

pub fn new<'a>(alloc: &'a UsbBusAllocator<B>, mem: M) -> Self[src]

Creates a new DFUClass with the provided UsbBus and DFUMemIO

pub fn set_unexpected_reset_state(&mut self)[src]

This function may be called just after DFUClass::new() to set DFU error state to “Device detected unexpected power on reset” instead of the usual dfuIdle.

pub fn set_firmware_corrupted_state(&mut self)[src]

This function may be called just after DFUClass::new() to set DFU error state to “Device’s firmware is corrupt. It cannot return to run-time (non-DFU) operations” instead of the usual dfuIdle.

pub fn get_address_pointer(&self) -> u32[src]

Return current Address Pointer value.

Trait Implementations

impl<B: UsbBus, M: DFUMemIO> UsbClass<B> for DFUClass<B, M>[src]

fn get_configuration_descriptors(
    &self,
    writer: &mut DescriptorWriter<'_>
) -> Result<()>
[src]

Called when a GET_DESCRIPTOR request is received for a configuration descriptor. When called, the implementation should write its interface, endpoint and any extra class descriptors into writer. The configuration descriptor itself will be written by UsbDevice and shouldn’t be written by classes. Read more

fn get_string(&self, index: StringIndex, lang_id: u16) -> Option<&str>[src]

Gets a class-specific string descriptor. Read more

fn control_in(&mut self, xfer: ControlIn<'_, '_, '_, B>)[src]

Called when a control request is received with direction DeviceToHost. Read more

fn control_out(&mut self, xfer: ControlOut<'_, '_, '_, B>)[src]

Called when a control request is received with direction HostToDevice. Read more

fn reset(&mut self)[src]

Called after a USB reset after the bus reset sequence is complete.

fn poll(&mut self)[src]

Called whenever the UsbDevice is polled.

fn get_bos_descriptors(
    &self,
    writer: &mut BosWriter<'_, '_>
) -> Result<(), UsbError>
[src]

Called when a GET_DESCRIPTOR request is received for a BOS descriptor. When called, the implementation should write its blobs such as capability descriptors into writer. The BOS descriptor itself will be written by UsbDevice and shouldn’t be written by classes. Read more

fn endpoint_setup(&mut self, addr: EndpointAddress)[src]

Called when endpoint with address addr has received a SETUP packet. Implementing this shouldn’t be necessary in most cases, but is provided for completeness’ sake. Read more

fn endpoint_out(&mut self, addr: EndpointAddress)[src]

Called when endpoint with address addr has received data (OUT packet). Read more

fn endpoint_in_complete(&mut self, addr: EndpointAddress)[src]

Called when endpoint with address addr has completed transmitting data (IN packet). Read more

Auto Trait Implementations

impl<B, M> Send for DFUClass<B, M> where
    B: Send,
    M: Send

impl<B, M> Sync for DFUClass<B, M> where
    M: Sync

impl<B, M> Unpin for DFUClass<B, M> where
    B: Unpin,
    M: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.