コード例 #1
0
        public ADS7830(String I2CBus)
        {
            PeripheralManager pioService = PeripheralManager.Instance;
            II2cDevice        _device    = pioService.OpenI2cDevice(I2CBus, I2C_ADDRESS);

            this.device   = _device;
            this.disposed = false;
            this.read     = new byte[1];
            this.write    = new byte[1];
        }
コード例 #2
0
        public MMA8453(String I2CBus)
        {
            PeripheralManager pioService = PeripheralManager.Instance;
            II2cDevice        _device    = pioService.OpenI2cDevice(I2CBus, I2C_ADDRESS);


            this.device   = _device;
            this.write    = new byte[1];
            this.write[0] = 0x01;
            this.read     = new byte[6];
            this.disposed = false;
            byte[] initdata = new byte[] { 0x2A, 0x01 };
            this.device.Write(initdata, initdata.Length);
        }
コード例 #3
0
        public PCA9685(String I2CBus, String GPIO_NAME)
        {
            PeripheralManager pioService = PeripheralManager.Instance;
            II2cDevice        _device    = pioService.OpenI2cDevice(I2CBus, I2C_ADDRESS);

            this.write5   = new byte[5];
            this.write2   = new byte[2];
            this.write1   = new byte[1];
            this.read1    = new byte[1];
            this.disposed = false;

            this.device = _device;
            try
            {
                PeripheralManager manager = PeripheralManager.Instance;
                this.outputEnable = manager.OpenGpio(GPIO_NAME);
            }
            catch (Exception e)
            {
                Log.WriteLine(LogPriority.Info, TAG, "Unable to access GPIO", e);
            }


            if (this.outputEnable != null)
            {
                // Initialize the pin as a high output
                this.outputEnable.SetDirection(Gpio.DirectionOutInitiallyHigh);
                // Low voltage is considered active
                this.outputEnable.SetActiveType(Gpio.ActiveLow);
                // Toggle the value to be LOW
                this.outputEnable.Value = (false);
                //this.outputEnable.SetDriveMode(GpioPinDriveMode.Output);
                //this.outputEnable.Write(GpioPinValue.Low);
            }

            this.WriteRegister(Register.Mode1, (byte)0x20);
            this.WriteRegister(Register.Mode2, (byte)0x06);
        }
コード例 #4
0
 public Bno055(II2cDevice device, bool hasExtCrystal = false)
 {
     _i2cDevice = device;
     Initialize(hasExtCrystal);
 }