Skip to content

Commit

Permalink
Merge pull request #18 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 696a209 + 989422e commit 54035da
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 16 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 doc/html/driver__mpu9250__basic_8c_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; }</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="comment">/* set the default rate */</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (<a class="code" href="group__mpu9250__example__driver.html#gaac2df48f34051acc9eaceddb3ef8357a">MPU9250_BASIC_DEFAULT_RATE</a> - 1));</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / <a class="code" href="group__mpu9250__example__driver.html#gaac2df48f34051acc9eaceddb3ef8357a">MPU9250_BASIC_DEFAULT_RATE</a>) - 1);</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; {</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/driver__mpu9250__dmp_8c_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; }</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; </div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <span class="comment">/* set the default rate */</span></div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (<a class="code" href="group__mpu9250__example__driver.html#ga97cfcd6b1f9cecd2c7ee3c49d8a84bb7">MPU9250_DMP_DEFAULT_RATE</a> - 1));</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / <a class="code" href="group__mpu9250__example__driver.html#ga97cfcd6b1f9cecd2c7ee3c49d8a84bb7">MPU9250_DMP_DEFAULT_RATE</a>) - 1);</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; {</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; }</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; </div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="comment">/* set 50Hz */</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (50 - 1));</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / 50) - 1);</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; {</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/driver__mpu9250__dmp__read__test_8c_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; }</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="comment">/* set 50Hz */</span></div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (50 - 1));</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / 50) - 1);</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; {</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>&#160; }</div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>&#160; </div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>&#160; <span class="comment">/* set 50Hz */</span></div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (50 - 1));</div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / 50) - 1);</div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>&#160; {</div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/driver__mpu9250__fifo_8c_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; }</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; </div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; <span class="comment">/* set the default rate */</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (<a class="code" href="group__mpu9250__example__driver.html#ga9a513d232aa5cd19f67c5ac17bdc7661">MPU9250_FIFO_DEFAULT_RATE</a> - 1));</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / <a class="code" href="group__mpu9250__example__driver.html#ga9a513d232aa5cd19f67c5ac17bdc7661">MPU9250_FIFO_DEFAULT_RATE</a>) - 1);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; {</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/driver__mpu9250__fifo__test_8c_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; }</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <span class="comment">/* set 50Hz */</span></div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (50 - 1));</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / 50) - 1);</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; {</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
2 changes: 1 addition & 1 deletion doc/html/driver__mpu9250__read__test_8c_source.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; }</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; </div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="comment">/* set 50Hz */</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, 1000 / (50 - 1));</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; res = <a class="code" href="group__mpu9250__basic__driver.html#gab8ef8d4cc839a2fbcb55e65330b1ba0b">mpu9250_set_sample_rate_divider</a>(&amp;gs_handle, (1000 / 50) - 1);</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <span class="keywordflow">if</span> (res != 0)</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; {</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; <a class="code" href="group__mpu9250__interface__driver.html#ga15e531f463207b6917de60a4e3354ddd">mpu9250_interface_debug_print</a>(<span class="stringliteral">&quot;mpu9250: set sample rate divider failed.\n&quot;</span>);</div>
Expand Down
2 changes: 1 addition & 1 deletion example/driver_mpu9250_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ uint8_t mpu9250_basic_init(mpu9250_interface_t interface, mpu9250_address_t addr
}

/* set the default rate */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (MPU9250_BASIC_DEFAULT_RATE - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / MPU9250_BASIC_DEFAULT_RATE) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion example/driver_mpu9250_dmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ uint8_t mpu9250_dmp_init(mpu9250_interface_t interface, mpu9250_address_t addr_p
}

/* set the default rate */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (MPU9250_DMP_DEFAULT_RATE - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / MPU9250_DMP_DEFAULT_RATE) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion example/driver_mpu9250_fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ uint8_t mpu9250_fifo_init(mpu9250_interface_t interface, mpu9250_address_t addr_
}

/* set the default rate */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (MPU9250_FIFO_DEFAULT_RATE - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / MPU9250_FIFO_DEFAULT_RATE) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu9250_dmp_pedometer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ uint8_t mpu9250_dmp_pedometer_test(mpu9250_interface_t interface, mpu9250_addres
}

/* set 50Hz */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu9250_dmp_read_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ uint8_t mpu9250_dmp_read_test(mpu9250_interface_t interface, mpu9250_address_t a
}

/* set 50Hz */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu9250_dmp_tap_orient_motion_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ uint8_t mpu9250_dmp_tap_orient_motion_test(mpu9250_interface_t interface, mpu925
}

/* set 50Hz */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu9250_fifo_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ uint8_t mpu9250_fifo_test(mpu9250_interface_t interface, mpu9250_address_t addr,
}

/* set 50Hz */
res = mpu9250_set_sample_rate_divider(&gs_handle, 1000 / (50 - 1));
res = mpu9250_set_sample_rate_divider(&gs_handle, (1000 / 50) - 1);
if (res != 0)
{
mpu9250_interface_debug_print("mpu9250: set sample rate divider failed.\n");
Expand Down
2 changes: 1 addition & 1 deletion test/driver_mpu9250_read_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ uint8_t mpu9250_read_test(mpu9250_interface_t interface, mpu9250_address_t addr,
}

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

0 comments on commit 54035da

Please sign in to comment.