/// <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); }
/// <summary> /// Initializes the NavX singleton /// </summary> /// <param name="i2CPortId">port that the NavX is plugged into</param> /// <param name="updateRateHz">the update rate of the NavX - default 50Hz</param> internal static NavX InitializeNavX(I2C.Port i2CPortId, byte updateRateHz = 50) { if (_lazy != null) { Report.Error( @"A NavX instance already been created, someone other than Config is trying to create an instance."); } _lazy = new Lazy <NavX>(() => new NavX(i2CPortId, updateRateHz)); return(Instance); }
private NavX(I2C.Port i2CPortId, byte updateRateHz = 50) : base(i2CPortId, updateRateHz) { }