Exemple #1
0
void hmc5883l_SetMeasurementMode(int mode) {
    u08 b;
    b = i2c_RcvByte(I2C_ID_HMC5883L, HMC5883L_CONFIG_A);
    b &= 0x7c; // "01111100" clear CRA7, keep existing averaging and datarate settings, clear measuremode bits
    b |= ((u08)mode);
    //b = (u08)mode;
    i2c_XmtByte(I2C_ID_HMC5883L, HMC5883L_CONFIG_A,b);
    }
/* This code is based on   Stellaris IMU (FREEIMU PORT) https://code.google.com/p/stellaris-lp-imu/
 */
short L3G4200D_CheckDevice()
{
	if(i2c_RcvByte(L3G4200D_I2C_ID, L3G4200D_WHO_AM_I) == 0xD3)
		return 1;
	return 0;
}