fn write_register<T: IntoBuf<u8>>(
        &mut self,
        register: Register,
        buf: T,
    ) -> Result<(), TransferError<SPIErr, PinErr>> {
        let buf = buf.into_buf();
        // Use tx buffer to copy the values into
        // First byte will be the opcode
        self.tx_buf[0] = Instruction::WR.opcode() | register.addr();
        // Copy over the values
        self.tx_buf[1..=buf.len()].copy_from_slice(buf);
        // Write to spi
        self.set_ncs_low()?;
        self.spi_write_tx_buf(buf.len())?;
        self.set_ncs_high()?;

        Ok(())
    }
/// Writes values to a given register.
///
/// This can be anything that can be turned into a buffer of u8's.
/// `IntoBuf` is currently implemented for T and for &[T].
/// This means that this function can be polymorphically called for single value writes as well
/// as for arrays.
Writes values to a given register.
This can be anything that can be turned into a buffer of u8's.
`IntoBuf` is currently implemented for T and for &[T].
This means that this function can be polymorphically called for single value writes as well
as for arrays.
Writes values to a given register . This can be anything that can be turned into a buffer of u8 ' s . ` IntoBuf ` is currently implemented for T and for & [ T ] . This means that this function can be polymorphically called for single value writes as well as for arrays .
fn write_register<T: IntoBuf<u8>>(
        &mut self,
        register: Register,
        buf: T,
    ) -> Result<(), TransferError<SPIErr, PinErr>> {
        let buf = buf.into_buf();
        // Use tx buffer to copy the values into
        // First byte will be the opcode
        self.tx_buf[0] = Instruction::WR.opcode() | register.addr();
        // Copy over the values
        self.tx_buf[1..=buf.len()].copy_from_slice(buf);
        // Write to spi
        self.set_ncs_low()?;
        self.spi_write_tx_buf(buf.len())?;
        self.set_ncs_high()?;
        Ok(())
    }
fn write_register < T : IntoBuf < u8 > > ( & mut self , register : Register , buf : T , ) -> Result < ( ) , TransferError < SPIErr , PinErr > > { let buf = buf . into_buf ( ) ; // Use tx buffer to copy the values into // First byte will be the opcode self . tx_buf [ 0 ] = Instruction :: WR . opcode ( ) | register . addr ( ) ; // Copy over the values self . tx_buf [ 1 ..= buf . len ( ) ] . copy_from_slice ( buf ) ; // Write to spi self . set_ncs_low ( ) ? ; self . spi_write_tx_buf ( buf . len ( ) ) ? ; self . set_ncs_high ( ) ? ; Ok ( ( ) ) }
Writes values to a given register.
Writes values to a given register .
&mut self
register
Register
buf
T
&mut self
register
Register
buf
T