/// Sends commands to the underlying hardware and provides responses
Sends commands to the underlying hardware and provides responses
Sends commands to the underlying hardware and provides responses
pub fn send_command(&mut self, command: &[u8], result: &mut [u8]) -> Result<(), E> {
        // Pack in bytes for the command we'll be sending
        result[..command.len()].copy_from_slice(command);
        result[0] = self.multitap_port.clone() as u8;
        // Because not all hardware supports LSB mode for SPI, we flip
        // the bits ourselves
        Self::flip(result);
        if let Some(ref mut x) = self.select {
            x.set_low();
        }
        self.dev.transfer(result)?;
        if let Some(ref mut x) = self.select {
            x.set_high();
        }
        Self::flip(result);
        Ok(())
    }
pub fn send_command ( & mut self , command : & [ u8 ] , result : & mut [ u8 ] ) -> Result < ( ) , E > { // Pack in bytes for the command we'll be sending result [ .. command . len ( ) ] . copy_from_slice ( command ) ; result [ 0 ] = self . multitap_port . clone ( ) as u8 ; // Because not all hardware supports LSB mode for SPI, we flip // the bits ourselves Self :: flip ( result ) ; if let Some ( ref mut x ) = self . select { x . set_low ( ) ; } self . dev . transfer ( result ) ? ; if let Some ( ref mut x ) = self . select { x . set_high ( ) ; } Self :: flip ( result ) ; Ok ( ( ) ) }
Sends commands to the underlying hardware and provides responses
Sends commands to the underlying hardware and provides responses
&mut self
command
&[u8]
result
&mut [u8]