Struct cupi_shift::Shifter [] [src]

pub struct Shifter {
    pub data: PinOutput,
    pub latch: PinOutput,
    pub clock: PinOutput,
    // some fields omitted
}

Fields

Methods

impl Shifter
[src]

Returns a new Shifter object that will shift out data using the given data_pin, latch_pin, and clock_pin. To use a Shifter instance you must first call the add() method for each shift register you have connected in sequence.

Note about pin numbering

cupi currently uses GPIO pin numbering. So pin 40 (very last pin on the Raspberry Pi 2) is actually pin 29. You can refer to this image to figure out which pin is which:

http://pi4j.com/images/j8header-2b-large.png

Adds a new shift register to this Shifter and returns a reference to it. You must specify the number of pins.

Sets the data on the shift register at the given sr_index. If apply is true the change will be applied immediately.

Sets the given pin HIGH on the shift register at the given sr_index. If apply is true the change will be applied immediately.

Sets the given pin LOW on the shift register at the given sr_index. If apply is true the change will be applied immediately.

This function will invert all logic so that HIGH is LOW and LOW is HIGH. Very convenient if you made a (very common) mistake in your wiring or you need reversed logic for other reasons.

Applies all current shift register states by shifting out all the stored data in each ShiftRegister object.