/// <summary> /// Creates a new <see cref="ADXL362"/> with the specified <see cref="SPI.Port">Port</see> /// and <see cref="AccelerometerRange">Range</see>. /// </summary> /// <param name="port">The SPI Port the accelerometer is connected to.</param> /// <param name="range">The range that the accelerometer will measure.</param> public ADXL362(SPI.Port port, AccelerometerRange range) { m_spi = new SPI(port); m_spi.SetClockRate(3000000); m_spi.SetMSBFirst(); m_spi.SetSampleDataOnRising(); m_spi.SetClockActiveHigh(); m_spi.SetChipSelectActiveLow(); byte[] commands = new byte[] { RegRead, PartIdRegister, 0, }; m_spi.Transaction(commands, commands, 3); if (commands[2] != 0xF2) { DriverStation.ReportError("Could not find ADXL362", false); m_gsPerLSB = 0.0; return; } AccelerometerRange = range; commands[0] = RegWrite; commands[1] = PowerCtlRegister; commands[2] = PowerCtlRegister | PowerCtl_UltraLowNoise; m_spi.Write(commands, 3); Report(ResourceType.kResourceType_ADXL362, (byte)port); LiveWindow.LiveWindow.AddSensor("ADXL362", port.ToString(), this); }
public void TestSetRange(AccelerometerRange range) { m_accel.AccelerometerRange = range; Assert.AreEqual(GetData().Range, (byte)range); GetData().Active = false; }
/// <summary> /// Constructs a ADXL357 I2C device. /// </summary> /// <param name="i2CDevice">The I2C device used for communication.</param> /// <param name="accelerometerRange">The sensitivity of the accelerometer.</param> public Adxl357(I2cDevice i2CDevice, AccelerometerRange accelerometerRange = AccelerometerRange.Range10G) { _i2CDevice = i2CDevice ?? throw new ArgumentNullException(nameof(i2CDevice)); Reset(); AccelerometerRange = accelerometerRange; PowerOn(); }
public BuiltInAccelerometer(AccelerometerRange range = AccelerometerRange.k8G) { Range = range; }
public BuiltInAccelerometerTest(AccelerometerRange range) { m_accelerometer = new BuiltInAccelerometer(range); }
public static void setAccelerometerRange(AccelerometerRange param0) { halData["accelerometer"]["range"] = (int)param0; }
public static extern void setAccelerometerRange(AccelerometerRange param0);
public static void SetRange(AccelerometerRange range) { lowLevel.HAL_SetAccelerometerRange(range); }