+
+/* id for user defined functions */
+enum function_id {
+ LSHIFT_LPAREN,
+ RSHIFT_RPAREN,
+};
+
+enum macro_id {
+ LSHIFT_PAREN,
+ RSHIFT_PAREN,
+ HELLO,
+};
+
+
+/*
+ * Fn action definition
+ */
+static const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_DEFAULT_LAYER, // Default layer(not used)
+// [1] = ACTION_KEYMAP(1), // HHKB layer
+ [1] = ACTION_KEYMAP_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
+ [2] = ACTION_KEYMAP_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
+ [3] = ACTION_KEYMAP_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
+ [4] = ACTION_RMOD_TAP_KEY(KC_RCTL, KC_ENT), // RControl with tap Enter*
+ [5] = ACTION_LMOD_ONESHOT(KC_LSFT), // Oneshot Shift*
+// [6] = ACTION_KEYMAP_TAP_KEY(4, KC_SPC), // Half-qwerty layer with Space
+ [6] = ACTION_KEYMAP_TAP_KEY(5, KC_SPC), // Mousekey layer with Space
+// [7] = ACTION_KEYMAP(3), // Mousekey layer
+ [7] = ACTION_KEYMAP_TOGGLE(3), // Mousekey layer(toggle)
+
+// [8] = ACTION_LMOD_TAP_KEY(KC_LCTL, KC_BSPC), // LControl with tap Backspace
+// [9] = ACTION_LMOD_TAP_KEY(KC_LCTL, KC_ESC), // LControl with tap Esc
+// [11] = ACTION_FUNCTION_TAP(LSHIFT_LPAREN), // Function: LShift with tap '('
+// [12] = ACTION_FUNCTION_TAP(RSHIFT_RPAREN), // Function: RShift with tap ')'
+// [13] = ACTION_MACRO_TAP(LSHIFT_PAREN), // Macro: LShift with tap '('
+// [14] = ACTION_MACRO_TAP(RSHIFT_PAREN), // Macro: RShift with tap ')'
+// [15] = ACTION_MACRO(HELLO), // Macro: say hello
+};
+
+
+/*
+ * Macro definition
+ */
+const prog_macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ keyevent_t event = record->event;
+ tap_t tap = record->tap;
+
+ switch (id) {
+ case LSHIFT_PAREN:
+ if (tap.count > 0 && !tap.interrupted) {
+ return (event.pressed ?
+ MACRO( MD(LSHIFT), D(9), U(9), MU(LSHIFT), END ) : MACRO_NONE);
+ } else {
+ return (event.pressed ?
+ MACRO( MD(LSHIFT), END ) : MACRO( MU(LSHIFT), END ) );
+ }
+ case RSHIFT_PAREN:
+ if (tap.count > 0 && !tap.interrupted) {
+ return (event.pressed ?
+ MACRO( MD(RSHIFT), D(0), U(0), MU(RSHIFT), END ) : MACRO_NONE);
+ } else {
+ return (event.pressed ?
+ MACRO( MD(RSHIFT), END ) : MACRO( MU(RSHIFT), END ) );
+ }
+ case HELLO:
+ return (event.pressed ?
+ MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
+ MACRO_NONE );
+ }
+ return MACRO_NONE;
+}
+
+
+
+/*
+ * user defined action function
+ */
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)