summaryrefslogtreecommitdiffstats
path: root/keyboards/satan
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-02-15 15:07:13 +1100
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-02-14 20:07:13 -0800
commit9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55 (patch)
treedf6cfe88ce0f51ea5ca7fd6b93aae7eaed67d8a5 /keyboards/satan
parentd5bc7fc1575543eb27cffcc465a8f0c4e11b7de7 (diff)
Migrate fn_actions for default keymaps (#4935)
* Migrate fn_actions for default keymaps * Rename the Grave/Escape Shift masks * No need for shift_esc_shift_mask * Change breaks to return false * Right align pointers * Add default case * Separate cases with empty lines
Diffstat (limited to 'keyboards/satan')
-rw-r--r--keyboards/satan/keymaps/colemak/keymap.c36
-rw-r--r--keyboards/satan/keymaps/default/keymap.c34
-rw-r--r--keyboards/satan/keymaps/iso_split_rshift/keymap.c75
-rw-r--r--keyboards/satan/keymaps/poker/keymap.c34
4 files changed, 50 insertions, 129 deletions
diff --git a/keyboards/satan/keymaps/colemak/keymap.c b/keyboards/satan/keymaps/colemak/keymap.c
index d81ca08933..a772e92c7c 100644
--- a/keyboards/satan/keymaps/colemak/keymap.c
+++ b/keyboards/satan/keymaps/colemak/keymap.c
@@ -3,7 +3,7 @@
// Used for SHIFT_ESC
-#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@@ -14,6 +14,10 @@
#define _______ KC_TRNS
+enum custom_keycodes {
+ SFT_ESC = SAFE_RANGE
+};
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,-----------------------------------------------------------.
@@ -29,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------'
*/
[_BL] = LAYOUT_60_ansi(
- F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
+ SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC,KC_BSLS, \
KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O,KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \
@@ -40,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | | | | | | | | RESET|
* |-----------------------------------------------------------|
* | | | | | | | | | | | |BL-|BL+|BL |
- * |--------------------------------------------ΩΩ---------------|
+ * |-----------------------------------------------------------|
* | | | | | | | | | | | | |
* |-----------------------------------------------------------|
* | | F1|F2 | F3|F4 | F5| F6| F7| F8| | | |
@@ -64,21 +68,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#endif
};
-enum function_id {
- SHIFT_ESC,
-};
-
-const uint16_t PROGMEM fn_actions[] = {
- [0] = ACTION_FUNCTION(SHIFT_ESC),
-};
-
-void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
- static uint8_t shift_esc_shift_mask;
- switch (id) {
- case SHIFT_ESC:
- shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case SFT_ESC:
if (record->event.pressed) {
- if (shift_esc_shift_mask) {
+ if (get_mods() & MODS_SHIFT_MASK) {
add_key(KC_GRV);
send_keyboard_report();
} else {
@@ -86,7 +80,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
send_keyboard_report();
}
} else {
- if (shift_esc_shift_mask) {
+ if (get_mods() & MODS_SHIFT_MASK) {
del_key(KC_GRV);
send_keyboard_report();
} else {
@@ -94,6 +88,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
send_keyboard_report();
}
}
- break;
+
+ return false;
+
+ default:
+ return true;
}
}
diff --git a/keyboards/satan/keymaps/default/keymap.c b/keyboards/satan/keymaps/default/keymap.c
index 76bb8bfcf1..ac15dd55a1 100644
--- a/keyboards/satan/keymaps/default/keymap.c
+++ b/keyboards/satan/keymaps/default/keymap.c
@@ -1,9 +1,11 @@
#include QMK_KEYBOARD_H
-
+enum custom_keycodes {
+ SFT_ESC = SAFE_RANGE
+};
// Used for SHIFT_ESC
-#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@@ -29,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------'
*/
[_BL] = LAYOUT_60_ansi(
- F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
+ SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \
@@ -64,21 +66,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#endif
};
-enum function_id {
- SHIFT_ESC,
-};
-
-const uint16_t PROGMEM fn_actions[] = {
- [0] = ACTION_FUNCTION(SHIFT_ESC),
-};
-
-void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
- static uint8_t shift_esc_shift_mask;
- switch (id) {
- case SHIFT_ESC:
- shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case SFT_ESC:
if (record->event.pressed) {
- if (shift_esc_shift_mask) {
+ if (get_mods() & MODS_SHIFT_MASK) {
add_key(KC_GRV);
send_keyboard_report();
} else {
@@ -86,7 +78,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
send_keyboard_report();
}
} else {
- if (shift_esc_shift_mask) {
+ if (get_mods() & MODS_SHIFT_MASK) {
del_key(KC_GRV);
send_keyboard_report();
} else {
@@ -94,6 +86,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
send_keyboard_report();
}
}
- break;
+
+ return false;
+
+ default:
+ return true;
}
}
diff --git a/keyboards/satan/keymaps/iso_split_rshift/keymap.c b/keyboards/satan/keymaps/iso_split_rshift/keymap.c
index d73a01aea7..156515673c 100644
--- a/keyboards/satan/keymaps/iso_split_rshift/keymap.c
+++ b/keyboards/satan/keymaps/iso_split_rshift/keymap.c
@@ -113,36 +113,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_SFX] = LAYOUT_60_iso_split_rshift(
RESET, _______, _______, _______, _______, _______, _______, KC_7, KC_8, KC_9, _______, _______, _______, KC_BSPC, \
_______, _______, _______, _______, _______, _______, _______, KC_4, KC_5, KC_6, _______, _______, _______, \
- _______, F(2), F(3), _______, _______, _______, _______, KC_1, KC_2, KC_3, _______, _______, XXXXXXX, KC_ENT, \
- _______, F(4), F(5), F(6), F(7), F(8), F(9), _______, _______, KC_0, _______, KC_SLSH, KC_UP, _______, \
+ _______, RGB_TOG, RGB_MOD, _______, _______, _______, _______, KC_1, KC_2, KC_3, _______, _______, XXXXXXX, KC_ENT, \
+ _______, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_0, _______, KC_SLSH, KC_UP, _______, \
_______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT),
};
-enum function_id {
- LAUNCH,
- RGBLED_TOGGLE,
- RGBLED_STEP_MODE,
- RGBLED_INCREASE_HUE,
- RGBLED_DECREASE_HUE,
- RGBLED_INCREASE_SAT,
- RGBLED_DECREASE_SAT,
- RGBLED_INCREASE_VAL,
- RGBLED_DECREASE_VAL,
-};
-
-const uint16_t PROGMEM fn_actions[] = {
- [1] = ACTION_FUNCTION(LAUNCH),
- [2] = ACTION_FUNCTION(RGBLED_TOGGLE),
- [3] = ACTION_FUNCTION(RGBLED_STEP_MODE),
- [4] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
- [5] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
- [6] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
- [7] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
- [8] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
- [9] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
- [10] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ENT),
-};
-
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
@@ -160,49 +135,3 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
return MACRO_NONE;
};
-
-void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
- switch (id) {
- case RGBLED_TOGGLE:
- //led operations
- if (record->event.pressed) {
- rgblight_toggle();
- }
- break;
- case RGBLED_INCREASE_HUE:
- if (record->event.pressed) {
- rgblight_increase_hue();
- }
- break;
- case RGBLED_DECREASE_HUE:
- if (record->event.pressed) {
- rgblight_decrease_hue();
- }
- break;
- case RGBLED_INCREASE_SAT:
- if (record->event.pressed) {
- rgblight_increase_sat();
- }
- break;
- case RGBLED_DECREASE_SAT:
- if (record->event.pressed) {
- rgblight_decrease_sat();
- }
- break;
- case RGBLED_INCREASE_VAL:
- if (record->event.pressed) {
- rgblight_increase_val();
- }
- break;
- case RGBLED_DECREASE_VAL:
- if (record->event.pressed) {
- rgblight_decrease_val();
- }
- break;
- case RGBLED_STEP_MODE:
- if (record->event.pressed) {
- rgblight_step();
- }
- break;
- }
-}
diff --git a/keyboards/satan/keymaps/poker/keymap.c b/keyboards/satan/keymaps/poker/keymap.c
index b908e8c4ae..e244aced14 100644
--- a/keyboards/satan/keymaps/poker/keymap.c
+++ b/keyboards/satan/keymaps/poker/keymap.c
@@ -2,7 +2,7 @@
// Used for SHIFT_ESC
-#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@@ -16,6 +16,10 @@
#define _______ KC_TRNS
#define XXXXXXX KC_NO
+enum custom_keycodes {
+ SFT_ESC = SAFE_RANGE
+};
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,-----------------------------------------------------------.
@@ -31,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------'
*/
[_BL] = LAYOUT_60_ansi(
- F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
+ SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
@@ -89,21 +93,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
-enum function_id {
- SHIFT_ESC,
-};
-
-const uint16_t PROGMEM fn_actions[] = {
- [0] = ACTION_FUNCTION(SHIFT_ESC),
-};
-
-void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
- static uint8_t shift_esc_shift_mask;
- switch (id) {
- case SHIFT_ESC:
- shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case SFT_ESC:
if (record->event.pressed) {
- if (shift_esc_shift_mask) {
+ if (get_mods() & MODS_SHIFT_MASK) {
add_key(KC_GRV);
send_keyboard_report();
} else {
@@ -111,7 +105,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
send_keyboard_report();
}
} else {
- if (shift_esc_shift_mask) {
+ if (get_mods() & MODS_SHIFT_MASK) {
del_key(KC_GRV);
send_keyboard_report();
} else {
@@ -119,6 +113,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
send_keyboard_report();
}
}
- break;
+
+ return false;
+
+ default:
+ return true;
}
}