Direct usage of a kernel driver for lower level access to a sensor?

Hello.

I'm developing a project with nRF (because of Bluetooth) and 6DOF sensor LSM6DSO.
I would like to be able to configure the sensor in more precise way, e.g. like continuous FIFO buffer, but the universal sensor API has only the basic functionality.
So I'm thinking, what is a good way to implement it.

One way is to use the ST pid (platform independent) driver and manually map it to I2C functions.
But most of this work is already done in the kernel driver (zephyr/drivers/sensor/st/lsm6dso/lsm6dso.c).
So is a good idea to use directly this zephyr driver? If it's OK, is there any example for it?

I'm new to the nRF Connect SDK and it's very hard to orient in it and find the right documentation because of so much number of abstract layers.

Thank you

Parents Reply

  • Hi.
    Thanks for the reply.
    So the best would be probably to make a new custom driver (which will be almost copy of the actual driver) but it will expose the needed functions in the driver API.

    Or of course I should be able to simply use the the I2C directly, in such case I just have to investigate, how it is mapped to the stm ipa driver.

    I have also one maybe "heretical" idea: What to make a custom driver, map the I2C line (using the STMEMSC_CTX_I2C) and expose this ctx object in the driver API so I can use it with the stm ipa driver directly (and I don't have to do zephyr driver wrapper definition for each function)?

Children
No Data
Related