pub struct ControlChannel<T: UsbTransfer> { /* private fields */ }Expand description
GenCP control channel over a USB3 Vision bulk endpoint pair.
Sends GenCP commands (ReadReg, WriteReg, ReadMem, WriteMem) wrapped in the U3V prefix and receives acknowledgements from the device.
Implementations§
Source§impl<T: UsbTransfer> ControlChannel<T>
impl<T: UsbTransfer> ControlChannel<T>
Sourcepub fn new(
transport: Arc<T>,
ep_in: u8,
ep_out: u8,
max_cmd_transfer: u32,
max_ack_transfer: u32,
) -> Self
pub fn new( transport: Arc<T>, ep_in: u8, ep_out: u8, max_cmd_transfer: u32, max_ack_transfer: u32, ) -> Self
Create a new control channel.
max_cmd_transfer and max_ack_transfer come from the device’s
SBRM (or USB descriptor) and cap the largest single bulk transfer.
Sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Override the default control transaction timeout.
Sourcepub fn transport(&self) -> &Arc<T>
pub fn transport(&self) -> &Arc<T>
Access the underlying transport (e.g. to share with a stream).
Sourcepub fn read_register(&mut self, addr: u64) -> Result<u32, U3vError>
pub fn read_register(&mut self, addr: u64) -> Result<u32, U3vError>
Read a single 32-bit register at addr.
Sourcepub fn write_register(&mut self, addr: u64, value: u32) -> Result<(), U3vError>
pub fn write_register(&mut self, addr: u64, value: u32) -> Result<(), U3vError>
Write a single 32-bit register at addr.
Auto Trait Implementations§
impl<T> Freeze for ControlChannel<T>
impl<T> RefUnwindSafe for ControlChannel<T>where
T: RefUnwindSafe,
impl<T> Send for ControlChannel<T>
impl<T> Sync for ControlChannel<T>
impl<T> Unpin for ControlChannel<T>
impl<T> UnsafeUnpin for ControlChannel<T>
impl<T> UnwindSafe for ControlChannel<T>where
T: RefUnwindSafe,
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