Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resetting drdy_acc when reading sync data #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 18 additions & 26 deletions bmi08a.c
Original file line number Diff line number Diff line change
Expand Up @@ -1515,36 +1515,28 @@ int8_t bmi08a_get_synchronized_data(struct bmi08_sensor_data *accel,
/* Proceed if pointers are not NULL */
if ((accel != NULL) && (gyro != NULL))
{
/* Read accel x,y sensor data */
reg_addr = BMI08_REG_ACCEL_GP_0;
rslt = bmi08a_get_regs(reg_addr, &data[0], 4, dev);
/* Read accel x,y, z sensor data */
rslt = bmi08a_get_regs(BMI08_REG_ACCEL_X_LSB, &data[0], 6, dev);

if (rslt == BMI08_OK)
{
/* Read accel sensor data */
reg_addr = BMI08_REG_ACCEL_GP_4;
rslt = bmi08a_get_regs(reg_addr, &data[4], 2, dev);
lsb = data[0];
msb = data[1];
msblsb = (msb << 8) | lsb;
accel->x = ((int16_t) msblsb); /* Data in X axis */

if (rslt == BMI08_OK)
{
lsb = data[0];
msb = data[1];
msblsb = (msb << 8) | lsb;
accel->x = ((int16_t) msblsb); /* Data in X axis */

lsb = data[2];
msb = data[3];
msblsb = (msb << 8) | lsb;
accel->y = ((int16_t) msblsb); /* Data in Y axis */

lsb = data[4];
msb = data[5];
msblsb = (msb << 8) | lsb;
accel->z = ((int16_t) msblsb); /* Data in Z axis */

/* Read gyro sensor data */
rslt = bmi08g_get_data(gyro, dev);
}
lsb = data[2];
msb = data[3];
msblsb = (msb << 8) | lsb;
accel->y = ((int16_t) msblsb); /* Data in Y axis */

lsb = data[4];
msb = data[5];
msblsb = (msb << 8) | lsb;
accel->z = ((int16_t) msblsb); /* Data in Z axis */

/* Read gyro sensor data */
rslt = bmi08g_get_data(gyro, dev);
}
}
else
Expand Down