Beispiel #1
0
        internal RpiWs281xClient(Ws281x_t data, PixelOrder pixelOrder = PixelOrder.GRB, ILog log = null)
        {
            _data           = data;
            _defaultChannel = 0;
            _log            = log ?? NullLogger.Instance;
            _pixelOrder     = PixelOrder.GRB;

            _init = NativeMethods.ws2811_init(ref _data);
            if (_init != 0)
            {
                throw new Exception(string.Format("ws2811_init failed - returned {0}", _init));
            }
        }
Beispiel #2
0
        internal Ws281x_t CreateDataStructure()
        {
            var data = new Ws281x_t
            {
                freq    = Frequency,
                dmanum  = Dma,
                channel = new [] {
                    new Ws281x_channel_t {
                        gpionum    = GpioPin,
                        count      = LedCount,
                        invert     = Invert ? 1 : 0,
                        brightness = Brightness,
                    },
                    new Ws281x_channel_t {
                    },
                }
            };

            return(data);
        }