qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

keymap.c (2055B)


      1 /* Copyright 2019 Stanrc85
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 2 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15  */
     16 
     17 #include QMK_KEYBOARD_H
     18 #include "stanrc85.h"
     19 
     20 enum keys {
     21   U_LAYR = SAFE_RANGE,
     22   D_LAYR
     23 };
     24 
     25 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     26   [_NUMPAD] = LAYOUT(
     27 	KC_7,   KC_8, KC_9,
     28 	KC_4,   KC_5, KC_6,
     29 	KC_1,   KC_2, KC_3,
     30 	U_LAYR, KC_0, KC_ENT),
     31 
     32   [_NAVKEY] = LAYOUT(
     33 	KC_HOME, KC_INS,  KC_PGUP,
     34 	KC_END,  KC_UP,   KC_PGDN,
     35 	KC_LEFT, KC_DOWN, KC_RGHT,
     36 	U_LAYR,  TD_TWIN, D_LAYR),
     37 
     38   [_MEDIA] = LAYOUT(
     39 	KC_MUTE, KC_VOLD, KC_VOLU,
     40 	CA_QUOT, KC_MPLY, CA_SCLN,
     41 	CA_COPY, CA_PSTE, KC_NO,
     42 	U_LAYR,  KC_NO,   D_LAYR),
     43 
     44   [_RGB] = LAYOUT(
     45 	RGB_SAI, RGB_VAI, RGB_HUI,
     46 	RGB_SAD, RGB_VAD, RGB_HUD,
     47 	RGB_TOG, RGB_MOD, KC_NO,
     48 	U_LAYR,  KC_NO,   D_LAYR),
     49 
     50   [_FN1PAD] = LAYOUT(
     51 	KC_NO, KC_NO,   KC_NO,
     52 	KC_NO, KC_NO,   RESET,
     53 	KC_NO, KC_NO,   KC_MAKE,
     54 	KC_NO, KC_LSFT, D_LAYR)
     55 };
     56 
     57 bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
     58   keypos_t key;
     59   uint8_t current_layer;
     60   uint8_t next_layer;
     61   switch (keycode) {
     62   case U_LAYR: //cycles up the layers
     63     if (!record->event.pressed) {
     64       current_layer = layer_switch_get_layer(key);
     65       next_layer = current_layer+1;
     66       layer_move(next_layer);
     67     }
     68     break;
     69   case D_LAYR: //cycles down the layers
     70     if (!record->event.pressed) {
     71       current_layer = layer_switch_get_layer(key);
     72       next_layer = current_layer-1;
     73       layer_move(next_layer);
     74     }
     75     break;
     76   }
     77   return true;
     78 };