cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DH12 how to use standard ST driver functions:Sensor_IO_Read/Write

melt brink
Associate III
Posted on July 04, 2017 at 12:03

Goodday. Im trying out the ST standard component driver for LIS2DH12 (LIS2DH12_ACC_driver.c) I have added it to my project but  compiler kicks out a undefined symbol error. Which is what I would expect as I have not defined any of the below.

extern uint8_t Sensor_IO_Read(void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead);

extern uint8_t Sensor_IO_Write(void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite);

Im trying to figure out what is required of me to define and where? I can see its an I2C R/W function with certain unsigned int's that needs to be used in that order to read and write, but I have no idea how to declare these in main.c or how to call these in conjunction with the standard I2C.c in  stdPeriph_driver library.

these two functions are nowhere else in the driver so do I need to write my own?

any explanation or direction would be greatly appreciated.

#accelerometer-lis2dh12-configure
12 REPLIES 12
Posted on July 19, 2017 at 10:10

brink.melt

you can add attachment (for example .c file)

If you reply to the post click on 'Use advanced editor' then you can add the attachment.

Posted on August 10, 2017 at 16:46

to whom will download the zip file in the future,

that will prove indeed useful, under some clarifications:

melt brink
Associate III
Posted on September 28, 2017 at 14:08

I have attached a spreadsheet on some configurations I have tested on the LIS2DH In case someone can use it in future.

These include

1. Single click configuration

2. Double click configuration

3. Free fall setup

4. XYZ movement setup with and without HP filter.

Feel free to correct or add to the spreadsheet.

________________

Attachments :

accel config.xlsx : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyOx&d=%2Fa%2F0X0000000b77%2FZQlWYeclYsJyCpdSApVytAvgoQI2naEdpgmLOo65Soo&asPdf=false