2018-10-17 01:56:39 +02:00
|
|
|
/* Copyright 2015-2017 Jack Humbert
|
|
|
|
*
|
|
|
|
* 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 "action_layer.h"
|
|
|
|
#include "muse.h"
|
|
|
|
#include "keymap_slovenian.h"
|
|
|
|
|
2018-11-06 06:34:54 +01:00
|
|
|
#define ALTG(kc) ALGR(kc) // FIXME: Remove this
|
|
|
|
|
2018-10-17 01:56:39 +02:00
|
|
|
extern keymap_config_t keymap_config;
|
|
|
|
|
|
|
|
enum planck_layers {
|
|
|
|
_QWERTY,
|
|
|
|
_LOWER,
|
|
|
|
_RAISE,
|
|
|
|
_ADJUST,
|
|
|
|
_ALTGR,
|
2018-10-30 06:21:07 +01:00
|
|
|
_CAPS,
|
|
|
|
_MEMA,
|
|
|
|
_CARON
|
2018-10-17 01:56:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum planck_keycodes {
|
|
|
|
QWERTY = SAFE_RANGE,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LOWER MO(_LOWER)
|
|
|
|
#define RAISE MO(_RAISE)
|
|
|
|
#define CAPS MO(_CAPS)
|
|
|
|
#define ALTGR MO(_ALTGR)
|
2018-10-30 06:21:07 +01:00
|
|
|
#define MEMA MO(_MEMA)
|
2020-10-02 01:17:57 +02:00
|
|
|
#define CARON LT(_CARON, SI_QUOT)
|
2018-10-17 01:56:39 +02:00
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
|
|
|
|
/* Qwerty
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | Tab | Q | W | E | R | T | Z | U | I | O | P | Bksp |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | CAPS | A | S | D | F | G | H | J | K | L |CARON |Enter |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | Shift| Y | X | C | V | B | N | M | , | . | / |Shift |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | Ctrl | GUI | Alt | GUI |LOWER | Space |RAISE | ALTGR| MEMA | F12 | F5 |
|
2018-10-17 01:56:39 +02:00
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_QWERTY] = LAYOUT_planck_grid(
|
|
|
|
KC_TAB, SI_Q, SI_W, SI_E, SI_R, SI_T, SI_Z, SI_U, SI_I, SI_O, SI_P, KC_BSPC,
|
2018-10-30 06:21:07 +01:00
|
|
|
CAPS, SI_A, SI_S, SI_D, SI_F, SI_G, SI_H, SI_J, SI_K, SI_L, CARON, KC_ENT,
|
2020-10-02 01:17:57 +02:00
|
|
|
KC_LSFT, SI_Y, SI_X, SI_C, SI_V, SI_B, SI_N, SI_M, SI_COMM, SI_DOT, SI_MINS, KC_RSFT,
|
|
|
|
KC_LCTL, KC_LALT, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, ALTGR, MEMA, KC_F12, KC_F5
|
2018-10-17 01:56:39 +02:00
|
|
|
),
|
|
|
|
|
|
|
|
/* Lower
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
2018-10-30 06:21:07 +01:00
|
|
|
* | ~ | ! | " | # | $ | % | & | / | ( | ) | = | Bksp |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | | F1 | F2 | F3 | F4 | F5 | F6 | ? | * | ` | + | |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | < | > | | |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | | | | | | | | | | | |
|
2018-10-17 01:56:39 +02:00
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_LOWER] = LAYOUT_planck_grid(
|
2020-10-02 01:17:57 +02:00
|
|
|
SI_TILD, SI_EXLM, SI_DQUO, KC_HASH, SI_DLR, SI_PERC, SI_AMPR, SI_SLSH, SI_LPRN, SI_RPRN, SI_EQL, _______,
|
|
|
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, SI_QUES, SI_ASTR, SI_GRV, SI_PLUS, _______,
|
|
|
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, SI_LABK, SI_RABK, KC_END, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
2021-05-22 08:17:32 +02:00
|
|
|
),
|
2018-10-17 01:56:39 +02:00
|
|
|
|
|
|
|
/* Raise
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | Del | | | | | | | - | = | [ | ] | \ |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
2020-10-02 01:17:57 +02:00
|
|
|
* | | | | | | | |ISO # |ISO / |Pg Up |Pg Dn | |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_RAISE] = LAYOUT_planck_grid(
|
2020-10-02 01:17:57 +02:00
|
|
|
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
2018-10-17 01:56:39 +02:00
|
|
|
),
|
|
|
|
|
2020-10-02 01:17:57 +02:00
|
|
|
|
2018-10-17 01:56:39 +02:00
|
|
|
/* Adjust (Lower + Raise)
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | | Reset| | | | | | | | | | Del |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
2018-10-30 06:21:07 +01:00
|
|
|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | |
|
2018-10-17 01:56:39 +02:00
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
|
|
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
|
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | |
|
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
|
|
|
[_ADJUST] = LAYOUT_planck_grid(
|
2022-08-22 00:55:30 +02:00
|
|
|
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
|
2018-10-17 01:56:39 +02:00
|
|
|
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______,
|
|
|
|
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
|
|
|
),
|
|
|
|
|
2020-10-02 01:17:57 +02:00
|
|
|
/* Altgr <>
|
|
|
|
* ,-----------------------------------------------------------------------------------.
|
|
|
|
* | | \ | | | € | | | | | | | | |
|
|
|
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
|
|
|
* | | | | | [ | ] | | | | | | |
|
|
|
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
|
|
|
* | | | | | @ | { | } | | < | > | | |
|
|
|
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
|
|
|
* | | | | | | | | | | | |
|
|
|
|
* `-----------------------------------------------------------------------------------'
|
|
|
|
*/
|
2021-07-24 09:37:19 +02:00
|
|
|
[_ALTGR] = LAYOUT_planck_grid(
|
2020-10-02 01:17:57 +02:00
|
|
|
_______, SI_BSLS, SI_PIPE, SI_EURO, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, SI_LBRC, SI_RBRC, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, SI_AT, SI_LCBR, SI_RCBR, _______, SI_LABK, SI_RABK, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
2018-10-17 01:56:39 +02:00
|
|
|
),
|
|
|
|
|
|
|
|
[_CAPS] = LAYOUT_planck_grid(
|
2020-10-02 01:17:57 +02:00
|
|
|
KC_ESC , KC_BSPC, KC_UP , KC_DEL , _______, _______, _______, _______, _______, KC_HOME, KC_END, KC_DEL ,
|
|
|
|
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, LCTL(KC_LEFT), LCTL(KC_RIGHT), _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
2018-10-30 06:21:07 +01:00
|
|
|
),
|
|
|
|
|
|
|
|
[_MEMA] = LAYOUT_planck_grid(
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, KC_MPLY, KC_VOLU,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
|
|
|
),
|
|
|
|
|
|
|
|
[_CARON] = LAYOUT_planck_grid(
|
2020-10-02 01:17:57 +02:00
|
|
|
_______, _______, _______, _______, _______, _______, SI_ZCAR , _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, SI_SCAR, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, SI_CCAR, _______, _______, _______, _______, _______, _______, _______, _______,
|
2018-10-30 06:21:07 +01:00
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
|
|
|
),
|
2018-10-17 01:56:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
float plover_song[][2] = SONG(PLOVER_SOUND);
|
|
|
|
float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
|
|
|
#endif
|
|
|
|
|
2021-07-19 18:50:55 +02:00
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
2018-10-17 01:56:39 +02:00
|
|
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool muse_mode = false;
|
|
|
|
uint8_t last_muse_note = 0;
|
|
|
|
uint16_t muse_counter = 0;
|
|
|
|
uint8_t muse_offset = 70;
|
|
|
|
uint16_t muse_tempo = 50;
|
|
|
|
|
2021-07-24 09:37:19 +02:00
|
|
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
2018-10-17 01:56:39 +02:00
|
|
|
if (muse_mode) {
|
|
|
|
if (IS_LAYER_ON(_RAISE)) {
|
|
|
|
if (clockwise) {
|
|
|
|
muse_offset++;
|
|
|
|
} else {
|
|
|
|
muse_offset--;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (clockwise) {
|
|
|
|
muse_tempo+=1;
|
|
|
|
} else {
|
|
|
|
muse_tempo-=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (clockwise) {
|
|
|
|
register_code(KC_PGDN);
|
|
|
|
unregister_code(KC_PGDN);
|
|
|
|
} else {
|
|
|
|
register_code(KC_PGUP);
|
|
|
|
unregister_code(KC_PGUP);
|
|
|
|
}
|
|
|
|
}
|
2021-05-22 08:17:32 +02:00
|
|
|
return true;
|
2018-10-17 01:56:39 +02:00
|
|
|
}
|
|
|
|
|
2021-07-24 09:37:19 +02:00
|
|
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
2018-10-17 01:56:39 +02:00
|
|
|
switch (index) {
|
|
|
|
case 0:
|
|
|
|
if (active) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
PLAY_SONG(plover_song);
|
|
|
|
#endif
|
|
|
|
layer_on(_ADJUST);
|
|
|
|
} else {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
PLAY_SONG(plover_gb_song);
|
|
|
|
#endif
|
|
|
|
layer_off(_ADJUST);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (active) {
|
|
|
|
muse_mode = true;
|
|
|
|
} else {
|
|
|
|
muse_mode = false;
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
stop_all_notes();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2021-07-24 09:37:19 +02:00
|
|
|
return true;
|
2018-10-17 01:56:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void matrix_scan_user(void) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
if (muse_mode) {
|
|
|
|
if (muse_counter == 0) {
|
|
|
|
uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()];
|
|
|
|
if (muse_note != last_muse_note) {
|
|
|
|
stop_note(compute_freq_for_midi_note(last_muse_note));
|
|
|
|
play_note(compute_freq_for_midi_note(muse_note), 0xF);
|
|
|
|
last_muse_note = muse_note;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
muse_counter = (muse_counter + 1) % muse_tempo;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool music_mask_user(uint16_t keycode) {
|
|
|
|
switch (keycode) {
|
|
|
|
case RAISE:
|
|
|
|
case LOWER:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|