This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Set Up LPS22HB with nRF52840

I am trying to set up the LPS22HB sensor with an nRF52840.  I am starting with the twi_sensor example(SDK16->examples->peripherals->twi_sensor) and adding the lps22hb example code from the SDK(SDK16->Components->drivers_ext->lps22hb)

I have added lps22hb.c, lps22hb.h, and lps22hb_internal.h to my the twi_sensor example.

The first instruction in lps22hb.h says "Sensor instance has to be defined first in global context using @ref LPS22HB_INSTANCE DEF."

I think that means to create an instance using the macro on line 163 in lps22hb.h 

#define LPS22HB_INSTANCE_DEF(_lps22hb_inst_name, _p_twi_sensor, _sensor_address)                \
    LPS22HB_INTERNAL_INSTANCE_DEF(_lps22hb_inst_name, _p_twi_sensor, _sensor_address)

I'm not sure what arguments use when I call the function. I know the sensor address is 0x5D, but I don't know what to put in for the first two. 

I'm also not sure what I'm getting back from the function call. What is the syntax I should use when calling the function?

If anyone could give me some pointers on calling this function that would be great!

Thank you

Parents
  • Hi 

    It seems we don't have any good examples showing how to configure this sensor driver. 

    It requires both the nrf_twi_sensor module and the nrf_twi_mngr module to run, and we don't have any examples showing how to combine these two modules. 

    I made a small example to try to get the lps22h.c driver working, and you will find it attached:

    246030_twi_sensor_lps22b.zip

    Please note that I have only verified that it compiles. I don't have the sensor available, so I can't test if it's actually working. 

    Best regards
    Torbjørn

Reply
  • Hi 

    It seems we don't have any good examples showing how to configure this sensor driver. 

    It requires both the nrf_twi_sensor module and the nrf_twi_mngr module to run, and we don't have any examples showing how to combine these two modules. 

    I made a small example to try to get the lps22h.c driver working, and you will find it attached:

    246030_twi_sensor_lps22b.zip

    Please note that I have only verified that it compiles. I don't have the sensor available, so I can't test if it's actually working. 

    Best regards
    Torbjørn

Children
Related