I am having some difficulties in configuring the Double Click Interrupt on the LIS2DH12.
After power up, I am doing the following:
TEMP_CFG_REG = 0xC0
CTRL_REG4 = 0x80
CTRL_REG1 = 0x77
The above seems to work and provides sensible values for xyz axis when the PCB is at various angles. This suggests that the I2C bus is functioning correctly.
Next I would like to enable click detection in the y- axis (any axis would do to start to prove the function works). I would like an interrupt on INT1 when a double click has occurred. INT1 is pulled up to 3.3 V via a 100 kOhm resistor.
I am doing the following in order to configure the Double Click feature
CTRL_REG3 = 0x80
CLICK_CFG = 0x08
CLICK_THS = 0x88
TIME_LIMIT = 0xFF //Not really sure the purpose of this, the datasheet is not really clear
TIME_LATENCY = 0xFF //Not really sure the purpose of this, the datasheet is not really clear
TIME_WINDOW = 0xFF //Not really sure the purpose of this, the datasheet is not really clear
All other registers are left at their default values.
I am then reading the CLICK_SRC register in a loop. I am checking to see if bit 6 is a 1, which indicates that an interrupt has occurred.
Looking at the INT1 pin on the scope, it appears to be toggling. I understand that the INT1 will switch after CKICK_SRC is read, however the value read back indicates that no double (or single) click interrupt has occurred. Looking at the datasheet I also thought that all the other interrupts were disabled by default.
If anyone has any suggestions or thoughts or even a working basic configuration, it would be much appreciated.