We will want to disable it in the countdown face.
movement_state.alarm_enabled = value;
}
-bool movement_enable_tap_detection_if_available(void) {
+bool movement_enable_tap_detection_if_available(bool enable_double_tap) {
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_set_low_noise_mode(true);
lis2dw_set_data_rate(LIS2DW_DATA_RATE_HP_400_HZ);
lis2dw_set_mode(LIS2DW_MODE_LOW_POWER);
- lis2dw_enable_double_tap();
+
+ if (enable_double_tap) {
+ lis2dw_enable_double_tap();
+ }
// Settling time (1 sample duration, i.e. 1/400Hz)
delay_ms(3);
// enable tap detection on INT1/A3.
- lis2dw_configure_int1(LIS2DW_CTRL4_INT1_SINGLE_TAP | LIS2DW_CTRL4_INT1_DOUBLE_TAP);
+ uint8_t int1_sources = LIS2DW_CTRL4_INT1_SINGLE_TAP;
+ if (enable_double_tap) {
+ int1_sources |= LIS2DW_CTRL4_INT1_DOUBLE_TAP;
+ }
+ lis2dw_configure_int1(int1_sources);
return true;
}
void movement_set_alarm_enabled(bool value);
// if the board has an accelerometer, these functions will enable or disable tap detection.
-bool movement_enable_tap_detection_if_available(void);
+bool movement_enable_tap_detection_if_available(bool enable_double_tap);
bool movement_disable_tap_detection_if_available(void);
// gets and sets the accelerometer data rate in the background
{\r
case BJ_TITLE_SCREEN:\r
if (!tap_turned_on && tap_control_on) {\r
- if (movement_enable_tap_detection_if_available()) tap_turned_on = true;\r
+ if (movement_enable_tap_detection_if_available(true)) tap_turned_on = true;\r
}\r
begin_playing(tap_control_on);\r
break;\r
state->tap_control_on = false;\r
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);\r
} else {\r
- bool tap_could_enable = movement_enable_tap_detection_if_available();\r
+ bool tap_could_enable = movement_enable_tap_detection_if_available(true);\r
if (tap_could_enable) {\r
state->tap_control_on = true;\r
watch_set_indicator(WATCH_INDICATOR_SIGNAL);\r
movement_request_tick_frequency(1);
quick_ticks_running = false;
- if (state->mode != cd_running && movement_enable_tap_detection_if_available()) {
+ if (state->mode != cd_running && movement_enable_tap_detection_if_available(true)) {
state->tap_detection_ticks = TAP_DETECTION_SECONDS;
state->has_tapped_once = false;
}
static void enable_tap_control(endless_runner_state_t *state) {
if (!state->tap_control_on) {
- movement_enable_tap_detection_if_available();
+ movement_enable_tap_detection_if_available(true);
state->tap_control_on = true;
}
}
static void enable_tap_control(ping_state_t *state) {
if (!state->tap_control_on) {
- movement_enable_tap_detection_if_available();
+ movement_enable_tap_detection_if_available(true);
state->tap_control_on = true;
}
}
movement_request_tick_frequency(1);
// Enable tap detection for a few seconds when face is activated
- if (movement_enable_tap_detection_if_available()) {
+ if (movement_enable_tap_detection_if_available(true)) {
state->tap_detection_ticks = TAP_DETECTION_SECONDS;
}
}