Ejemplo n.º 1
0
        public void SpiWrite(int handle, byte[] data)
        {
            GCHandle h = GCHandle.Alloc(data, GCHandleType.Pinned);

            try
            {
                short ret = PiGpioNativeMethods.spiWrite((ushort)handle, h.AddrOfPinnedObject(), (ushort)data.Length);
                if (ret < 0)
                {
                    throw new PiGPIOException(ret);
                }
            }
            finally
            {
                h.Free();
            }
        }