[−][src]Struct mpsse::builder::Builder
Builder for MPSSE commands.
Implementations
impl Builder
[src]
pub fn new() -> Self
[src]
Create a new command builder with.
pub fn write_data(self, data: Vec<u8>) -> WriteBuilder
[src]
Write bytes of data, one bit at a time, on a single pin.
This will generate a Data Shifting Command with the appropriate bits set to write to TDO with the appropriate parameters
data
- The data to write out.
use mpsse::{Builder, ClockEdge, BitDirection}; let commands = Builder::new() .write_data(vec![0xD, 0xEC, 0xAF]) .with_clock_direction(ClockEdge::Rising) .with_bit_direction(BitDirection::MsbFirst) .build(); assert_eq!(commands, vec![0x10, 0x02, 0x00, 0xD, 0xEC, 0xAF])
pub fn read_data(self, length: u16) -> ReadBuilder
[src]
Read bytes of data, one bit at a time, on a single pin.
This will generate a Data Shifting Command with the appropriate bits set to read from TDI with the appropriate parameters
length
- The number of bytes to read out.
use mpsse::{Builder, ClockEdge, BitDirection}; let commands = Builder::new() .read_data(328) .with_clock_direction(ClockEdge::Rising) .with_bit_direction(BitDirection::MsbFirst) .build(); assert_eq!(commands, vec![0x20, 0x47, 0x01])
pub fn set_pins<D, V>(
self,
range: PinRange,
direction: D,
value: V
) -> SetPinsBuilder where
D: Into<PinDirectionArray>,
V: Into<PinValueArray>,
[src]
self,
range: PinRange,
direction: D,
value: V
) -> SetPinsBuilder where
D: Into<PinDirectionArray>,
V: Into<PinValueArray>,
Set the pins of the interface directly to the given values, and configure their direction.
This will generate a Set Data Bits command of the appropriate type
range
- Set either the high or low byte to be setdirection
- The direction to set the pins, as either inputs or outputs.value
- The value to set the pins to, high or low (only applies to output pins)
use mpsse::{Builder, PinRange}; let commands = Builder::new() .set_pins(PinRange::Low, 0b00110100, 0b11001100) .build(); assert_eq!(commands, vec![0x80, 0xCC, 0x34])
pub fn read_pins(self, range: PinRange) -> ReadPinsBuilder
[src]
Read the value of input pins of the interface directly.
This will generate a Read Data Bits command of the appropriate type
range
- Read either the high or low byte to be set
use mpsse::{Builder, PinRange}; let commands = Builder::new() .read_pins(PinRange::High) .build(); assert_eq!(commands, vec![0x83])
pub fn set_frequency<F>(self, frequency: F) -> SetFrequencyBuilder where
F: Into<f64>,
[src]
F: Into<f64>,
Set the clock frequency of the interface.
This will calculate the closest clock divisor to acheive the given frequency and generate a Set Clock Divisor command
frequency
- The target frequency to set the clock to in hz. Note: this is a target frequency that may not be met due to MPSSE internals. If you need more definite control over the clock speed, use.set_divisor()
instead.
use mpsse::Builder; let commands = Builder::new() .set_frequency(1_000_000.0) .build(); assert_eq!(commands, vec![0x86, 0x05, 0x00])
pub fn set_divisor(self, _divisor: u16) -> !
[src]
pub fn wait_for_io(self, value: PinValue) -> WaitForIoBuilder
[src]
Wait for IO on pin 1.
This will send a Set Clock Frequency command
value
- Whether to wait for a High or Low state on the pin.
use mpsse::{Builder, PinValue}; let commands = Builder::new() .wait_for_io(PinValue::High) .build(); assert_eq!(commands, vec![0x88])
pub fn build(self) -> Vec<u8>
[src]
Build the current command list into a sequence of bytes.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
[src]
impl Send for Builder
[src]
impl Sync for Builder
[src]
impl Unpin for Builder
[src]
impl UnwindSafe for Builder
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,