Exemplo n.º 1
0
 /// <summary>
 /// Creates a new ADXL345_I2C Accelerometer using the default address of 0x1D.
 /// </summary>
 /// <param name="port">The I2C port the accelerometer is attached to</param>
 /// <param name="range">The range (+ or -) that the accelerometer will measure.</param>
 public ADXL345_I2C(I2C.Port port, AccelerometerRange range)
 {
     m_i2C = new I2C(port, Address);
     m_i2C.Write(PowerCtlRegister, (int)PowerCtl.Measure);
     AccelerometerRange = range;
     HAL.Base.HAL.Report(ResourceType.kResourceType_ADXL345, Instances.kADXL345_I2C);
     LiveWindow.LiveWindow.AddSensor("ADXL345_I2C", (byte)port, this);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new ADXL345_I2C Accelerometer using the default address of 0x1D.
 /// </summary>
 /// <param name="port">The I2C port the accelerometer is attached to</param>
 /// <param name="range">The range (+ or -) that the accelerometer will measure.</param>
 public ADXL345_I2C(I2C.Port port, AccelerometerRange range)
 {
     m_i2C = new I2C(port, Address);
     m_i2C.Write(PowerCtlRegister, (int)PowerCtl.Measure);
     AccelerometerRange = range;
     HAL.Base.HAL.Report(ResourceType.kResourceType_ADXL345, Instances.kADXL345_I2C);
     LiveWindow.LiveWindow.AddSensor("ADXL345_I2C", (byte)port, this);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="port">The SPI port the accelerometer is attached to</param>
 /// <param name="range">The range (+ or -) that the accelerometer will measure.</param>
 public ADXL345_SPI(SPI.Port port, AccelerometerRange range)
 {
     m_spi = new SPI(port);
     m_spi.SetClockRate(500000);
     m_spi.SetSampleDataOnFalling();
     m_spi.SetClockActiveLow();
     m_spi.SetChipSelectActiveHigh();
     byte[] commands = new byte[2];
     commands[0] = PowerCtlRegister;
     commands[1] = (byte)PowerCtl.Measure;
     m_spi.Write(commands, 2);
     AccelerometerRange = range;
     HAL.Base.HAL.Report(ResourceType.kResourceType_ADXL345, Instances.kADXL345_SPI);
     LiveWindow.LiveWindow.AddSensor("ADXL345_SPI", (byte)port, this);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="port">The SPI port the accelerometer is attached to</param>
 /// <param name="range">The range (+ or -) that the accelerometer will measure.</param>
 public ADXL345_SPI(SPI.Port port, AccelerometerRange range)
 {
     m_spi = new SPI(port);
     m_spi.SetClockRate(500000);
     m_spi.SetSampleDataOnFalling();
     m_spi.SetClockActiveLow();
     m_spi.SetChipSelectActiveHigh();
     byte[] commands = new byte[2];
     commands[0] = PowerCtlRegister;
     commands[1] = (byte)PowerCtl.Measure;
     m_spi.Write(commands, 2);
     AccelerometerRange = range;
     HAL.Base.HAL.Report(ResourceType.kResourceType_ADXL345, Instances.kADXL345_SPI);
     LiveWindow.LiveWindow.AddSensor("ADXL345_SPI", (byte)port, this);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new <see cref="BuiltInAccelerometer"/>.
 /// </summary>
 /// <param name="range">The range for the accelerometer to measure</param>
 public BuiltInAccelerometer(AccelerometerRange range = AccelerometerRange.k8G)
 {
     AccelerometerRange = range;
     HAL.Base.HAL.Report(ResourceType.kResourceType_Accelerometer, (byte)0, 0, "Built-in accelerometer");
     LiveWindow.LiveWindow.AddSensor("BuiltInAccel", 0, this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new <see cref="BuiltInAccelerometer"/>.
 /// </summary>
 /// <param name="range">The range for the accelerometer to measure</param>
 public BuiltInAccelerometer(AccelerometerRange range = AccelerometerRange.k8G)
 {
     AccelerometerRange = range;
     HAL.Base.HAL.Report(ResourceType.kResourceType_Accelerometer, 0, 0, "Built-in accelerometer");
     LiveWindow.LiveWindow.AddSensor("BuiltInAccel", 0, this);
 }