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

how to read LPS22hb file function ?

I am trying to integrate LPS22hb sensor n nrf52832. I am starting with twi_master_using_nrf_twi_mngr example(sdk15a->compents->drivers_ext->lps22hb)

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

ret_code_t hts221_temp_read(hts221_instance_t *       p_instance,
                            hts221_data_callback_t    user_callback,
                            int16_t *                 p_temp)
{
    ASSERT(p_instance != NULL);
    return nrf_twi_sensor_reg_read(p_instance->p_sensor_data,
                                   p_instance->sensor_addr,
                                   HTS221_REG_TEMP_OUT_L | HTS221_INCR_REG_MASK,
                                   (nrf_twi_sensor_reg_cb_t) user_callback,
                                   (uint8_t *) p_temp,
                                   2);
}

 I am not sure that what argument use when I call the function. i created the instance and know the sensor address.give below

/* TWI instance ID. */
#define TWI_INSTANCE_ID             0
#define TWI_ADDRESS                 0x5B

#define MAX_PENDING_TRANSACTIONS    5

NRF_TWI_MNGR_DEF(m_nrf_twi_mngr, MAX_PENDING_TRANSACTIONS, TWI_INSTANCE_ID);
NRF_TWI_SENSOR_DEF(m_twi_sensor, &m_nrf_twi_mngr, 128);
LPS22HB_INSTANCE_DEF(m_lps22hb, &m_twi_sensor, TWI_ADDRESS); 

i anyone could give me some pointers calling f this sensor that would be great.

thanks

Parents
  • We do not any example using the driver for lps22hb available in our SDK.

    You can find a reference example in this thread in the attached zip file to get an idea on how to use the API from the driver.

  • i have problem while calling this below function int main file. can please tell me  which parameter need to pass from this function

    err_code = nrf_twi_sensor_reg_read(p_instance->p_sensor_data,
                                           p_instance->sensor_addr,
                                           LPS22HB_REG_PRESS_OUT_XL,
                                           (nrf_twi_sensor_reg_cb_t) user_callback,
                                           (uint8_t *) p_out_data,
                                           samples * LPS22HB_BYTES_PER_SAMPLE);

    please help me if anyone doing this.

  • Dewal,

    To get best response from the community, you need to describe more.

    What error number you are getting when calling that function. Have you tried usin gthe reference example that I linked in my earlier reply? Did you try to debug the error in any way? which instruction inside that API has the failure exactly?

Reply Children
Related