pub struct DfuRuntimeClass<T: DfuRuntimeOps> { /* private fields */ }
Expand description

Implementation of DFU runtime class.

This class provides thin framework for implementing DFU runtime functionality. When DFU_DETACH request is received, it will be accepted and DfuRuntimeOps::detach will be called (unless DfuRuntimeOps::allow returned false which rejects the request).

Implementations§

source§

impl<T: DfuRuntimeOps> DfuRuntimeClass<T>

source

pub fn new<B: UsbBus>(alloc: &UsbBusAllocator<B>, ops: T) -> Self

Crate new DFU run-time class with the given device-specific implementations.

source

pub fn tick(&mut self, elapsed_time_ms: u16)

Advance time

Should be called regularly, passing the time in milliseconds that has elapsed since the previous call to this function.

source

pub fn ops(&self) -> &T

Get reference to DfuRuntimeOps

source

pub fn ops_mut(&mut self) -> &mut T

Get mutable reference to DfuRuntimeOps

source

pub fn interface(&self) -> InterfaceNumber

Get class interface number

Trait Implementations§

source§

impl<T: DfuRuntimeOps, B: UsbBus> UsbClass<B> for DfuRuntimeClass<T>

source§

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

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
source§

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

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

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

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

fn reset(&mut self)

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

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

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.
source§

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

Gets a class-specific string descriptor. Read more
source§

fn poll(&mut self)

Called whenever the UsbDevice is polled.
source§

fn endpoint_setup(&mut self, addr: EndpointAddress)

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
source§

fn endpoint_out(&mut self, addr: EndpointAddress)

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

fn endpoint_in_complete(&mut self, addr: EndpointAddress)

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

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for DfuRuntimeClass<T>where T: RefUnwindSafe,

§

impl<T> Send for DfuRuntimeClass<T>where T: Send,

§

impl<T> Sync for DfuRuntimeClass<T>where T: Sync,

§

impl<T> Unpin for DfuRuntimeClass<T>where T: Unpin,

§

impl<T> UnwindSafe for DfuRuntimeClass<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.