Makes sense. Here are the highlights:
First, the changes to the library:
Code:
bool NXPMotionSense::FXOS8700_begin()
{
const uint8_t i2c_addr=FXOS8700_I2C_ADDR0;
uint8_t b;
//Serial.println("FXOS8700_begin");
// detect if chip is present
if (!read_regs(i2c_addr, FXOS8700_WHO_AM_I, &b, 1)) return false;
//Serial.printf("FXOS8700 ID = %02X\n", b);
if (b != 0xC7) return false;
// place into standby mode
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0)) return false;
// configure magnetometer
if (!write_reg(i2c_addr, FXOS8700_M_CTRL_REG1, 0x1F)) return false;
if (!write_reg(i2c_addr, FXOS8700_M_CTRL_REG2, 0x20)) return false;
// configure accelerometer
if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x01)) return false; // 4G range
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG2, 0x02)) return false; // hires
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0x0D)) return false; // 100Hz A+M (changed from 0x15 to 0x0D to increase to 200 Hz)
//Serial.println("FXOS8700 Configured");
return true;
}
Very simple: I changed the CTRL_REG1 from 0x15 to 0x0D, which does in fact double the data rate of the sensor. I did something similar to the
Code:
NXPMotionSense::FXAS21002_begin()
function.
The top-level code is just the main example for this library: "Orientation.ino". Biggest issue is (I think) that I just don't understand how I2C timing works well enough. In leiu of an answer, links to good resources would be much appreciated (Google is of surprisingly little help).
Thanks!