GithubHelp home page GithubHelp logo

stmicroelectronics / lis2dw12-pid Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 4.0 84 KB

lis2dw12 platform independent driver based on Standard C language and compliant with MISRA standard

License: BSD 3-Clause "New" or "Revised" License

HTML 1.87% CSS 31.34% C 66.79%
mems-sensors stmicroelectronics

lis2dw12-pid's Issues

Bug in lis2dw12_acceleration_raw_get

The function "lis2dw12_acceleration_raw_get" is giving incorrect sensor results along X-, Y- and Z-axis since it doesn't ignore 2 Least significant bits on OUT_X_L (28h), OUT_Y_L (2Ah) and OUT_Z_L (2Ch).

****** Current Implementation ******:
val[0] = (int16_t)buff[1];
val[0] = (val[0] * 256) + (int16_t)buff[0];
val[1] = (int16_t)buff[3];
val[1] = (val[1] * 256) + (int16_t)buff[2];
val[2] = (int16_t)buff[5];
val[2] = (val[2] * 256) + (int16_t)buff[4];

****** Actual implementation must be ******
val[0] = (int16_t)buff[1];
val[0] = (int16_t)((val[0] << 8) + buff[0]);
val[0] = (int16_t)(val[0] >> 2);

val[1] = (int16_t)buff[3];
val[1] = (int16_t)((val[1] << 8) + buff[2]);
val[1] = (int16_t)(val[1] >> 2);

val[2] = (int16_t)buff[5];
val[2] = (int16_t)((val[2] << 8) + buff[4]);
val[2] = (int16_t)(val[2] >> 2);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.