pub fn write_segments_raw(&self, segments: &[u8], pos: u8) {
        let mut n = segments.len() as u8;
        // beeing a little bit more failure tolerant
        if n == 0 { return; } // nothing to do
        let pos = pos % DISPLAY_REGISTERS_COUNT as u8; // only valid positions/registers

        // valid values are
        //   n = 1, pos = {0, 1, 2, 3, 4, 5}
        //   n = 2, pos = {0, 1, 2, 3, 4}
        //   n = 3, pos = {0, 1, 2, 3}
        //   n = 4, pos = {0, 1, 2}
        //   n = 5, pos = {0, 1}
        //   n = 6, pos = {0}
        // => n + pos must be <= DISPLAY_REGISTERS_COUNT

        if n + pos > DISPLAY_REGISTERS_COUNT as u8 {
            // only write as much data as registers are available
            n = DISPLAY_REGISTERS_COUNT as u8 - pos;
        }

        // Command 1
        // for more information about this flow: see data sheet / specification of TM1637
        // or AZDelivery's 7 segment display
        self.start();
        self.write_byte_and_wait_ack(ISA::DataCommandWriteToDisplay as u8);
        self.stop();

        // Write COMM2
        self.start();
        self.write_byte_and_wait_ack(ISA::AddressCommandD0 as u8 | pos);

        // Write the remaining data bytes
        // TM1637 does auto increment internally

        //println!("n={}, pos={}, data={:#?}", n, pos, segments);

        for i in 0..n {
            self.write_byte_and_wait_ack(segments[i as usize]);
        }
        self.stop();

        // we do this everytime because it will be a common flow that people write something
        // and expect the display to be on
        self.write_display_state();
    }
/// Writes all raw segments data beginning at the position into the display registers.
/// It uses auto increment internally to write into all further registers.
/// This functions does an internal check so that not more than 6 registers can be
/// addressed/written.
/// * `segments` Raw data describing the bits of the 7 segment display.
/// * `n` Length of segments array.
/// * `pos` The start position of the display register. While bytes are
///         written, address is adjusted internally via auto increment.
///         Usually this is 0, if you want to write data to all 7 segment
///         displays.
Writes all raw segments data beginning at the position into the display registers.
It uses auto increment internally to write into all further registers.
This functions does an internal check so that not more than 6 registers can be
addressed/written.
`segments` Raw data describing the bits of the 7 segment display.
`n` Length of segments array.
`pos` The start position of the display register. While bytes are
written, address is adjusted internally via auto increment.
Usually this is 0, if you want to write data to all 7 segment
displays.
Writes all raw segments data beginning at the position into the display registers . It uses auto increment internally to write into all further registers . This functions does an internal check so that not more than 6 registers can be addressed / written . ` segments ` Raw data describing the bits of the 7 segment display . ` n ` Length of segments array . ` pos ` The start position of the display register . While bytes are written address is adjusted internally via auto increment . Usually this is 0 if you want to write data to all 7 segment displays .
pub fn write_segments_raw(&self, segments: &[u8], pos: u8) {
        let mut n = segments.len() as u8;
        // beeing a little bit more failure tolerant
        if n == 0 { return; } // nothing to do
        let pos = pos % DISPLAY_REGISTERS_COUNT as u8; // only valid positions/registers
        // valid values are
        //   n = 1, pos = {0, 1, 2, 3, 4, 5}
        //   n = 2, pos = {0, 1, 2, 3, 4}
        //   n = 3, pos = {0, 1, 2, 3}
        //   n = 4, pos = {0, 1, 2}
        //   n = 5, pos = {0, 1}
        //   n = 6, pos = {0}
        // => n + pos must be <= DISPLAY_REGISTERS_COUNT
        if n + pos > DISPLAY_REGISTERS_COUNT as u8 {
            // only write as much data as registers are available
            n = DISPLAY_REGISTERS_COUNT as u8 - pos;
        }
        // Command 1
        // for more information about this flow: see data sheet / specification of TM1637
        // or AZDelivery's 7 segment display
        self.start();
        self.write_byte_and_wait_ack(ISA::DataCommandWriteToDisplay as u8);
        self.stop();
        // Write COMM2
        self.start();
        self.write_byte_and_wait_ack(ISA::AddressCommandD0 as u8 | pos);
        // Write the remaining data bytes
        // TM1637 does auto increment internally
        //println!("n={}, pos={}, data={:#?}", n, pos, segments);
        for i in 0..n {
            self.write_byte_and_wait_ack(segments[i as usize]);
        }
        self.stop();
        // we do this everytime because it will be a common flow that people write something
        // and expect the display to be on
        self.write_display_state();
    }
pub fn write_segments_raw ( & self , segments : & [ u8 ] , pos : u8 ) { let mut n = segments . len ( ) as u8 ; // beeing a little bit more failure tolerant if n == 0 { return ; } // nothing to do let pos = pos % DISPLAY_REGISTERS_COUNT as u8 ; // only valid positions/registers // valid values are //   n = 1, pos = {0, 1, 2, 3, 4, 5} //   n = 2, pos = {0, 1, 2, 3, 4} //   n = 3, pos = {0, 1, 2, 3} //   n = 4, pos = {0, 1, 2} //   n = 5, pos = {0, 1} //   n = 6, pos = {0} // => n + pos must be <= DISPLAY_REGISTERS_COUNT if n + pos > DISPLAY_REGISTERS_COUNT as u8 { // only write as much data as registers are available n = DISPLAY_REGISTERS_COUNT as u8 - pos ; } // Command 1 // for more information about this flow: see data sheet / specification of TM1637 // or AZDelivery's 7 segment display self . start ( ) ; self . write_byte_and_wait_ack ( ISA :: DataCommandWriteToDisplay as u8 ) ; self . stop ( ) ; // Write COMM2 self . start ( ) ; self . write_byte_and_wait_ack ( ISA :: AddressCommandD0 as u8 | pos ) ; // Write the remaining data bytes // TM1637 does auto increment internally //println!("n={}, pos={}, data={:#?}", n, pos, segments); for i in 0 .. n { self . write_byte_and_wait_ack ( segments [ i as usize ] ) ; } self . stop ( ) ; // we do this everytime because it will be a common flow that people write something // and expect the display to be on self . write_display_state ( ) ; }
Writes all raw segments data beginning at the position into the display registers.
Writes all raw segments data beginning at the position into the display registers .
&self
segments
&[u8]
pos
u8