示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EEpromClick"/> class.
 /// </summary>
 /// <param name="socket">The socket on which the EEpromClick module is plugged on MikroBus.Net board</param>
 /// <param name="address">The address of the module.</param>
 /// <param name="memorySize">Optionnal size of the memory chip, in KB. Default to 8KB, as sold by MikroElektronika.</param>
 public EEpromClick(Hardware.Socket socket, Byte address, Int32 memorySize = 8)
 {
     // Create the driver's I²C configuration
     _eeprom     = I2cController.FromName(socket.I2cBus).GetDevice(new I2cConnectionSettings(address, 100000));
     _memorysize = memorySize * 1024;
     gpio.GpioPin _wp = gpio.GpioController.GetDefault().OpenPin(socket.PwmPin);
     _wp.SetDriveMode(gpio.GpioPinDriveMode.Output);
     _wp.Write(gpio.GpioPinValue.Low);
 }
示例#2
0
        public LedRingClick(Hardware.Socket socket)
        {
            gpio.GpioPin _rst = gpio.GpioController.GetDefault().OpenPin(socket.Rst);
            _rst.SetDriveMode(gpio.GpioPinDriveMode.Output);
            _rst.Write(gpio.GpioPinValue.High);

            _ledRing = SpiController.FromName(socket.SpiBus).GetDevice(new SpiConnectionSettings()
            {
                ChipSelectType = SpiChipSelectType.Gpio,
                ChipSelectLine = gpio.GpioController.GetDefault().OpenPin(socket.Cs),
                Mode           = SpiMode.Mode3,
                ClockFrequency = 1000000
            });

            _rst.Write(gpio.GpioPinValue.Low);
            Thread.Sleep(1);
            _rst.Write(gpio.GpioPinValue.High);
        }