Skip to main content
CPeng.1
Visitor II
June 10, 2020
Question

Can someone provide a INTERRUPT BASED driver for LIS2DW12?

  • June 10, 2020
  • 1 reply
  • 664 views

Hi community:

There is this driver provided on ST webpage for LIS2DW12:

https://www.st.com/content/st_com/en/products/embedded-software/mems-and-sensors-software/drivers-for-mems/c-driver-mems.html

leading to:

https://github.com/STMicroelectronics/STMems_Standard_C_drivers/tree/master/lis2dw12_STdC

The driver provided here does polling, but I need an interrupt based driver.

Can someone provide an INTERRUPT BASED driver?

Thanks!

This topic has been closed for replies.

1 reply

Eleon BORLINI
ST Employee
June 11, 2020

Hi @CPeng.1​ , but you can take inspiration from, for example, this other driver lsm6ds3_read_data_interrupt.c. You have to route first the DRDY signal on INT1 pin:

/* Enable interrupt generation on DRDY INT1 pin */
 lis2dw12_pin_int1_route_get(&dev_ctx, &int_1_reg);
 int_1_reg.int1_drdy_xl = PROPERTY_ENABLE; // INT1_DRDY bit in CTRL4_INT1_PAD_CTRL (23h) register
 lis2dw12_pin_int1_route_set(&dev_ctx, &int_1_reg);

and then manage the dataout read triggering the application processor with that interrupt signal

static int32_t platform_read_int_pin(void)
{
 return HAL_GPIO_ReadPin(LIS2DW12_INT1_GPIO_PORT, LIS2DW12_INT1_PIN);
 /* Please uncomment next line if interrupt configured on INT2 pin */
 //return HAL_GPIO_ReadPin(LSM6DS3_INT2_GPIO_PORT, LSM6DS3_INT2_PIN);
}

Regards