qmk

QMK Firmware
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

drashna.h (2838B)


      1 /*
      2 Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
      3 
      4 This program is free software: you can redistribute it and/or modify
      5 it under the terms of the GNU General Public License as published by
      6 the Free Software Foundation, either version 2 of the License, or
      7 (at your option) any later version.
      8 
      9 This program is distributed in the hope that it will be useful,
     10 but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 GNU General Public License for more details.
     13 
     14 You should have received a copy of the GNU General Public License
     15 along with this program.  If not, see <http://www.gnu.org/licenses/>.
     16 */
     17 
     18 #pragma once
     19 #include "quantum.h"
     20 #include "version.h"
     21 #include "eeprom.h"
     22 #include "wrappers.h"
     23 #include "process_records.h"
     24 #ifdef TAP_DANCE_ENABLE
     25 #    include "tap_dances.h"
     26 #endif  // TAP_DANCE_ENABLE
     27 #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
     28 #    include "rgb_stuff.h"
     29 #endif
     30 
     31 /* Define layer names */
     32 enum userspace_layers {
     33     _QWERTY  = 0,
     34     _NUMLOCK = 0,
     35     _COLEMAK,
     36     _DVORAK,
     37     _WORKMAN,
     38     _NORMAN,
     39     _MALTRON,
     40     _EUCALYN,
     41     _CARPLAX,
     42     _MODS, /* layer 8 */
     43     _GAMEPAD,
     44     _DIABLO,
     45     _MACROS,
     46     _MEDIA,
     47     _LOWER,
     48     _RAISE,
     49     _ADJUST,
     50 };
     51 
     52 /*
     53 define modifiers here, since MOD_* doesn't seem to work for these
     54  */
     55 
     56 bool          mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
     57 bool          mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
     58 bool          send_game_macro(const char *str, keyrecord_t *record, bool override);
     59 void          matrix_init_keymap(void);
     60 void          shutdown_keymap(void);
     61 void          suspend_power_down_keymap(void);
     62 void          suspend_wakeup_init_keymap(void);
     63 void          matrix_scan_keymap(void);
     64 layer_state_t layer_state_set_keymap(layer_state_t state);
     65 layer_state_t default_layer_state_set_keymap(layer_state_t state);
     66 void          led_set_keymap(uint8_t usb_led);
     67 void          eeconfig_init_keymap(void);
     68 
     69 typedef union {
     70     uint32_t raw;
     71     struct {
     72         bool    rgb_layer_change    :1;
     73         bool    is_overwatch        :1;
     74         bool    nuke_switch         :1;
     75         uint8_t unicode_mod         :4;
     76         bool    swapped_numbers     :1;
     77     };
     78 } userspace_config_t;
     79 
     80 extern userspace_config_t userspace_config;
     81 
     82 /*
     83 Custom Keycodes for Diablo 3 layer
     84 But since TD() doesn't work when tap dance is disabled
     85 We use custom codes here, so we can substitute the right stuff
     86 */
     87 #ifdef TAP_DANCE_ENABLE
     88 #    define KC_D3_1 TD(TD_D3_1)
     89 #    define KC_D3_2 TD(TD_D3_2)
     90 #    define KC_D3_3 TD(TD_D3_3)
     91 #    define KC_D3_4 TD(TD_D3_4)
     92 #else  // TAP_DANCE_ENABLE
     93 #    define KC_D3_1 KC_1
     94 #    define KC_D3_2 KC_2
     95 #    define KC_D3_3 KC_3
     96 #    define KC_D3_4 KC_4
     97 #endif  // TAP_DANCE_ENABLE