Created
January 15, 2022 17:54
-
-
Save tekkies/cf5ecf4c45168169c34c0abf679ca5e7 to your computer and use it in GitHub Desktop.
LIS3DSH State Machine - Trigger on sudden change in Y
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--writeLis3dsh(LIS3DSH_CTRL_REG2, 0x01) --Interrupt 1, SM2 Enable | |
writeLis3dsh(LIS3DSH_CTRL_REG2, 0x08 + 0x01) --Interrupt 2, EM2 Enable | |
writeLis3dsh(LIS3DSH_CTRL_REG3, 0x28) --data ready signal not connected, interrupt signals active LOW, interrupt signal pulsed, INT1/DRDY signal enabled, vector filter disabled, no soft reset | |
writeLis3dsh(LIS3DSH_CTRL_REG4, 0x10 + 0x00 + 0x02) --Y, data rate: 3Hz, Block data update: continuous | |
writeLis3dsh(LIS3DSH_CTRL_REG5, 0x00) --2g scale, 800hz filter | |
writeLis3dsh(LIS3DSH_THRS1_2, 1) --threshold | |
writeLis3dsh(LIS3DSH_ST2_1, 0x05) --NOP | Any/triggered axis greater than THRS1 | |
writeLis3dsh(LIS3DSH_ST2_1+1, 0x11) --Continue | |
writeLis3dsh(LIS3DSH_MASK2_B, 0x30) --Y | |
writeLis3dsh(LIS3DSH_MASK2_A, 0x30) --Y | |
writeLis3dsh(LIS3DSH_SETT2, 0x11) --DIFF input, DIFF eabled, program flow can be modified by STOP and CONT commands |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment