]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
Add NO_ACTION_TAPPING and NO_ACTION_MACRO config options
authortmk <nobody@nowhere>
Tue, 19 Mar 2013 15:28:13 +0000 (00:28 +0900)
committertmk <nobody@nowhere>
Tue, 19 Mar 2013 15:28:13 +0000 (00:28 +0900)
common/action.c
common/action_macro.c
common/action_macro.h
keyboard/gh60/config.h

index 1b84d1e884c7185c61ed514303225b179d5b7d62..eda3a6d328fe09c6157472d95c2b940379f3eee9 100644 (file)
@@ -30,14 +30,18 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 static void process_action(keyrecord_t *record);
+#ifndef NO_ACTION_TAPPING
 static bool process_tapping(keyrecord_t *record);
 static void waiting_buffer_scan_tap(void);
+#endif
 
 static void debug_event(keyevent_t event);
 static void debug_record(keyrecord_t record);
 static void debug_action(action_t action);
+#ifndef NO_ACTION_TAPPING
 static void debug_tapping_key(void);
 static void debug_waiting_buffer(void);
+#endif
 
 
 /*
@@ -53,6 +57,7 @@ static void debug_waiting_buffer(void);
 #define TAPPING_TOGGLE  5
 #endif
 
+#ifndef NO_ACTION_TAPPING
 /* stores a key event of current tap. */
 static keyrecord_t tapping_key = {};
 
@@ -158,7 +163,7 @@ static void oneshot_toggle(void)
 {
     oneshot_state.disabled = !oneshot_state.disabled;
 }
-
+#endif
 
 
 void action_exec(keyevent_t event)
@@ -170,6 +175,7 @@ void action_exec(keyevent_t event)
 
     keyrecord_t record = { .event = event };
 
+#ifndef NO_ACTION_TAPPING
     // pre-process on tapping
     if (process_tapping(&record)) {
         if (!IS_NOEVENT(record.event)) {
@@ -202,6 +208,12 @@ void action_exec(keyevent_t event)
     if (!IS_NOEVENT(event)) {
         debug("\n");
     }
+#else
+    process_action(&record);
+    if (!IS_NOEVENT(record.event)) {
+        debug("processed: "); debug_record(record); debug("\n");
+    }
+#endif
 }
 
 static void process_action(keyrecord_t *record)
@@ -244,6 +256,7 @@ static void process_action(keyrecord_t *record)
                 }
             }
             break;
+#ifndef NO_ACTION_TAPPING
         case ACT_LMODS_TAP:
         case ACT_RMODS_TAP:
             {
@@ -319,10 +332,11 @@ static void process_action(keyrecord_t *record)
                 }
             }
             break;
+#endif
 
+#ifdef EXTRAKEY_ENABLE
         /* other HID usage */
         case ACT_USAGE:
-#ifdef EXTRAKEY_ENABLE
             switch (action.usage.page) {
                 case PAGE_SYSTEM:
                     if (event.pressed) {
@@ -339,12 +353,12 @@ static void process_action(keyrecord_t *record)
                     }
                     break;
             }
-#endif
             break;
+#endif
 
+#ifdef MOUSEKEY_ENABLE
         /* Mouse key */
         case ACT_MOUSEKEY:
-#ifdef MOUSEKEY_ENABLE
             if (event.pressed) {
                 mousekey_on(action.key.code);
                 mousekey_send();
@@ -352,8 +366,8 @@ static void process_action(keyrecord_t *record)
                 mousekey_off(action.key.code);
                 mousekey_send();
             }
-#endif
             break;
+#endif
 
         case ACT_KEYMAP:
             switch (action.layer.code) {
@@ -687,6 +701,7 @@ static void process_action(keyrecord_t *record)
     }
 }
 
+#ifndef NO_ACTION_TAPPING
 /* Tapping
  *
  * Rule: Tap key is typed(pressed and released) within TAPPING_TERM.
@@ -881,6 +896,7 @@ static void waiting_buffer_scan_tap(void)
         }
     }
 }
+#endif
 
 
 
@@ -908,6 +924,7 @@ void register_code(uint8_t code)
         // TODO: should push command_proc out of this block?
         if (command_proc(code)) return;
 
+#ifndef NO_ACTION_TAPPING
         if (oneshot_state.mods && oneshot_state.ready && !oneshot_state.disabled) {
             uint8_t tmp_mods = host_get_mods();
             host_add_mods(oneshot_state.mods);
@@ -916,7 +933,9 @@ void register_code(uint8_t code)
 
             host_set_mods(tmp_mods);
             oneshot_state.ready = false;
-        } else {
+        } else 
+#endif
+        {
             host_add_key(code);
             host_send_keyboard_report();
         }
@@ -1064,6 +1083,7 @@ static void debug_action(action_t action)
     debug_hex8(action.kind.param & 0xff);
     debug("]");
 }
+#ifndef NO_ACTION_TAPPING
 static void debug_tapping_key(void)
 {
     debug("TAPPING_KEY="); debug_record(tapping_key); debug("\n");
@@ -1076,3 +1096,4 @@ static void debug_waiting_buffer(void)
     }
     debug("}\n");
 }
+#endif
index ca7ffa822db7c103a5c552f549dafe422969713f..6d81a1efb46415619fc0fb90076c477819f9c86b 100644 (file)
@@ -20,6 +20,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "action_macro.h"
 
 
+#ifndef NO_ACTION_MACRO
+
 #define MACRO_READ()  (macro = pgm_read_byte(macro_p++))
 void action_macro_play(const prog_macro_t *macro_p)
 {
@@ -64,3 +66,4 @@ void action_macro_play(const prog_macro_t *macro_p)
         { uint8_t ms = interval; while (ms--) _delay_ms(1); }
     }
 }
+#endif
index db657795904f6d3ec3ccf598ca28f4ec6a73d989..ee5c7c4266db059946540e7d0789e82d1f000e57 100644 (file)
@@ -28,7 +28,11 @@ typedef uint8_t macro_t;
 typedef macro_t prog_macro_t PROGMEM;
 
 
+#ifndef NO_ACTION_MACRO
 void action_macro_play(const prog_macro_t *macro);
+#else
+#define action_macro_play(macro)
+#endif
 
 
 
index bb4277ae669ee2bbc7041a9fd83eed564f123323..bf5807644202ebaef60104d9ec5983abadcadbca 100644 (file)
@@ -62,5 +62,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //#define NO_PRINT
 
 #define NO_ACTION_OVERLAY
+#define NO_ACTION_TAPPING
+#define NO_ACTION_MACRO
 
 #endif