]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - layouts/community/ortho_4x12/jotix/keymap.c
[Keymap] Update Jotix keymap (#6154)
[qmk_firmware.git] / layouts / community / ortho_4x12 / jotix / keymap.c
index 02fc79ec7fd25857c76ef0cd1c7e2d9242628cc1..e5f539181e25ee6f5470aa4a51b97daf0055db9d 100644 (file)
@@ -1,34 +1,31 @@
-// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
-// this is the style you want to emulate.
-
 #include QMK_KEYBOARD_H
 
 extern keymap_config_t keymap_config;
 
-// 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.
-// Layer names don't all need to be of the same length, obviously, and you can also skip them
-// entirely and just use numbers.
+enum layers {
+    _QWERTY,
+    _LOWER,
+    _RAISE,
+};
 
-#define _QWERTY   0
-#define _LOWER    1
-#define _RAISE    2
-#define _ADJUST   3
+#define LOWER TT(_LOWER)
+#define RAISE TT(_RAISE)
 
-#define LOWER MO(_LOWER)
-#define RAISE MO(_RAISE)
+static bool is_ctl_pressed;
+static bool is_esc_pressed;
+static bool is_bspc_pressed;
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
-/* Qwerty
+/* qwerty
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |   esc  |    Q   |    W   |    E   |    R   |    T   |    Y   |    U   |    I   |    O   |    P   |  bksp  |
+ * |   esc  |    Q   |    W   |    E   |    R   |    T   |    Y   |    U   |    I   |    O   |    P   |  bspc  |
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  * |   tab  |    A   |    S   |    D   |    F   |    G   |    H   |    J   |    K   |    L   |    ;   |    '   |
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  * | lshift |    Z   |    X   |    C   |    V   |    B   |    N   |    M   |    ,   |    .   |    /   |  enter |
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |  lctrl |  lgui  |  lalt  |  ralt  |  lower |  space |  space |  raise |  left  |  down  |   up   |  right | 
+ * |  lctrl |  lgui  |  lalt  |  ralt  |  lower |  space |  space |  raise |  right |  down  |   up   |  right | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  */
 [_QWERTY] = LAYOUT_ortho_4x12 ( 
@@ -38,33 +35,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     KC_LCTL, KC_LGUI, KC_LALT, KC_RALT, LOWER,   KC_SPC,  KC_SPC,  RAISE,   KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT
 ),
 
-/* Lower
+/* lower
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |    `   |    1   |    2   |    3   |    4   |    5   |    6   |    7   |    8   |    9   |    0   |        |
+ * |    `   |    1   |    2   |    3   |    4   |    5   |    6   |    7   |    8   |    9   |    0   |        | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |        |    -   |    =   |    [   |    ]   |    \   |        |        |        |        |        |        |
+ * |        |  vol-  |  mute  |  vol+  |        |        |        |        |        |        |        |        | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |        |  vol-  |  mute  |  vol+  |        |        |        |        |        |        |        |        |
+ * |        |  prev  |  play  |  next  |        |        |        |        |        |        |        |        | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |        |        |        |        |        |        |        |        |        |        |        |        |
+ * |        |        |        |        |        |        |        |        |        |        |        |        | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  */
 [_LOWER] = LAYOUT_ortho_4x12 (
-     KC_GRV,  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_LBRC, KC_RBRC, KC_BSLS, _______, _______, _______, _______, _______, _______,
-     _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
-     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+    KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    _______,
+    _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______,
+    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
 ),
 
-/* Raise
+/* raise
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |    ~   |    !   |    @   |    #   |    $   |    %   |    ^   |    &   |    *   |    (   |    )   |   del  |
+ * |    ~   |    !   |    @   |    #   |    $   |    %   |    ^   |    &   |    *   |    (   |    )   |   del  | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |  caps  |   F1   |   F2   |   F3   |   F4   |   F5   |   F6   |    -   |    =   |    [   |    ]   |    \   |
+ * |  caps  |   F1   |   F2   |   F3   |   F4   |   F5   |   F6   |    -   |    =   |    [   |    ]   |    \   | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |        |   F7   |   F8   |   F9   |   F10  |   F11  |   F12  |    _   |    +   |    {   |    }   |    |   |
+ * |        |   F7   |   F8   |   F9   |   F10  |   F11  |   F12  |    _   |    +   |    {   |    }   |    |   | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
- * |        |        |        |        |        |        |        |        |  home  |  pgdn  |  pgun  |   end  |
+ * |        |        |        |        |        |        |        |        |  home  |  pgdn  |  pgup  |   end  | 
  * +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  */
 [_RAISE] = LAYOUT_ortho_4x12 (
@@ -74,19 +71,45 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
 ),
 
-/* Adjust */
-[_ADJUST] = LAYOUT_ortho_4x12 (
-    _______, RESET,   _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______,
-    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
-    _______, _______, _______, _______, _______, BL_STEP, BL_BRTG, _______, _______, _______, _______, _______,
-    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
-),    
 };
 
 uint32_t layer_state_set_user(uint32_t state) {
-  return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
+  #ifdef JOTANCK_LEDS
+  switch (biton32(state)) { 
+  case _LOWER:
+    writePinHigh(JOTANCK_LED1);
+    writePinLow(JOTANCK_LED2);
+    break;
+  case _RAISE:
+    writePinLow(JOTANCK_LED1);
+    writePinHigh(JOTANCK_LED2);
+    break;
+  default:
+    writePinLow(JOTANCK_LED1);
+    writePinLow(JOTANCK_LED2);
+    break; 
+  };
+  #endif
+  return state;
 }
 
-void matrix_init_user(void) {
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+  switch (keycode) {
+    case KC_LCTL:
+      is_ctl_pressed = record->event.pressed;
+      break;
+    case KC_ESC:
+      is_esc_pressed = record->event.pressed;
+      break;
+    case KC_BSPC:
+      is_bspc_pressed = record->event.pressed;
+      break;
+  };
+  return true;
 }
 
+void matrix_scan_user(void) {
+  if (is_ctl_pressed && is_esc_pressed && is_bspc_pressed) {
+    reset_keyboard();
+  }
+}