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);
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);
供参考
一周热门 更多>