找牛人有偿购买stm32的ADXL362双击检测代码

2019-12-18 18:51发布

本帖最后由 lzs21802180 于 2015-5-22 00:04 编辑

要求,1、FIFO中断读XYZ三轴加速度值,
        2、分析读到的加速度值计算出双击,
        3、代码要在低功耗下运行

牛人请联系QQ:351426889
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
maxwelllls
2019-12-19 00:43
buf[0] = XL345_RATE_50;    //Output Data Rate: 50Hz
xl345Write(1, XL345_BW_RATE, buf);

buf[0] = XL345_FULL_RESOLUTION;  //Data Format: +/-16g range, right justified,  256->1g
xl345Write(1, XL345_DATA_FORMAT, buf);

buf[0] = XL345_TAP_X_ENABLE | XL345_TAP_Y_ENABLE | XL345_TAP_Z_ENABLE;  //Enable Z Axis Tap Detection
xl345Write(1, XL345_TAP_AXES, buf);

buf[0] = 0x20;      //Tap Threshold:2G, 62.5mg/LSB
xl345Write(1, XL345_THRESH_TAP, buf);

buf[0] = 0x50;  //Dur:50ms, 625us/LSB, representing the maximum time
      //that an event must be above the THRESH_TAP threshold to qualify as a tap event
xl345Write(1, XL345_DUR, buf);

buf[0] = 0x20;  //Latent: 40ms, 1.25ms/LSB, interval between the first tap and the second tap
xl345Write(1, XL345_LATENT, buf);

buf[0] = 0xF0;  //Window: 300ms, 1.25ms/LSB, time window for a possible second tap event
xl345Write(1, XL345_WINDOW, buf);

buf[0] = XL345_SINGLETAP | XL345_DOUBLETAP; //INT_Enable: SINGLE TAP & DOUBLE TAP
xl345Write(1, XL345_INT_ENABLE, buf);

buf[0] = XL345_SINGLETAP | XL345_DOUBLETAP; //INT_Map: SINGLE TAP& DOUBLE TAP interrupt to INT2 pin, DOUBLE TAP interrupt to INT1 pin
xl345Write(1, XL345_INT_MAP, buf);

buf[0] = XL345_MEASURE;   //Power CTL: Measure mode
xl345Write(1, XL345_POWER_CTL, buf);
供参考

一周热门 更多>