2017-03-15 20:42:54 +00:00
|
|
|
#include "atreus62.h"
|
2017-03-07 16:44:58 +00:00
|
|
|
|
|
|
|
// Layers
|
2017-03-16 00:32:58 +00:00
|
|
|
#define QWERTY 0
|
|
|
|
#define DVORAK 1
|
|
|
|
#define RAISE 2
|
2017-05-31 14:34:44 +00:00
|
|
|
#define LOWER 3
|
2017-06-01 02:16:21 +00:00
|
|
|
#define NAV 4
|
2017-03-07 16:44:58 +00:00
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
2017-03-17 13:11:20 +00:00
|
|
|
[QWERTY] = KC_KEYMAP(
|
|
|
|
NO, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, NO, \
|
|
|
|
NO, Q, W, E, R, T, Y, U, I, O, P, NO, \
|
|
|
|
NO, A, S, D, F, G, H, J, K, L, SCLN, NO, \
|
|
|
|
NO, Z, X, C, V, B, N, M, COMM, DOT, SLSH, NO, \
|
2017-05-31 14:34:44 +00:00
|
|
|
NO, FN2, LALT, LCTL, FN1, FN3, BSPC, ENT, SPC, FN0, LGUI, LEFT, RGHT, NO ),
|
2017-03-07 16:44:58 +00:00
|
|
|
|
2017-03-17 13:11:20 +00:00
|
|
|
[DVORAK] = KC_KEYMAP(
|
|
|
|
NO, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, NO, \
|
|
|
|
NO, QUOT, COMM, DOT, P, Y, F, G, C, R, L, NO, \
|
|
|
|
NO, A, O, E, U, I, D, H, T, N, S, NO, \
|
|
|
|
NO, SCLN, Q, J, K, X, B, M, W, V, Z, NO, \
|
2017-05-31 14:34:44 +00:00
|
|
|
NO, FN2, LALT, LCTL, FN1, FN3, BSPC, ENT, SPC, FN0, LGUI, LEFT, RGHT, NO ),
|
2017-03-07 16:44:58 +00:00
|
|
|
|
2017-03-17 13:11:20 +00:00
|
|
|
[RAISE] = KC_KEYMAP(
|
2017-05-08 02:01:35 +00:00
|
|
|
NO, MRWD, MPRV, MPLY, MNXT, MFFD, TRNS, MUTE, VOLD, VOLU, DEL, NO, \
|
2017-05-31 14:34:44 +00:00
|
|
|
NO, TILD, GRV, DQUO, QUOT, LCBR, RCBR, EQL, PLUS, MINS, QUES, NO, \
|
2017-06-01 02:16:21 +00:00
|
|
|
NO, ESC, TAB, BSLS, SLSH, LPRN, RPRN, LEFT, DOWN, UP, RGHT, NO, \
|
2017-05-31 14:34:44 +00:00
|
|
|
NO, TRNS, TRNS, TRNS, TRNS, LBRC, RBRC, PIPE, UNDS, TRNS, TRNS, NO, \
|
|
|
|
NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, NO ),
|
|
|
|
|
|
|
|
[LOWER] = KC_KEYMAP(
|
|
|
|
NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, NO, \
|
|
|
|
NO, EXLM, AT, HASH, DLR, PERC, CIRC, AMPR, ASTR, LPRN, RPRN, NO, \
|
|
|
|
NO, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, NO, \
|
|
|
|
NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, DOT, TRNS, TRNS, TRNS, NO, \
|
2017-06-01 02:16:21 +00:00
|
|
|
NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, NO ),
|
|
|
|
|
|
|
|
[NAV] = KC_KEYMAP(
|
|
|
|
NO, GRV, 1, 2, 3, 4, TRNS, TRNS, TRNS, TRNS, TRNS, NO, \
|
|
|
|
NO, 5, Q, W, E, R, TRNS, TRNS, TRNS, TRNS, TRNS, NO, \
|
|
|
|
NO, 6, A, S, D, F, TRNS, LEFT, UP, RGHT, TRNS, NO, \
|
|
|
|
NO, 7, Z, X, C, V, TRNS, TRNS, DOWN, TRNS, TRNS, NO, \
|
2017-03-16 00:32:58 +00:00
|
|
|
NO, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, NO )
|
2017-05-31 14:34:44 +00:00
|
|
|
|
2017-03-07 16:44:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16_t PROGMEM fn_actions[] = {
|
2017-03-16 00:32:58 +00:00
|
|
|
[0] = ACTION_LAYER_MOMENTARY(RAISE), // Raise layer
|
2017-05-31 14:34:44 +00:00
|
|
|
[1] = ACTION_LAYER_MOMENTARY(LOWER), // Lower layer
|
2017-06-01 02:16:21 +00:00
|
|
|
[2] = ACTION_LAYER_TOGGLE(NAV), // Nav layer
|
2017-05-31 14:34:44 +00:00
|
|
|
[3] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPC)
|
2017-03-07 16:44:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|
|
|
{
|
2017-03-17 13:11:20 +00:00
|
|
|
// MACRODOWN only works in this function
|
|
|
|
switch (id) {
|
|
|
|
case 0:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
register_code(KC_RSFT);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
unregister_code(KC_RSFT);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return MACRO_NONE;
|
2017-03-07 16:44:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static uint8_t qw_dv_swap_state = 0;
|
|
|
|
|
|
|
|
bool process_record_user (uint16_t keycode, keyrecord_t *record) {
|
|
|
|
if (keycode == KC_LGUI) {
|
|
|
|
if (record->event.pressed)
|
2017-03-15 20:43:16 +00:00
|
|
|
qw_dv_swap_state |= 0b00000001;
|
2017-03-07 16:44:58 +00:00
|
|
|
else
|
2017-03-15 20:43:16 +00:00
|
|
|
qw_dv_swap_state &= ~(0b00000001);
|
2017-03-07 16:44:58 +00:00
|
|
|
}
|
|
|
|
if (keycode == KC_LCTL) {
|
|
|
|
if (record->event.pressed)
|
2017-03-15 20:43:16 +00:00
|
|
|
qw_dv_swap_state |= 0b00000010;
|
2017-03-07 16:44:58 +00:00
|
|
|
else
|
2017-03-15 20:43:16 +00:00
|
|
|
qw_dv_swap_state &= ~(0b00000010);
|
2017-03-07 16:44:58 +00:00
|
|
|
}
|
|
|
|
|
2017-03-15 20:43:16 +00:00
|
|
|
if (qw_dv_swap_state == 0b00000011) {
|
2017-03-16 00:32:58 +00:00
|
|
|
layer_invert(DVORAK);
|
2017-03-07 16:44:58 +00:00
|
|
|
}
|
2017-03-15 20:43:16 +00:00
|
|
|
return true;
|
2017-03-07 16:44:58 +00:00
|
|
|
}
|