fn write<T, I>(&mut self, iterator: T) -> Result<(), Self::Error>
    where
        T: Iterator<Item = I>,
        I: Into<Self::Color>,
    {
        self.spi.write(&[0x00, 0x00, 0x00, 0x00])?;
        for item in iterator {
            let item = item.into();
            match self.pixel_order {
                PixelOrder::RGB => self.spi.write(&[0xFF, item.r, item.g, item.b])?,
                PixelOrder::RBG => self.spi.write(&[0xFF, item.r, item.b, item.g])?,
                PixelOrder::GRB => self.spi.write(&[0xFF, item.g, item.r, item.b])?,
                PixelOrder::GBR => self.spi.write(&[0xFF, item.g, item.b, item.r])?,
                PixelOrder::BRG => self.spi.write(&[0xFF, item.b, item.r, item.g])?,
                PixelOrder::BGR => self.spi.write(&[0xFF, item.b, item.g, item.r])?,
            }
        }
        for _ in 0..self.end_frame_length {
            match self.invert_end_frame {
                false => self.spi.write(&[0xFF])?,
                true => self.spi.write(&[0x00])?,
            };
        }
        Ok(())
    }
/// Write all the items of an iterator to an apa102 strip
Write all the items of an iterator to an apa102 strip
Write all the items of an iterator to an apa102 strip
fn write<T, I>(&mut self, iterator: T) -> Result<(), Self::Error>
    where
        T: Iterator<Item = I>,
        I: Into<Self::Color>,
    {
        self.spi.write(&[0x00, 0x00, 0x00, 0x00])?;
        for item in iterator {
            let item = item.into();
            match self.pixel_order {
                PixelOrder::RGB => self.spi.write(&[0xFF, item.r, item.g, item.b])?,
                PixelOrder::RBG => self.spi.write(&[0xFF, item.r, item.b, item.g])?,
                PixelOrder::GRB => self.spi.write(&[0xFF, item.g, item.r, item.b])?,
                PixelOrder::GBR => self.spi.write(&[0xFF, item.g, item.b, item.r])?,
                PixelOrder::BRG => self.spi.write(&[0xFF, item.b, item.r, item.g])?,
                PixelOrder::BGR => self.spi.write(&[0xFF, item.b, item.g, item.r])?,
            }
        }
        for _ in 0..self.end_frame_length {
            match self.invert_end_frame {
                false => self.spi.write(&[0xFF])?,
                true => self.spi.write(&[0x00])?,
            };
        }
        Ok(())
    }
fn write < T , I > ( & mut self , iterator : T ) -> Result < ( ) , Self :: Error > where T : Iterator < Item = I > , I : Into < Self :: Color > , { self . spi . write ( & [ 0x00 , 0x00 , 0x00 , 0x00 ] ) ? ; for item in iterator { let item = item . into ( ) ; match self . pixel_order { PixelOrder :: RGB => self . spi . write ( & [ 0xFF , item . r , item . g , item . b ] ) ? , PixelOrder :: RBG => self . spi . write ( & [ 0xFF , item . r , item . b , item . g ] ) ? , PixelOrder :: GRB => self . spi . write ( & [ 0xFF , item . g , item . r , item . b ] ) ? , PixelOrder :: GBR => self . spi . write ( & [ 0xFF , item . g , item . b , item . r ] ) ? , PixelOrder :: BRG => self . spi . write ( & [ 0xFF , item . b , item . r , item . g ] ) ? , PixelOrder :: BGR => self . spi . write ( & [ 0xFF , item . b , item . g , item . r ] ) ? , } } for _ in 0 .. self . end_frame_length { match self . invert_end_frame { false => self . spi . write ( & [ 0xFF ] ) ? , true => self . spi . write ( & [ 0x00 ] ) ? , } ; } Ok ( ( ) ) }
Write all the items of an iterator to an apa102 strip
Write all the items of an iterator to an apa102 strip
&mut self
iterator
T
&mut self
iterator
T