diff options
author | Ben V. Brown <[email protected]> | 2017-07-27 20:29:17 +1000 |
---|---|---|
committer | Ben V. Brown <[email protected]> | 2017-07-27 20:29:17 +1000 |
commit | 535a1b3aa9641f6c7fc3c41465fa240612b99d9f (patch) | |
tree | 0444820b8efe851e6c4a162a96a3f0abbc4d7445 /workspace | |
parent | 5a26bf413ad951129097afbbc5b1aa47ba70c7e6 (diff) | |
download | IronOS-535a1b3aa9641f6c7fc3c41465fa240612b99d9f.tar.gz IronOS-535a1b3aa9641f6c7fc3c41465fa240612b99d9f.zip |
Making the auto-flip less sensitive #34v1.16.1
Diffstat (limited to 'workspace')
-rw-r--r-- | workspace/ts100/src/MMA8652FC.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/workspace/ts100/src/MMA8652FC.c b/workspace/ts100/src/MMA8652FC.c index 06552b94..26d300cb 100644 --- a/workspace/ts100/src/MMA8652FC.c +++ b/workspace/ts100/src/MMA8652FC.c @@ -44,12 +44,15 @@ void StartUp_Accelerometer(uint8_t sensitivity) { I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
delayMs(2); // ~1ms delay
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
- uint8_t sens = 9 * 7 + 5;
- sens -= 7 * sensitivity;
+ uint8_t sens = 9 * 6 + 5;
+ sens -= 6 * sensitivity;
I2C_RegisterWrite(FF_MT_THS_REG, 0x80 | sens); // Set threshold
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x02); // Set debounce to 100ms
I2C_RegisterWrite(PL_CFG_REG, 0x40); //Enable the orientation detection
+ I2C_RegisterWrite(PL_COUNT_REG, 200); //200 count debounce
+ I2C_RegisterWrite(PL_BF_ZCOMP_REG, 0b01000111); //Set the threshold to 42 degrees
+ I2C_RegisterWrite(P_L_THS_REG, 0b10011100);//Up the trip angles
I2C_RegisterWrite( CTRL_REG4, 0x04); // Enable motion interrupt
I2C_RegisterWrite( CTRL_REG5, 0x04);// Route motion interrupts to INT1 ->PB5 ->EXTI5
I2C_RegisterWrite( CTRL_REG1, 0x11); // ODR=800 Hz, Active mode
|