Exemple #1
0
        private void pe2a_mcp23s17_tr(byte device, byte txdata)
        {
            _bcm2835.bcm2835_gpio_write(Gpio_AI_CS3, Bcm2835.HIGH);
            _bcm2835.bcm2835_spi_chipSelect((byte)Bcm2835.bcm2835SPIChipSelect.BCM2835_SPI_CS1);
            _bcm2835.bcm2835_spi_setChipSelectPolarity((byte)Bcm2835.bcm2835SPIChipSelect.BCM2835_SPI_CS1, Bcm2835.LOW);

            var do_tbuf = new byte[3];

            device     = (byte)(device & 0xfe);   // Clear last bit for a write
            do_tbuf[0] = device;
            do_tbuf[1] = setGPIOAorB;             //from coming global val.
            do_tbuf[2] = txdata;

            _bcm2835.bcm2835_spi_transfern(do_tbuf, (uint)do_tbuf.Length);
        }