|
|
@ -1,20 +1,28 @@
|
|
|
|
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
|
|
|
|
/* Copyright 2015-2017 Jack Humbert
|
|
|
|
// this is the style you want to emulate.
|
|
|
|
*
|
|
|
|
|
|
|
|
* 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 "planck.h"
|
|
|
|
#include "planck.h"
|
|
|
|
#include "action_layer.h"
|
|
|
|
#include "action_layer.h"
|
|
|
|
|
|
|
|
#include "eeconfig.h"
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
#include "audio.h"
|
|
|
|
#include "audio.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#include "eeconfig.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern keymap_config_t keymap_config;
|
|
|
|
extern keymap_config_t keymap_config;
|
|
|
|
|
|
|
|
|
|
|
|
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
|
|
|
|
|
|
|
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
|
|
|
|
|
|
|
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
|
|
|
|
|
|
|
// entirely and just use numbers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum planck_layers {
|
|
|
|
enum planck_layers {
|
|
|
|
_QWERTY,
|
|
|
|
_QWERTY,
|
|
|
|
_COLEMAK,
|
|
|
|
_COLEMAK,
|
|
|
@ -36,10 +44,6 @@ enum planck_keycodes {
|
|
|
|
EXT_PLV
|
|
|
|
EXT_PLV
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Fillers to make layering more clear
|
|
|
|
|
|
|
|
#define _______ KC_TRNS
|
|
|
|
|
|
|
|
#define XXXXXXX KC_NO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
|
|
|
|
|
|
|
|
/* Qwerty
|
|
|
|
/* Qwerty
|
|
|
@ -173,50 +177,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
|
|
|
|
float plover_song[][2] = SONG(PLOVER_SOUND);
|
|
|
|
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
|
|
|
float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
|
|
|
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
|
|
|
|
|
|
|
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
|
|
|
|
|
|
|
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
|
|
|
|
|
|
|
float tone_plover[][2] = SONG(PLOVER_SOUND);
|
|
|
|
|
|
|
|
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
|
|
|
|
|
|
|
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void persistent_default_layer_set(uint16_t default_layer) {
|
|
|
|
|
|
|
|
eeconfig_update_default_layer(default_layer);
|
|
|
|
|
|
|
|
default_layer_set(default_layer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
|
|
|
switch (keycode) {
|
|
|
|
case QWERTY:
|
|
|
|
case QWERTY:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
set_single_persistent_default_layer(_QWERTY);
|
|
|
|
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
persistent_default_layer_set(1UL<<_QWERTY);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case COLEMAK:
|
|
|
|
case COLEMAK:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
set_single_persistent_default_layer(_COLEMAK);
|
|
|
|
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
persistent_default_layer_set(1UL<<_COLEMAK);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case DVORAK:
|
|
|
|
case DVORAK:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
set_single_persistent_default_layer(_DVORAK);
|
|
|
|
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
persistent_default_layer_set(1UL<<_DVORAK);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -255,7 +236,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
stop_all_notes();
|
|
|
|
stop_all_notes();
|
|
|
|
PLAY_NOTE_ARRAY(tone_plover, false, 0);
|
|
|
|
PLAY_SONG(plover_song);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
layer_off(_RAISE);
|
|
|
|
layer_off(_RAISE);
|
|
|
|
layer_off(_LOWER);
|
|
|
|
layer_off(_LOWER);
|
|
|
@ -273,7 +254,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
case EXT_PLV:
|
|
|
|
case EXT_PLV:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (record->event.pressed) {
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
|
|
|
|
PLAY_SONG(plover_gb_song);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
layer_off(_PLOVER);
|
|
|
|
layer_off(_PLOVER);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -282,36 +263,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void matrix_init_user(void) {
|
|
|
|
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
|
|
|
|
startup_user();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef AUDIO_ENABLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void startup_user()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_delay_ms(20); // gets rid of tick
|
|
|
|
|
|
|
|
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void shutdown_user()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
|
|
|
|
|
|
|
_delay_ms(150);
|
|
|
|
|
|
|
|
stop_all_notes();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void music_on_user(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
music_scale_user();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void music_scale_user(void)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|