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

Update read_sensor_data.c #17

Open
wants to merge 1 commit 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
8 changes: 4 additions & 4 deletions examples/bmi08x/read_sensor_data/read_sensor_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ int main(void)
else if (bmi08dev.variant == BMI088_VARIANT)
{
/* Converting lsb to meter per second squared for 16 bit accelerometer at 24G range. */
x = lsb_to_mps2(bmi08_accel.x, 24, 16);
y = lsb_to_mps2(bmi08_accel.y, 24, 16);
z = lsb_to_mps2(bmi08_accel.z, 24, 16);
x = lsb_to_mps2(bmi08_accel.x, (float)24, 16);
y = lsb_to_mps2(bmi08_accel.y, (float)24, 16);
z = lsb_to_mps2(bmi08_accel.z, (float)24, 16);
}

printf("%d, %5d, %5d, %5d, %4.2f, %4.2f, %4.2f\n",
Expand Down Expand Up @@ -368,7 +368,7 @@ int main(void)
* @brief This function converts lsb to meter per second squared for 16 bit accelerometer at
* range 2G, 4G, 8G or 16G.
*/
static float lsb_to_mps2(int16_t val, int8_t g_range, uint8_t bit_width)
static float lsb_to_mps2(int16_t val, float g_range, uint8_t bit_width)
{
double power = 2;

Expand Down