Reapply "Added double-tap capabilities to LIS2DW"

This reverts commit 3bd1254b5f.
This commit is contained in:
David Volovskiy
2025-12-01 20:14:54 -05:00
parent eb3f02419e
commit 23038c3f74
3 changed files with 21 additions and 2 deletions

View File

@@ -514,7 +514,7 @@ bool movement_enable_tap_detection_if_available(void) {
if (movement_state.has_lis2dw) {
// configure tap duration threshold and enable Z axis
lis2dw_configure_tap_threshold(0, 0, 12, LIS2DW_REG_TAP_THS_Z_Z_AXIS_ENABLE);
lis2dw_configure_tap_duration(10, 2, 2);
lis2dw_configure_tap_duration(2, 2, 2);
// ramp data rate up to 400 Hz and high performance mode
lis2dw_set_low_noise_mode(true);
@@ -526,7 +526,7 @@ bool movement_enable_tap_detection_if_available(void) {
delay_ms(3);
// enable tap detection on INT1/A3.
lis2dw_configure_int1(LIS2DW_CTRL4_INT1_SINGLE_TAP | LIS2DW_CTRL4_INT1_6D);
lis2dw_configure_int1(LIS2DW_CTRL4_INT1_SINGLE_TAP | LIS2DW_CTRL4_INT1_DOUBLE_TAP);
return true;
}
@@ -540,6 +540,7 @@ bool movement_disable_tap_detection_if_available(void) {
lis2dw_set_low_noise_mode(false);
lis2dw_set_data_rate(movement_state.accelerometer_background_rate);
lis2dw_set_mode(LIS2DW_MODE_LOW_POWER);
lis2dw_disable_double_tap();
// ...disable Z axis (not sure if this is needed, does this save power?)...
lis2dw_configure_tap_threshold(0, 0, 0, 0);