2019-02-04 09:28 AM
This example describes how to set up a finite state machine to enable the built-in detection of a SHAKE action along x-axis. The picture here below shows the steps of the dedicated FSM. SHAKE FSM allows you to check when a double shake event is detected on x-axis, for example for wake up purposes on smartphone devices. In attachment you can find the state machine code to upload on your Unico tool.
Input data are the axl output stream (select ODR >= 26Hz)
Masks selects as interesting orientation axis the x axis value in both directions (MASK_A=C0) and the overall resultant (MASK_B=0x02)
Thresholds are set to -1.6g (T1), -1.6g (T2), 1.2g (T3)
Timeout have been selected and tuned as 640ms and 200ms (T3 and T4)
Output is an interrupt when a shake on x-axis is detected
Enjoy!
Link: https://www.st.com/content/ccc/resource/technical/document/application_note/group0/56/95/d6/a1/34/4c/49/6d/DM00517282/files/DM00517282.pdf/jcr:content/translations/en.DM00517282.pdf