pub struct Blaster<'a, B: UsbBus, E, TDI: OutputPin<Error = E>, TCK: OutputPin<Error = E>, TMS: OutputPin<Error = E>, TDO: InputPin<Error = E>> { /* private fields */ }Expand description
Blaster device class
Implementations§
Source§impl<'a, B: UsbBus, E, TDI: OutputPin<Error = E>, TCK: OutputPin<Error = E>, TMS: OutputPin<Error = E>, TDO: InputPin<Error = E>> Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B: UsbBus, E, TDI: OutputPin<Error = E>, TCK: OutputPin<Error = E>, TMS: OutputPin<Error = E>, TDO: InputPin<Error = E>> Blaster<'a, B, E, TDI, TCK, TMS, TDO>
Sourcepub fn new(
alloc: &'a UsbBusAllocator<B>,
tdi: TDI,
tck: TCK,
tms: TMS,
tdo: TDO,
) -> Blaster<'a, B, E, TDI, TCK, TMS, TDO>
pub fn new( alloc: &'a UsbBusAllocator<B>, tdi: TDI, tck: TCK, tms: TMS, tdo: TDO, ) -> Blaster<'a, B, E, TDI, TCK, TMS, TDO>
Allocate a Blaster on the USB bus. Takes control of the four JTAG pins. The JTAG pins can be any pins you want, just make sure you assign them correctly.
Sourcepub fn read(&mut self) -> Result<usize>
pub fn read(&mut self) -> Result<usize>
Read data from the host output endpoint into the Blaster’s internal read buffer.
Sourcepub fn write(&mut self, heartbeat: bool) -> Result<usize>
pub fn write(&mut self, heartbeat: bool) -> Result<usize>
Write data to the host input endpoint from the Blaster’s internal write buffer. The heartbeat parameter must be true at least once every 10 milliseconds, so that the blaster can output the modem status. See libftdi ftdi.c for more on this. Otherwise, a BSOD could occur on Windows A safe default for the heartbeat seems to be true all the time. This will output the modem status whenever the host reads the device.
Trait Implementations§
Source§impl<B, E, TDI: OutputPin<Error = E>, TCK: OutputPin<Error = E>, TMS: OutputPin<Error = E>, TDO: InputPin<Error = E>> UsbClass<B> for Blaster<'_, B, E, TDI, TCK, TMS, TDO>
impl<B, E, TDI: OutputPin<Error = E>, TCK: OutputPin<Error = E>, TMS: OutputPin<Error = E>, TDO: InputPin<Error = E>> UsbClass<B> for Blaster<'_, B, E, TDI, TCK, TMS, TDO>
Source§fn get_configuration_descriptors(
&self,
writer: &mut DescriptorWriter<'_>,
) -> Result<()>
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 moreSource§fn control_in(&mut self, xfer: ControlIn<'_, '_, '_, B>)
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>)
fn control_out(&mut self, xfer: ControlOut<'_, '_, '_, B>)
Called when a control request is received with direction HostToDevice. Read more
Source§fn get_bos_descriptors(
&self,
writer: &mut BosWriter<'_, '_>,
) -> Result<(), UsbError>
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>
fn get_string(&self, index: StringIndex, lang_id: u16) -> Option<&str>
Gets a class-specific string descriptor. Read more
Source§fn endpoint_setup(&mut self, addr: EndpointAddress)
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 moreSource§fn endpoint_out(&mut self, addr: EndpointAddress)
fn endpoint_out(&mut self, addr: EndpointAddress)
Called when endpoint with address
addr has received data (OUT packet). Read moreSource§fn endpoint_in_complete(&mut self, addr: EndpointAddress)
fn endpoint_in_complete(&mut self, addr: EndpointAddress)
Called when endpoint with address
addr has completed transmitting data (IN packet). Read moreAuto Trait Implementations§
impl<'a, B, E, TDI, TCK, TMS, TDO> Freeze for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B, E, TDI, TCK, TMS, TDO> RefUnwindSafe for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B, E, TDI, TCK, TMS, TDO> Send for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B, E, TDI, TCK, TMS, TDO> Sync for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B, E, TDI, TCK, TMS, TDO> Unpin for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B, E, TDI, TCK, TMS, TDO> UnsafeUnpin for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
impl<'a, B, E, TDI, TCK, TMS, TDO> UnwindSafe for Blaster<'a, B, E, TDI, TCK, TMS, TDO>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more