public void Configure(Oversampling os, byte mask) { byte[][] expected = { new byte[] { 0x16, 0x2, mask } }; humidity.Configure(os); Assert.That(platform.GetCommands(), Is.EqualTo(expected)); }
public void Configure(Oversampling os, IirFilerCoeff coeff) { byte[][] expected = { new byte[] { 0x12, 0x03, OS_BITMASK[(int)os], FILTER_BITMASK[(int)coeff] } }; barometer.Configure(os, coeff); Assert.That(platform.GetCommands(), Is.EqualTo(expected)); }
public void Configure(Oversampling os = Oversampling.Standard, IirFilerCoeff coeff = IirFilerCoeff._0, StandbyTime time = StandbyTime._0_5ms) { var tempOversampling = (byte)((os == Oversampling.UltraHigh) ? 2 : 1); bridge.sendCommand(new byte[] { (byte)BAROMETER, CONFIG, (byte)(((byte)os << 2) | (tempOversampling << 5)), (byte)(((byte)coeff << 2) | ((byte)time << 5)) }); }
/// <summary> /// Set the temperature oversampling. /// </summary> /// <param name="oversampling">The <see cref="Oversampling"/> value to set.</param> public void SetTemperatureOversampling(Oversampling oversampling) { var register = Register.Ctrl_meas; byte read = Read8Bits(register); // Clear last 3 bits. var cleared = (byte)(read & 0b_0001_1111); _i2cDevice.Write(new[] { (byte)register, (byte)(cleared | (byte)oversampling << 5) }); }
/// <summary> /// Set the humidity oversampling. /// </summary> /// <param name="oversampling">The <see cref="Oversampling"/> to set.</param> public void SetHumidityOversampling(Oversampling oversampling) { var register = Register.Ctrl_hum; byte read = Read8Bits(register); // Clear first 3 bits. var cleared = (byte)(read & 0b_1111_1000); _i2cDevice.Write(new[] { (byte)register, (byte)(cleared | (byte)oversampling) }); }
/// <summary> /// Set the pressure oversampling. /// </summary> /// <param name="oversampling">The <see cref="Oversampling"/> value to set.</param> public void SetPressureOversampling(Oversampling oversampling) { var register = Register.Ctrl_meas; byte read = Read8Bits(register); // Clear bits 4, 3 and 2. var cleared = (byte)(read & 0b_1110_0011); _i2cDevice.Write(new[] { (byte)register, (byte)(cleared | (byte)oversampling << 2) }); }
/// <summary> /// Метод, привязывающий некие другие параметры плагина к редактору. /// </summary> private void BindMasterSettings(Routing routing) { var color = (Brush)Resources["masterKnobColor"]; MasterVolume.AttachTo(routing.MasterVolumeManager, color, Converters.PercentsToString); Oversampling.AttachTo(routing.OversamplingOrderManager, color, Converters.OversamplingOrderToString); ModulationType.AttachTo(routing.VoicesManager.ModulationTypeManager, color, Converters.ModulationTypeToString); }
public Qmc5883l( I2cDevice i2CDevice, Range range = Range.Range2, OutputRate outputRate = OutputRate.Rate10, Oversampling oversampling = Oversampling.Oversampling512, InterruptPin interruptPin = InterruptPin.Disabled, PointerRollOver pointerRollOver = PointerRollOver.Disabled ) { _i2cDevice = i2CDevice; _range = (byte)range; _outputRate = (byte)outputRate; _oversampling = (byte)oversampling; _interruptPin = (byte)interruptPin; _pointerRollOver = (byte)pointerRollOver; Initialize(); }
public void Configure(OutputDataRate odr = OutputDataRate._100Hz, DataRange range = DataRange._2g, float?highPassCutoff = null, Oversampling oversample = Oversampling.Normal) { for (int i = 0; i < dataSettings.Length; i++) { dataSettings[i] = 0; } dataSettings[3] |= (byte)oversample; dataSettings[2] |= (byte)((byte)odr << 3); dataSettings[0] |= (byte)range; if (highPassCutoff != null) { dataSettings[1] |= (byte)(Util.ClosestIndex_float(OS_CUTOFF_FREQS[(int)oversample][(int)odr], highPassCutoff.Value) & 0x3); dataSettings[0] |= 0x10; } bridge.sendCommand(ACCELEROMETER, DATA_CONFIG, dataSettings); }
public void Configure(Oversampling os = Oversampling.Standard) { bridge.sendCommand(new byte[] { (byte)HUMIDITY, MODE, (byte)os }); }
public override void Configure(Oversampling os = Oversampling.Standard, IirFilerCoeff coeff = IirFilerCoeff._0, float standbyTime = 0.5f) { int index = Util.closestIndex(STANDBY_TIMES, standbyTime); Configure(os, coeff, (StandbyTime)index); }
public abstract void Configure(Oversampling os = Oversampling.Standard, IirFilerCoeff coeff = IirFilerCoeff._0, float standbyTime = 0.5F);
public static extern void SetOversampling(IntPtr board, Oversampling oversampling);