211 lines
9.7 KiB
C
211 lines
9.7 KiB
C
/*Copyright 2018 Carlos Filoteo
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
#include QMK_KEYBOARD_H
|
|
#include "danish.h"
|
|
|
|
#define LT3_TAB LT(3, KC_TAB)
|
|
|
|
enum layers {
|
|
QWERTY,
|
|
LOWER,
|
|
RAISE,
|
|
NAV,
|
|
ADJUST,
|
|
DANISH
|
|
};
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
/* Base Layer
|
|
* ,-------------------------------------------------------------------------.
|
|
* | Esc | Q | W | E | R | T | Y | U | I | O | P |Bspace |
|
|
* |-------------------------------------------------------------------------+
|
|
* | Tab | A | S | D | F | G | H | J | K | L | ; |Sh/En |
|
|
* |-------------------------------------------------------------------------+
|
|
* | Shift | Z | X | C | V | B | N | M | , | . | / | ' |
|
|
* |-------------------------------------------------------------------------+
|
|
* | Ctrl| GUI | Alt | App |LOWER | Space |RAISE | Left| Down| Up |Right|
|
|
* `-------------------------------------------------------------------------'
|
|
*/
|
|
|
|
[QWERTY] = LAYOUT(
|
|
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
|
|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_SFTENT,
|
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
|
|
KC_LCTL, KC_LGUI, KC_LALT, MO(DANISH), MO(LOWER), KC_SPC, MO(RAISE),KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
|
),
|
|
|
|
/* FN Layer 1
|
|
* ,-------------------------------------------------------------------------.
|
|
* | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | | 4 | 5 | 6 | / | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | |NumLk| | | | | | 1 | 2 | 3 | * | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | 0 | . | + | - | |
|
|
* `-------------------------------------------------------------------------'
|
|
*/
|
|
|
|
[LOWER] = LAYOUT( /* Right */
|
|
_______, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_0, KC_DEL,
|
|
_______, _______, _______, _______, _______, _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_PSLS, _______,
|
|
_______, KC_NLCK, _______, _______, _______, _______, KC_KP_0, KC_KP_1, KC_KP_2, KC_KP_3, KC_PAST, KC_HOME,
|
|
_______, _______, _______, _______, _______, _______, _______, KC_DOT, KC_PPLS, KC_PMNS, KC_END
|
|
),
|
|
|
|
|
|
|
|
|
|
/* FN Layer 2
|
|
* ,-------------------------------------------------------------------------.
|
|
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) |Delete|
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | | _ | + | { | } | | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | |Capsl| | | | Home| PgDn| PgUp| End |
|
|
* `-------------------------------------------------------------------------'
|
|
*/
|
|
|
|
[RAISE] = LAYOUT( /* Left */
|
|
KC_TILDE, KC_EXCLAIM, KC_AT, KC_HASH, KC_DOLLAR, KC_PERCENT, KC_CIRCUMFLEX, KC_AMPERSAND, KC_ASTERISK, KC_LEFT_PAREN, KC_RIGHT_PAREN, KC_DELETE,
|
|
_______, _______, _______, _______, _______, _______, _______, KC_UNDERSCORE, KC_PLUS, KC_LEFT_CURLY_BRACE, KC_RIGHT_CURLY_BRACE, KC_PIPE,
|
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
|
|
_______, _______, _______, KC_CAPS, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
|
|
),
|
|
|
|
/* FN Layer 2
|
|
* ,-------------------------------------------------------------------------.
|
|
* | Esc | | UP | | | | | | | |PrtSc| |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | LEFT|DOWN |RIGHT| | | Left| Down| Up |Right| | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | | | | | | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | | | | | |
|
|
* `-------------------------------------------------------------------------'
|
|
*/
|
|
|
|
[NAV] = LAYOUT( /* Tab */
|
|
KC_ESC, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
_______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______,
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
|
),
|
|
|
|
/* FN Layer 2
|
|
* ,-------------------------------------------------------------------------.
|
|
* | Esc | Calc|Webhm| Mail| Comp| | | | | |PrtSc| |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | | | | | | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | | | | | | |
|
|
* |-------------------------------------------------------------------------+
|
|
* | | | | | | | |MousL|MousD|MousU|MousR|
|
|
* `-------------------------------------------------------------------------'
|
|
*/
|
|
|
|
[ADJUST] = LAYOUT( /* Tab */
|
|
KC_ESC, KC_CALC, KC_WHOM, KC_MAIL, KC_MYCM, _______, _______, _______, _______, _______, KC_PSCR, _______,
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
_______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R
|
|
),
|
|
|
|
/* DANISH
|
|
* ,-------------------------------------------------------------------------.
|
|
* | Esc | Q | W | E | R | T | Y | U | I | O | P |Bspace |
|
|
* |-------------------------------------------------------------------------+
|
|
* | Tab | A | S | D | F | G | H | J | K | L | Å | ' |
|
|
* |-------------------------------------------------------------------------+
|
|
* | Shift | Z | X | C | V | B | N | M | , | Æ | Ø |Sh/En|
|
|
* |-------------------------------------------------------------------------+
|
|
* | Ctrl| GUI | Alt | App |LOWER | Space |RAISE | Left| Down| Up |Right|
|
|
* `-------------------------------------------------------------------------'
|
|
*/
|
|
|
|
[DANISH] = LAYOUT( /* Tab */
|
|
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
|
|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, DK_AA, KC_QUOT,
|
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, DK_AE, DK_OE, KC_SFTENT,
|
|
KC_LCTL, KC_LGUI, KC_LALT, MO(DANISH), MO(LOWER), KC_SPC, MO(RAISE),KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
|
),
|
|
|
|
};
|
|
|
|
|
|
#ifdef RGBLIGHT_ENABLE
|
|
|
|
|
|
const rgblight_segment_t PROGMEM QWERTY_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
|
{0, 8, HSV_BLUE}
|
|
);
|
|
const rgblight_segment_t PROGMEM LOWER_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
|
{0, 8, HSV_CYAN}
|
|
);
|
|
const rgblight_segment_t PROGMEM RAISE_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
|
{0, 8, HSV_PURPLE}
|
|
);
|
|
const rgblight_segment_t PROGMEM NAV_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
|
{0, 8, HSV_GREEN}
|
|
);
|
|
const rgblight_segment_t PROGMEM ADJUST_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
|
{0, 8, HSV_YELLOW}
|
|
);
|
|
const rgblight_segment_t PROGMEM CAPS_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
|
{0, 8, HSV_RED}
|
|
);
|
|
|
|
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
|
|
QWERTY_layer,
|
|
LOWER_layer, // Overrides caps lock layer
|
|
RAISE_layer,
|
|
NAV_layer,
|
|
ADJUST_layer,
|
|
CAPS_layer
|
|
|
|
// Overrides other layers
|
|
);
|
|
|
|
void keyboard_post_init_user(void) {
|
|
rgblight_layers = my_rgb_layers;
|
|
// rgblight_enable_noeeprom(); // Enables RGB, without saving settings
|
|
// rgblight_sethsv_noeeprom(HSV_BLUE);
|
|
// rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
|
}
|
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
|
|
|
for (int i = 0; i < sizeof(my_rgb_layers)/sizeof(my_rgb_layers[0]); i++) {
|
|
rgblight_set_layer_state(i, layer_state_cmp(state, i));
|
|
}
|
|
|
|
return update_tri_layer_state(state, LOWER, RAISE, ADJUST);
|
|
|
|
}
|
|
|
|
bool led_update_user(led_t led_state) {
|
|
rgblight_set_layer_state(0, layer_state_cmp(QWERTY, 0));
|
|
rgblight_set_layer_state(5, led_state.caps_lock);
|
|
return true;
|
|
}
|
|
|
|
#endif |