LIS3DH accelerometer driver#2296
Conversation
drivers/include/lis3dh.h
Outdated
There was a problem hiding this comment.
Maybe use @name for this and the following group of macros.
|
Updated Doxygen according to comments, replaced disabled |
|
Nice! Do you know if this is compatible with the LIS302DL or LIS3DSH which are mounted on the stm32f4discovery board? |
|
@PeterKietzmann They are similar, but the LIS3DSH has a different response to the WHO_AM_I query. The basic accelerometer functionality seem the same between the LIS3DH and LIS3DSH, but the LIS3DSH has some different registers for configuration and does not have the extra 3 auxiliary ADC channels on the LIS3DH. The changes seem too large to be easily made compatible, this driver can be used as a base for a future LIS3DSH driver. |
|
As far as I see it you return raw data when reading the sensor values, right? I would actually vote for returning a physical value (as e.g. mili G). This is what we have done for most the other sensors. When I use a sensor, even more importantly when I do sensor fusion, that's the values I am interested in and as a user I don't want to read the data sheet to figure out how to translate the raw values... |
|
@haukepetersen okay, I will add this scaling. |
|
|
@haukepetersen After reading the data sheet again I noticed that it states that the scale is 1 mg per digit at +/- 2G, 2 mg per digit at +/- 4G etc. The values are left-aligned, meaning that we do not need to scale depending on which sensor full scale has been selected (edit: or do we? I need to test this). In ST Application Note AN3308 LIS3DH: MEMS digital output motion sensor I do not have the device with me at the moment, I need to do some experiments when I get back in order to verify the correct values, if it is at all noticeable, the difference is pretty small and close to the noise level. |
|
Travis fail is unrelated. |
46f89d4 to
9eb5e92
Compare
|
Added scaling to milli G. From my experiments it seems like the scale at 2G setting is such that 1 G is approx 16384, not 16000, so the app note seem correct. |
|
@gebart I have no hardware to test. Anyone has? Everything looks valid to me, in results I think I can trust you. How about squashing? |
|
@PeterKietzmann I have refactored to use Squash and go? |
|
Yes looks good. Please squash, then let's see what Travis says. |
eeedb10 to
67bc5a6
Compare
LIS3DH MEMS digital output motion sensor ultra low-power high performance 3-axes "nano" accelerometer Manufacturer website: http://www.st.com/web/catalog/sense_power/FM89/SC444/PF250725 Data sheet: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00274221.pdf tests/driver_lis3dh is a simple test application for testing on actual hardware. Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
67bc5a6 to
ca56de8
Compare
|
As nobody has this sensor available I'll trust you that it works:-). Everything looks fine and the unclear points had been discussed. ACK |
LIS3DH accelerometer driver
I wrote a driver for the ST Micro LIS3DH accelerometer. It only provides basic functionality of the sensor.
Polling in streaming or FIFO modes. No interrupts (INT1, INT2).
The sensor name is LIS3DH MEMS digital output motion sensor ultra low-power high performance 3-axes "nano" accelerometer
Manufacturer website: http://www.st.com/web/catalog/sense_power/FM89/SC444/PF250725
Data sheet: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00274221.pdf
I have executed the test application on my Mulle board and it works there.
I based the structure of the driver and the test application on the design of the L3G4200 gyroscope driver.