/* in action.c */ static int get_action_worker(int context, int timeout, const struct button_mapping* (*get_context_map)(int) ) { /* .... */ #ifndef HAS_BUTTON_HOLD /* ... */ #else /*< new code ! */ static bool last_hold_state = false; bool new_hold_state = button_hold(); if(last_hold_state != new_hold_state) { touchdev_enable(!new_hold_state); last_hold_state = new_hold_state; } #endif /* ... */ }