Skip to content

Commit

Permalink
Merge pull request #27 from libdriver/dev
Browse files Browse the repository at this point in the history
fix: fix sample rate divider bugs
  • Loading branch information
libdriver authored Aug 15, 2024
2 parents ab3262e + 8f2c630 commit c2d8a6e
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.3 (2024-08-15)

## Bug Fixes

- fix sample rate divider bugs

## 1.0.2 (2024-08-06)

## Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion example/driver_mpu6050_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ uint8_t mpu6050_basic_init(mpu6050_address_t addr_pin)
}

/* set the default rate */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (MPU6050_BASIC_DEFAULT_RATE - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / MPU6050_BASIC_DEFAULT_RATE) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion example/driver_mpu6050_dmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ uint8_t mpu6050_dmp_init(mpu6050_address_t addr_pin,
}

/* set the default rate */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (MPU6050_DMP_DEFAULT_RATE - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / MPU6050_DMP_DEFAULT_RATE) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion example/driver_mpu6050_fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ uint8_t mpu6050_fifo_init(mpu6050_address_t addr_pin)
}

/* set the default rate */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (MPU6050_FIFO_DEFAULT_RATE - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / MPU6050_FIFO_DEFAULT_RATE) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu6050_dmp_pedometer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ uint8_t mpu6050_dmp_pedometer_test(mpu6050_address_t addr, uint32_t times)
}

/* set 50Hz */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu6050_dmp_read_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ uint8_t mpu6050_dmp_read_test(mpu6050_address_t addr, uint32_t times)
}

/* set 200Hz */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (200 - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 200) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu6050_dmp_tap_orient_motion_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ uint8_t mpu6050_dmp_tap_orient_motion_test(mpu6050_address_t addr)
}

/* set 50Hz */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu6050_fifo_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ uint8_t mpu6050_fifo_test(mpu6050_address_t addr, uint32_t times)
}

/* set 50Hz */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu6050_read_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ uint8_t mpu6050_read_test(mpu6050_address_t addr, uint32_t times)
}

/* set 50Hz */
res = mpu6050_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu6050_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu6050_interface_debug_print("mpu6050: set sample rate divider failed.\n");
Expand Down

0 comments on commit c2d8a6e

Please sign in to comment.