void LSM9DS1::readMag()
{
    uint8_t temp[6]; // We'll read six bytes from the mag into temp
    mReadBytes(OUT_X_L_M, temp, 6); // Read 6 bytes, beginning at OUT_X_L_M
    mx = (temp[1] << 8) | temp[0]; // Store x-axis values into mx
    my = (temp[3] << 8) | temp[2]; // Store y-axis values into my
    mz = (temp[5] << 8) | temp[4]; // Store z-axis values into mz
}
Example #2
0
int16_t LSM9DS1::readMag(lsm9ds1_axis axis)
{
	uint8_t temp[2];
	uint8_t status = mReadBytes(OUT_X_L_M + (2 * axis), temp, 2);
	
	if (status)
		return (temp[1] << 8) | temp[0];
	else
		return 0;
}
Example #3
0
void readMag1(void)
{
	//for(int kl = 0; kl < 10; kl++){
	uint8_t temp[6]; // We'll read six bytes from the mag into temp
	mReadBytes(OUT_X_L_M, temp, 6); // Read 6 bytes, beginning at OUT_X_L_M
	mx = (temp[1] << 8) | temp[0]; // Store x-axis values into mx
	my = (temp[3] << 8) | temp[2]; // Store y-axis values into my
	mz = (temp[5] << 8) | temp[4]; // Store z-axis values into mz

	mx = calcMag(mx);
	my = calcMag(my);
	mz = calcMag(mz);
	/*}*/


}
Example #4
0
int16_t readMag(lsm9ds1_axis axis)
{
	uint8_t temp[2];
	mReadBytes(OUT_X_L_M + (2 * axis), temp, 2);
	return (temp[1] << 8) | temp[0];
}