diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2019-03-21 15:44:42 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-05-24 00:43:43 +0000 |
commit | 648b4fc1e9aa62dff5f9b6cda55fc465ef5e8b1d (patch) | |
tree | 537bb673e086e04ee76985365318479a22ba4398 /board/scarlet/board.h | |
parent | a948e0e1d3c97c3e59ef45dc5767c69a1bd2254a (diff) | |
download | chrome-ec-648b4fc1e9aa62dff5f9b6cda55fc465ef5e8b1d.tar.gz |
bmi160: Fix ODR to REG when rate is less than 100Hz
The calculation was wrong and always returned the next value.
We were lucky that we always ask to round up, so the frequencies were
rounded up from the get go.
BUG=b:120942904
BRANCH=none
TEST=Test with several ODR for correctness:
cout << "10:" << BMI160_ODR_TO_REG(10000) << ":" <<
BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(10000)) << "\n"
<< "29:" << BMI160_ODR_TO_REG(29000) << ":" <<
BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(29000)) << "\n"
<< "59:" << BMI160_ODR_TO_REG(59000) << ":" <<
BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(59000)) << "\n"
<< "99:" << BMI160_ODR_TO_REG(99000) << ":" <<
BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(99000)) << "\n"
<< "109:" << BMI160_ODR_TO_REG(109000) << ":" <<
BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(109000)) << "\n"
<< "209:" << BMI160_ODR_TO_REG(209000) << ":" <<
BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(209000)) << "\n" ;
Returns:
10:4:6250
29:6:25000
59:7:50000
99:7:50000
109:8:100000
209:9:200000
(cherry picked from commit 0e99e97634135c9d4e6b60dcd6837bb76d91acf7)
Reviewed-on: https://chromium-review.googlesource.com/1535160
Reviewed-by: Yilun Lin <yllin@chromium.org>
Change-Id: I898d1077af78ab1d0e65ac0e8f7714a2a3b042b3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1621508
Diffstat (limited to 'board/scarlet/board.h')
0 files changed, 0 insertions, 0 deletions