Merge pull request #362 from Taylor-Woodcock/dal-integration

Fixed sample period lookup issue in MAG3110 and MMA8653 drivers.
This commit is contained in:
Joe Finney 2018-07-24 15:31:07 +01:00 committed by GitHub
commit 5d40fcf479
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -99,7 +99,7 @@ int MAG3110::configure()
// Bring the device online, with the requested sample frequency.
result = i2c.writeRegister(address, MAG_CTRL_REG1, magnetometerPeriod.get(samplePeriod) | 0x01);
result = i2c.writeRegister(address, MAG_CTRL_REG1, magnetometerPeriod.get(samplePeriod * 1000) | 0x01);
if (result != MICROBIT_OK)
return MICROBIT_I2C_ERROR;

View file

@ -130,7 +130,7 @@ int MMA8653::configure()
return MICROBIT_I2C_ERROR;
// Bring the device back online, with 10bit wide samples at the requested frequency.
value = accelerometerPeriod.get(samplePeriod);
value = accelerometerPeriod.get(samplePeriod * 1000);
result = i2c.writeRegister(address, MMA8653_CTRL_REG1, value | 0x01);
if (result != 0)
return MICROBIT_I2C_ERROR;

View file

@ -79,8 +79,8 @@ void MicroBitCompass::init(uint16_t id)
this->id = id;
this->status = 0;
// Set a default rate of 50Hz.
this->samplePeriod = 20;
// Set a default rate of 10Hz.
this->samplePeriod = 100;
this->configure();
// Assume that we have no calibration information.