English
Language : 

AN2960 Datasheet, PDF (35/41 Pages) STMicroelectronics – ultra compact linear accelerometer
AN2960
Application information
The FF_WU_CFG(LIR) bit permits the determination of whether or not the interrupt request
should be latched. If the LIR bit is ‘0’ (default value), the interrupt signal goes high when the
interrupt condition is satisfied and comes back low immediately if the interrupt condition is
no longer verified. Otherwise, if the LIR bit is ‘1’, whenever an interrupt condition is applied
the interrupt signal remains high even if the condition returns to a non-interrupt status, until
a reading to the FF_WU_SRC register is performed.
The remaining bits of the FF_WU_CFG register allow the decision as to which axis the
interrupt should be performed on and in which direction the threshold must be exceeded to
generate the interrupt request.
9.5
9.5.1
Inertial wake-up
HP filter bypassed
This paragraph provides a basic algorithm which shows the practical use of the inertial
wake-up feature. In particular, with the code below, the device is configured to recognize
when the absolute acceleration along either X or Y axis exceeds a preset threshold (180 mg
is used in the example). The event which triggers the interrupt is latched inside the device
using FF_WU interrupt source 1 and its occurrence is signalled through the use of the INT2
pin.
1 write C7h into CTRL_REG1
// Turn-on the sensor and set ODR=400Hz
2 write 00h into CTRL_REG2
// Default value: high-pass filter bypassed
3 write 08h into CTRL_REG3
// FF_WU1 interrupt sent to INT2 pin
4 write 0Ah into FF_WU_THS_1 reg
// Set wake-up threshold = 180 mg
5 write 00h into FF_WU_DURATION_1 reg
// No filtering/confirmation on the event
6 write 4Ah into FF_WU_CFG_1
// Configure desired wake-up event
7 poll INT2 pin; if INT2=0 then goto 7
// Poll INT2 pin waiting for the wake-up event
8 read FF_WU_SRC_1 reg
// Return the event that has triggered the
interrupt
// Clear interrupt request
9
(Wake-up event has occurred; insert your code
here)
// Event handling
10 goto 7
Doc ID 15557 Rev 1
35/41