code/WPILib/ADXL345_I2C.cpp
/**
 * Constructor.
 * 
 * @param slot The slot of the digital module that the sensor is plugged into.
 * @param range The range (+ or -) that the accelerometer will measure.
 */
Constructor.

@param slot The slot of the digital module that the sensor is plugged into.
@param range The range (+ or -) that the accelerometer will measure.
Constructor . @param slot The slot of the digital module that the sensor is plugged into . @param range The range ( + or - ) that the accelerometer will measure .
ADXL345_I2C::ADXL345_I2C(UINT32 slot, ADXL345_I2C::DataFormat_Range range)
	: m_i2c (NULL)
{
	DigitalModule *module = DigitalModule::GetInstance(slot);
	if (module)
	{
		m_i2c = module->GetI2C(kAddress);
		m_i2c->Write(kPowerCtlRegister, kPowerCtl_Measure);
		m_i2c->Write(kDataFormatRegister, kDataFormat_FullRes | (UINT8)range);
	}
}
ADXL345_I2C :: ADXL345_I2C ( UINT32 slot , ADXL345_I2C :: DataFormat_Range range ) : m_i2c ( NULL ) { DigitalModule * module = DigitalModule :: GetInstance ( slot ) ; if ( module ) { m_i2c = module -> GetI2C ( kAddress ) ; m_i2c -> Write ( kPowerCtlRegister , kPowerCtl_Measure ) ; m_i2c -> Write ( kDataFormatRegister , kDataFormat_FullRes | ( UINT8 ) range ) ; } }
Constructor.
Constructor .
// Turn on the measurements // Specify the data format to read