pub fn recv(&mut self) -> Result<(), Error> {
        let _ = self.spi.as_ref().read_flags_errors()?;
        let buf = self.buf.as_mut();
        if self.rcvd < self.sent {
            let buf = unsafe { buf.get_unchecked_mut(self.rcvd..) };
            let mut data = buf.into_iter();
            let word = unsafe { self.spi.as_mut().read_data() as u32 };
            let bytes = word.to_le_bytes();
            let mut iter = bytes.iter();
            for _ in 0..self.spi.step() {
                match (data.next(), iter.next()) {
                    (Some(d), Some(b)) => *d = *b,
                    _ => break,
                }
            }
            self.rcvd += self.spi.step();
        }
        if self.rcvd >= buf.len() {
            self.spi.as_mut().disable_interrupts(Flags::RXC);
            self.ss.deassert();
            if let Some(waker) = self.waker.take() {
                waker();
            }
        }
        Ok(())
    }
/// Received the next set of bytes and write them to the buffer
///
/// This method should be called from the `RXC` interrupt handler. Once all
/// bytes of the transaction have been received, this function will
/// automatically disable the `RXC` interrupt, deassert the SS pin (if
/// present), and call the waker (if present).
Received the next set of bytes and write them to the buffer
This method should be called from the `RXC` interrupt handler. Once all
bytes of the transaction have been received, this function will
automatically disable the `RXC` interrupt, deassert the SS pin (if
present), and call the waker (if present).
Received the next set of bytes and write them to the buffer This method should be called from the ` RXC ` interrupt handler . Once all bytes of the transaction have been received this function will automatically disable the ` RXC ` interrupt deassert the SS pin ( if present ) and call the waker ( if present ) .
pub fn recv(&mut self) -> Result<(), Error> {
        let _ = self.spi.as_ref().read_flags_errors()?;
        let buf = self.buf.as_mut();
        if self.rcvd < self.sent {
            let buf = unsafe { buf.get_unchecked_mut(self.rcvd..) };
            let mut data = buf.into_iter();
            let word = unsafe { self.spi.as_mut().read_data() as u32 };
            let bytes = word.to_le_bytes();
            let mut iter = bytes.iter();
            for _ in 0..self.spi.step() {
                match (data.next(), iter.next()) {
                    (Some(d), Some(b)) => *d = *b,
                    _ => break,
                }
            }
            self.rcvd += self.spi.step();
        }
        if self.rcvd >= buf.len() {
            self.spi.as_mut().disable_interrupts(Flags::RXC);
            self.ss.deassert();
            if let Some(waker) = self.waker.take() {
                waker();
            }
        }
        Ok(())
    }
pub fn recv ( & mut self ) -> Result < ( ) , Error > { let _ = self . spi . as_ref ( ) . read_flags_errors ( ) ? ; let buf = self . buf . as_mut ( ) ; if self . rcvd < self . sent { let buf = unsafe { buf . get_unchecked_mut ( self . rcvd .. ) } ; let mut data = buf . into_iter ( ) ; let word = unsafe { self . spi . as_mut ( ) . read_data ( ) as u32 } ; let bytes = word . to_le_bytes ( ) ; let mut iter = bytes . iter ( ) ; for _ in 0 .. self . spi . step ( ) { match ( data . next ( ) , iter . next ( ) ) { ( Some ( d ) , Some ( b ) ) => * d = * b , _ => break , } } self . rcvd += self . spi . step ( ) ; } if self . rcvd >= buf . len ( ) { self . spi . as_mut ( ) . disable_interrupts ( Flags :: RXC ) ; self . ss . deassert ( ) ; if let Some ( waker ) = self . waker . take ( ) { waker ( ) ; } } Ok ( ( ) ) }
Received the next set of bytes and write them to the buffer
This method should be called from the `RXC` interrupt handler.
Received the next set of bytes and write them to the buffer This method should be called from the ` RXC ` interrupt handler .
&mut self
&mut self