drivers: sensor: ism330dhcx: fix pulse mode interrupts

On my end, the ISM330DHCX was stopping working after a few seconds.

After investigation, it seems that the function used to set the device
in pulse mode only works for special modes like tap and embedded functions
and not for data-ready as intended.

The data-ready was then in the default latched mode which does not work
sustainably with the rest of the driver logic. In this mode, the driver
can miss an interrupt and be forever waiting on a new data-ready pulse
which will never happen as the interrupt line is already active.

This calls the correct function to enable pulsed data-ready mode as
described in the datasheet section 9.7 COUNTER_BDR_REG1 (0Bh).

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
This commit is contained in:
Francois Gervais 2023-06-11 08:42:57 -04:00 committed by Maureen Helm
commit 96a887809c

View file

@ -283,8 +283,8 @@ int ism330dhcx_init_interrupt(const struct device *dev)
}
/* enable interrupt on int1/int2 in pulse mode */
if (ism330dhcx_int_notification_set(ism330dhcx->ctx,
ISM330DHCX_ALL_INT_PULSED) < 0) {
if (ism330dhcx_data_ready_mode_set(ism330dhcx->ctx,
ISM330DHCX_DRDY_PULSED) < 0) {
LOG_ERR("Could not set pulse mode");
return -EIO;
}