pub fn send(&mut self) -> Result<(), Error> {
        let _ = self.spi.as_ref().read_flags_errors()?;
        let buf = self.buf.as_ref();
        if let Some(buf) = buf.get(self.sent..) {
            let mut data = buf.into_iter();
            let mut bytes = [0; 4];
            let mut iter = bytes.iter_mut();
            for _ in 0..self.spi.step() {
                match (iter.next(), data.next()) {
                    (Some(b), Some(d)) => *b = *d,
                    _ => break,
                }
            }
            let word = u32::from_le_bytes(bytes);
            unsafe { self.spi.as_mut().write_data(word as Data) };
            self.sent += self.spi.step();
        }
        if self.sent >= buf.len() {
            self.spi.as_mut().disable_interrupts(Flags::DRE);
        }
        Ok(())
    }
/// Send the next set of bytes from the buffer
///
/// This method should be called from the `DRE` interrupt handler. Once all
/// bytes of the transaction have been sent, this function will
/// automatically disable the `DRE` interrupt.
Send the next set of bytes from the buffer
This method should be called from the `DRE` interrupt handler. Once all
bytes of the transaction have been sent, this function will
automatically disable the `DRE` interrupt.
Send the next set of bytes from the buffer This method should be called from the ` DRE ` interrupt handler . Once all bytes of the transaction have been sent this function will automatically disable the ` DRE ` interrupt .
pub fn send(&mut self) -> Result<(), Error> {
        let _ = self.spi.as_ref().read_flags_errors()?;
        let buf = self.buf.as_ref();
        if let Some(buf) = buf.get(self.sent..) {
            let mut data = buf.into_iter();
            let mut bytes = [0; 4];
            let mut iter = bytes.iter_mut();
            for _ in 0..self.spi.step() {
                match (iter.next(), data.next()) {
                    (Some(b), Some(d)) => *b = *d,
                    _ => break,
                }
            }
            let word = u32::from_le_bytes(bytes);
            unsafe { self.spi.as_mut().write_data(word as Data) };
            self.sent += self.spi.step();
        }
        if self.sent >= buf.len() {
            self.spi.as_mut().disable_interrupts(Flags::DRE);
        }
        Ok(())
    }
pub fn send ( & mut self ) -> Result < ( ) , Error > { let _ = self . spi . as_ref ( ) . read_flags_errors ( ) ? ; let buf = self . buf . as_ref ( ) ; if let Some ( buf ) = buf . get ( self . sent .. ) { let mut data = buf . into_iter ( ) ; let mut bytes = [ 0 ; 4 ] ; let mut iter = bytes . iter_mut ( ) ; for _ in 0 .. self . spi . step ( ) { match ( iter . next ( ) , data . next ( ) ) { ( Some ( b ) , Some ( d ) ) => * b = * d , _ => break , } } let word = u32 :: from_le_bytes ( bytes ) ; unsafe { self . spi . as_mut ( ) . write_data ( word as Data ) } ; self . sent += self . spi . step ( ) ; } if self . sent >= buf . len ( ) { self . spi . as_mut ( ) . disable_interrupts ( Flags :: DRE ) ; } Ok ( ( ) ) }
Send the next set of bytes from the buffer
This method should be called from the `DRE` interrupt handler.
Send the next set of bytes from the buffer This method should be called from the ` DRE ` interrupt handler .
&mut self
&mut self