コード例 #1
0
            public BitArray read()
            {
                GpioPinValue tempval;

                PinPL.putEnabled(true);
                PinPL.putEnabled(false);
                PinCE.putEnabled(true);

                for (int i = PinQT; i >= 0; i--)
                {
                    tempval = PinQ7.GpioPin.Read();

                    if (tempval == GpioPinValue.High)
                    {
                        this.currentstate[i] = true;
                    }
                    else
                    {
                        this.currentstate[i] = false;
                    }
                    clock();
                }

                PinCE.putEnabled(false);
                return(this.currentstate);
            }
コード例 #2
0
            private void sendToRegister()
            {
                //do this in the reverse order since each bit clocked in is shifted.
                for (int i = PinQT; i >= 0; i--)
                {
                    switch (this.currentstate[i])
                    {
                    case true: { PinSDI.putEnabled(true); break; }

                    default: { PinSDI.putEnabled(false); break; }
                    }
                    PulseSRCLK();
                }
                PulseRCLK();
            }