From 8f85117aa9e060371177e3b523bc89dc7aad19e8 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Fri, 15 Apr 2016 14:42:50 -0500 Subject: Added Audio to my Atomic --- keyboard/atomic/keymaps/pvc/keymap.c | 202 +++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 keyboard/atomic/keymaps/pvc/keymap.c (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c new file mode 100644 index 0000000000..627f57ff70 --- /dev/null +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -0,0 +1,202 @@ +#include "atomic.h" +#include "action_layer.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif + +#define _QW 0 +#define _LW 1 +#define _RS 2 +#define _FN 3 + +#define M_QW 0 +#define M_LW 1 +#define M_RS 2 +#define M_FN 3 + + +#define _______ KC_TRNS +#define ___T___ KC_TRNS +#define XXXXXXX KC_NO + +/* + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | LCTRL | LWIN | FN | LALT | RAISED | XXXXXX . SPACE | LOWER | RALT | HOME | END | RCTRL | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QW] = { /* QWERTY */ + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX }, + { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, + { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP }, + { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN }, + { KC_LCTL, KC_LGUI, M(M_FN), KC_LALT, M(M_RS), KC_SPC, XXXXXXX, M(M_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + }, + [_LW] = { /* LOWERED */ + { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + [_RS] = { /* RAISED */ + { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + [_FN] = { /* FUNCTION */ + { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, + { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, + { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, + }, +}; + +#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) +#define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer))) + + +#ifdef AUDIO_ENABLE +float tone_lw[][2] = { + {440.0*pow(2.0,(59)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8}, + {0, 4}, + {440.0*pow(2.0,(67)/12.0), 16} +}; + +float tone_rs[][2] = { + {440.0*pow(2.0,(59)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8}, + {0, 4}, + {440.0*pow(2.0,(67)/12.0), 16}, + {0, 4}, + {440.0*pow(2.0,(71)/12.0), 16} +}; + +float tone_fn[][2] = { + {440.0*pow(2.0,(59)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8}, + {0, 4}, + {440.0*pow(2.0,(67)/12.0), 16}, + {0, 4}, + {440.0*pow(2.0,(69)/12.0), 16}, + {0, 4}, + {440.0*pow(2.0,(67)/12.0), 16} +}; +#endif + + +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) +{ + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + #ifdef AUDIO_ENABLE + println("PlayNotes FN"); + play_notes(&tone_fn, 8, false); + #endif + layer_on(layer3); + } + else + { + layer_off(layer3); + } +} + +void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) +{ + if (order) + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer3); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } + else + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer4); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } +} + + +const uint16_t PROGMEM fn_actions[] = { +}; + + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case M_LW: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + println("PlayNotes LW"); + play_notes(&tone_lw, 4, false); + #endif + layer_on(_LW); + update_tri_layer(_LW, _RS, _FN); + } else { + layer_off(_LW); + update_tri_layer(_LW, _RS, _FN); + } + break; + case M_RS: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + println("PlayNotes RS"); + play_notes(&tone_rs, 6, false); + #endif + layer_on(_RS); + update_tri_layer(_LW, _RS, _FN); + } else { + layer_off(_RS); + update_tri_layer(_LW, _RS, _FN); + } + break; + default: + break; + } + return MACRO_NONE; +}; + +#ifdef AUDIO_ENABLE +float start_up[][2] = { + {440.0*pow(2.0,(67)/12.0), 12}, + {440.0*pow(2.0,(64)/12.0), 8}, + {440.0*pow(2.0,(55)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(64)/12.0), 20} +}; +#endif + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + init_notes(); + play_notes(&start_up, 5, false); + println("Matrix Init"); + #endif +} -- cgit v1.2.3 From 2aa51e4416b65317b16660c0676696974b2dcfc5 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Fri, 15 Apr 2016 16:32:44 -0500 Subject: Tweaking PVC atomic layout --- keyboard/atomic/keymaps/pvc/keymap.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 627f57ff70..7bfd910a17 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -1,13 +1,15 @@ #include "atomic.h" #include "action_layer.h" + #ifdef AUDIO_ENABLE - #include "audio.h" +#include "audio.h" #endif #define _QW 0 #define _LW 1 #define _RS 2 -#define _FN 3 +#define _AD 3 +#define _FN 4 #define M_QW 0 #define M_LW 1 @@ -62,6 +64,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, + [_ADJ] = { /* ADJUST */ + { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, + { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, + { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, + }, }; #define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) -- cgit v1.2.3 From 9d4bfc1bcf9a93b25ce4f7c32d8f3db12c85c23b Mon Sep 17 00:00:00 2001 From: IBNobody Date: Fri, 15 Apr 2016 22:40:07 -0500 Subject: Corrected layer macros --- keyboard/atomic/keymaps/pvc/keymap.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 7bfd910a17..7abd7f4f7d 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -64,20 +64,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, - [_ADJ] = { /* ADJUST */ - { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, - { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, - { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, + [_AD] = { /* ADJUST */ + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, }, }; -#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) -#define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer))) - +#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer))) +#define IS_LAYER_OFF(layer) (!IS_LAYER_ON(layer)) #ifdef AUDIO_ENABLE + + + + float tone_lw[][2] = { {440.0*pow(2.0,(59)/12.0), 8}, {440.0*pow(2.0,(60)/12.0), 8}, -- cgit v1.2.3 From b5c22ab5b5b77d5e21cc4145831608eed6756ad7 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sat, 16 Apr 2016 19:27:21 -0500 Subject: Merging with QMK main to fix audio issues --- keyboard/atomic/keymaps/pvc/keymap.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 7abd7f4f7d..189da16c47 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -3,8 +3,10 @@ #ifdef AUDIO_ENABLE #include "audio.h" +#include "musical_notes.h" #endif + #define _QW 0 #define _LW 1 #define _RS 2 @@ -82,10 +84,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { float tone_lw[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} +Q_NOTE(_C4 ) , +Q_NOTE(_CS4 ) , +Q_NOTE(_D4 ) , +Q_NOTE(_DS4 ) , +Q_NOTE(_E4 ) , +Q_NOTE(_F4 ) , +Q_NOTE(_FS4 ) , +Q_NOTE(_G4 ) , +Q_NOTE(_GS4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_AS4 ) , +Q_NOTE(_B4 ) , }; float tone_rs[][2] = { @@ -158,6 +168,7 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l const uint16_t PROGMEM fn_actions[] = { }; +#define ARRAY_SIZE(x) ((sizeof x) / (sizeof *x)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { @@ -167,7 +178,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE println("PlayNotes LW"); - play_notes(&tone_lw, 4, false); + print_val_hex32(ARRAY_SIZE(tone_lw)); + play_notes(&tone_lw, 12, false); #endif layer_on(_LW); update_tri_layer(_LW, _RS, _FN); -- cgit v1.2.3 From a87522033d6385ecd2422f26f5bb6bdad9d44676 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sat, 16 Apr 2016 20:37:22 -0500 Subject: Merging with QMK main to fix rest issues --- keyboard/atomic/keymaps/pvc/keymap.c | 169 ++++++++++++++++++++++++++++------- 1 file changed, 139 insertions(+), 30 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 189da16c47..229708344f 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -84,6 +84,59 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { float tone_lw[][2] = { +/* +Q_NOTE(_C1 ) , +Q_NOTE(_CS1 ) , +Q_NOTE(_D1 ) , +Q_NOTE(_DS1 ) , +Q_NOTE(_E1 ) , +Q_NOTE(_F1 ) , +Q_NOTE(_FS1 ) , +Q_NOTE(_G1 ) , +Q_NOTE(_GS1 ) , +Q_NOTE(_A1 ) , +Q_NOTE(_AS1 ) , +Q_NOTE(_B1 ) , +*/ + +Q_NOTE(_C4 ) , +Q_NOTE(_CS4 ) , +Q_NOTE(_D4 ) , +Q_NOTE(_DS4 ) , +Q_NOTE(_E4 ) , +Q_NOTE(_F4 ) , +Q_NOTE(_FS4 ) , +Q_NOTE(_G4 ) , +Q_NOTE(_GS4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_AS4 ) , +Q_NOTE(_B1 ) , + + +Q_NOTE(_C2 ) , +Q_NOTE(_CS2 ) , +Q_NOTE(_D2 ) , +Q_NOTE(_DS2 ) , +Q_NOTE(_E2 ) , +Q_NOTE(_F2 ) , +Q_NOTE(_FS2 ) , +Q_NOTE(_G2 ) , +Q_NOTE(_GS2 ) , +Q_NOTE(_A2 ) , +Q_NOTE(_AS2 ) , +Q_NOTE(_B2 ) , +Q_NOTE(_C3 ) , +Q_NOTE(_CS3 ) , +Q_NOTE(_D3 ) , +Q_NOTE(_DS3 ) , +Q_NOTE(_E3 ) , +Q_NOTE(_F3 ) , +Q_NOTE(_FS3 ) , +Q_NOTE(_G3 ) , +Q_NOTE(_GS3 ) , +Q_NOTE(_A3 ) , +Q_NOTE(_AS3 ) , +Q_NOTE(_B3 ) , Q_NOTE(_C4 ) , Q_NOTE(_CS4 ) , Q_NOTE(_D4 ) , @@ -96,15 +149,64 @@ Q_NOTE(_GS4 ) , Q_NOTE(_A4 ) , Q_NOTE(_AS4 ) , Q_NOTE(_B4 ) , +Q_NOTE(_C5 ) , +Q_NOTE(_CS5 ) , +Q_NOTE(_D5 ) , +Q_NOTE(_DS5 ) , +Q_NOTE(_E5 ) , +Q_NOTE(_F5 ) , +Q_NOTE(_FS5 ) , +Q_NOTE(_G5 ) , +Q_NOTE(_GS5 ) , +Q_NOTE(_A5 ) , +Q_NOTE(_AS5 ) , +Q_NOTE(_B5 ) , +Q_NOTE(_C6 ) , +Q_NOTE(_CS6 ) , +Q_NOTE(_D6 ) , +Q_NOTE(_DS6 ) , +Q_NOTE(_E6 ) , +Q_NOTE(_F6 ) , +Q_NOTE(_FS6 ) , +Q_NOTE(_G6 ) , +Q_NOTE(_GS6 ) , +Q_NOTE(_A6 ) , +Q_NOTE(_AS6 ) , +Q_NOTE(_B6 ) , +Q_NOTE(_C7 ) , +Q_NOTE(_CS7 ) , +Q_NOTE(_D7 ) , +Q_NOTE(_DS7 ) , +Q_NOTE(_E7 ) , +Q_NOTE(_F7 ) , +Q_NOTE(_FS7 ) , +Q_NOTE(_G7 ) , +Q_NOTE(_GS7 ) , +Q_NOTE(_A7 ) , +Q_NOTE(_AS7 ) , +Q_NOTE(_B7 ) , +Q_NOTE(_C8 ) , +Q_NOTE(_CS8 ) , +Q_NOTE(_D8 ) , +Q_NOTE(_DS8 ) , +Q_NOTE(_E8 ) , +Q_NOTE(_F8 ) , +Q_NOTE(_FS8 ) , +Q_NOTE(_G8 ) , +Q_NOTE(_GS8 ) , +Q_NOTE(_A8 ) , +Q_NOTE(_AS8 ) , +Q_NOTE(_B8 ) , + }; float tone_rs[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16}, - {0, 4}, - {440.0*pow(2.0,(71)/12.0), 16} +Q_NOTE(_F8 ) , +Q_NOTE(_G8 ) , +Q_NOTE(_GS8 ) , +Q_NOTE(_A8 ) , +Q_NOTE(_AS8 ) , +Q_NOTE(_B8 ) , }; float tone_fn[][2] = { @@ -119,23 +221,6 @@ float tone_fn[][2] = { }; #endif - -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) -{ - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - #ifdef AUDIO_ENABLE - println("PlayNotes FN"); - play_notes(&tone_fn, 8, false); - #endif - layer_on(layer3); - } - else - { - layer_off(layer3); - } -} - void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) { if (order) @@ -179,7 +264,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE println("PlayNotes LW"); print_val_hex32(ARRAY_SIZE(tone_lw)); - play_notes(&tone_lw, 12, false); + play_notes(&tone_lw, 96, false); #endif layer_on(_LW); update_tri_layer(_LW, _RS, _FN); @@ -209,18 +294,42 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE float start_up[][2] = { - {440.0*pow(2.0,(67)/12.0), 12}, - {440.0*pow(2.0,(64)/12.0), 8}, - {440.0*pow(2.0,(55)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, - {440.0*pow(2.0,(64)/12.0), 20} +Q_NOTE(_E4 ) , +{0,1} , +Q_NOTE(_E4 ) , +{0,1} , +Q_NOTE(_F4 ) , +{0,1} , +Q_NOTE(_G4 ) , +{0,1} , +Q_NOTE(_G4 ) , +{0,1} , +Q_NOTE(_F4 ) , +{0,1} , +Q_NOTE(_E4 ) , +{0,1} , +Q_NOTE(_D4 ) , +{0,1} , +Q_NOTE(_C4 ) , +{0,1} , +Q_NOTE(_C4 ) , +{0,1} , +Q_NOTE(_D4 ) , +{0,1} , +Q_NOTE(_E4 ) , +{0,1} , +H_NOTE(_E4 ) , +{0,1} , +Q_NOTE(_D4 ) , +{0,1} , +H_NOTE(_D4 ) , }; #endif void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 5, false); + play_notes(&start_up, 29, false); println("Matrix Init"); #endif } -- cgit v1.2.3 From 45f10b4c4b308226fa1568277654a13853a03ab4 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sat, 16 Apr 2016 22:10:18 -0500 Subject: Fixed how note arrays are used. --- keyboard/atomic/keymaps/pvc/keymap.c | 44 ++++++++---------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 229708344f..c2081f525e 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -75,8 +75,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, }; -#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer))) -#define IS_LAYER_OFF(layer) (!IS_LAYER_ON(layer)) #ifdef AUDIO_ENABLE @@ -201,24 +199,14 @@ Q_NOTE(_B8 ) , }; float tone_rs[][2] = { -Q_NOTE(_F8 ) , -Q_NOTE(_G8 ) , -Q_NOTE(_GS8 ) , -Q_NOTE(_A8 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_A4 ) , Q_NOTE(_AS8 ) , Q_NOTE(_B8 ) , }; -float tone_fn[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16}, - {0, 4}, - {440.0*pow(2.0,(69)/12.0), 16}, - {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} -}; #endif void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) @@ -253,18 +241,18 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l const uint16_t PROGMEM fn_actions[] = { }; -#define ARRAY_SIZE(x) ((sizeof x) / (sizeof *x)) +//#define MUSIC_ARRAY_SIZE(x) (((int)(sizeof(x) / (sizeof(x[0][0])))) / 2) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + // MACRODOWN only works in this function switch(id) { case M_LW: if (record->event.pressed) { #ifdef AUDIO_ENABLE println("PlayNotes LW"); - print_val_hex32(ARRAY_SIZE(tone_lw)); - play_notes(&tone_lw, 96, false); + PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); #endif layer_on(_LW); update_tri_layer(_LW, _RS, _FN); @@ -277,7 +265,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE println("PlayNotes RS"); - play_notes(&tone_rs, 6, false); + PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); #endif layer_on(_RS); update_tri_layer(_LW, _RS, _FN); @@ -295,33 +283,19 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE float start_up[][2] = { Q_NOTE(_E4 ) , -{0,1} , Q_NOTE(_E4 ) , -{0,1} , Q_NOTE(_F4 ) , -{0,1} , Q_NOTE(_G4 ) , -{0,1} , Q_NOTE(_G4 ) , -{0,1} , Q_NOTE(_F4 ) , -{0,1} , Q_NOTE(_E4 ) , -{0,1} , Q_NOTE(_D4 ) , -{0,1} , Q_NOTE(_C4 ) , -{0,1} , Q_NOTE(_C4 ) , -{0,1} , Q_NOTE(_D4 ) , -{0,1} , Q_NOTE(_E4 ) , -{0,1} , H_NOTE(_E4 ) , -{0,1} , Q_NOTE(_D4 ) , -{0,1} , H_NOTE(_D4 ) , }; #endif @@ -329,7 +303,7 @@ H_NOTE(_D4 ) , void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 29, false); + PLAY_NOTE_ARRAY(start_up, false, STACCATO); println("Matrix Init"); #endif } -- cgit v1.2.3 From 943b5b770955be937a89016680052be56d874c4a Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sun, 17 Apr 2016 00:24:58 -0500 Subject: Adding folding to #if, etc --- keyboard/atomic/keymaps/pvc/keymap.c | 291 ++++++++++++++++------------------- 1 file changed, 133 insertions(+), 158 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index c2081f525e..9a2c57cb18 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -3,7 +3,7 @@ #ifdef AUDIO_ENABLE #include "audio.h" -#include "musical_notes.h" +#include "song_list.h" #endif @@ -75,140 +75,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, }; - -#ifdef AUDIO_ENABLE - - - - -float tone_lw[][2] = { -/* -Q_NOTE(_C1 ) , -Q_NOTE(_CS1 ) , -Q_NOTE(_D1 ) , -Q_NOTE(_DS1 ) , -Q_NOTE(_E1 ) , -Q_NOTE(_F1 ) , -Q_NOTE(_FS1 ) , -Q_NOTE(_G1 ) , -Q_NOTE(_GS1 ) , -Q_NOTE(_A1 ) , -Q_NOTE(_AS1 ) , -Q_NOTE(_B1 ) , -*/ - -Q_NOTE(_C4 ) , -Q_NOTE(_CS4 ) , -Q_NOTE(_D4 ) , -Q_NOTE(_DS4 ) , -Q_NOTE(_E4 ) , -Q_NOTE(_F4 ) , -Q_NOTE(_FS4 ) , -Q_NOTE(_G4 ) , -Q_NOTE(_GS4 ) , -Q_NOTE(_A4 ) , -Q_NOTE(_AS4 ) , -Q_NOTE(_B1 ) , - - -Q_NOTE(_C2 ) , -Q_NOTE(_CS2 ) , -Q_NOTE(_D2 ) , -Q_NOTE(_DS2 ) , -Q_NOTE(_E2 ) , -Q_NOTE(_F2 ) , -Q_NOTE(_FS2 ) , -Q_NOTE(_G2 ) , -Q_NOTE(_GS2 ) , -Q_NOTE(_A2 ) , -Q_NOTE(_AS2 ) , -Q_NOTE(_B2 ) , -Q_NOTE(_C3 ) , -Q_NOTE(_CS3 ) , -Q_NOTE(_D3 ) , -Q_NOTE(_DS3 ) , -Q_NOTE(_E3 ) , -Q_NOTE(_F3 ) , -Q_NOTE(_FS3 ) , -Q_NOTE(_G3 ) , -Q_NOTE(_GS3 ) , -Q_NOTE(_A3 ) , -Q_NOTE(_AS3 ) , -Q_NOTE(_B3 ) , -Q_NOTE(_C4 ) , -Q_NOTE(_CS4 ) , -Q_NOTE(_D4 ) , -Q_NOTE(_DS4 ) , -Q_NOTE(_E4 ) , -Q_NOTE(_F4 ) , -Q_NOTE(_FS4 ) , -Q_NOTE(_G4 ) , -Q_NOTE(_GS4 ) , -Q_NOTE(_A4 ) , -Q_NOTE(_AS4 ) , -Q_NOTE(_B4 ) , -Q_NOTE(_C5 ) , -Q_NOTE(_CS5 ) , -Q_NOTE(_D5 ) , -Q_NOTE(_DS5 ) , -Q_NOTE(_E5 ) , -Q_NOTE(_F5 ) , -Q_NOTE(_FS5 ) , -Q_NOTE(_G5 ) , -Q_NOTE(_GS5 ) , -Q_NOTE(_A5 ) , -Q_NOTE(_AS5 ) , -Q_NOTE(_B5 ) , -Q_NOTE(_C6 ) , -Q_NOTE(_CS6 ) , -Q_NOTE(_D6 ) , -Q_NOTE(_DS6 ) , -Q_NOTE(_E6 ) , -Q_NOTE(_F6 ) , -Q_NOTE(_FS6 ) , -Q_NOTE(_G6 ) , -Q_NOTE(_GS6 ) , -Q_NOTE(_A6 ) , -Q_NOTE(_AS6 ) , -Q_NOTE(_B6 ) , -Q_NOTE(_C7 ) , -Q_NOTE(_CS7 ) , -Q_NOTE(_D7 ) , -Q_NOTE(_DS7 ) , -Q_NOTE(_E7 ) , -Q_NOTE(_F7 ) , -Q_NOTE(_FS7 ) , -Q_NOTE(_G7 ) , -Q_NOTE(_GS7 ) , -Q_NOTE(_A7 ) , -Q_NOTE(_AS7 ) , -Q_NOTE(_B7 ) , -Q_NOTE(_C8 ) , -Q_NOTE(_CS8 ) , -Q_NOTE(_D8 ) , -Q_NOTE(_DS8 ) , -Q_NOTE(_E8 ) , -Q_NOTE(_F8 ) , -Q_NOTE(_FS8 ) , -Q_NOTE(_G8 ) , -Q_NOTE(_GS8 ) , -Q_NOTE(_A8 ) , -Q_NOTE(_AS8 ) , -Q_NOTE(_B8 ) , - -}; - -float tone_rs[][2] = { -Q_NOTE(_A4 ) , -Q_NOTE(_A4 ) , -Q_NOTE(_A4 ) , -Q_NOTE(_A4 ) , -Q_NOTE(_AS8 ) , -Q_NOTE(_B8 ) , -}; - -#endif - void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) { if (order) @@ -241,7 +107,6 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l const uint16_t PROGMEM fn_actions[] = { }; -//#define MUSIC_ARRAY_SIZE(x) (((int)(sizeof(x) / (sizeof(x[0][0])))) / 2) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { @@ -280,30 +145,140 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; }; + + #ifdef AUDIO_ENABLE -float start_up[][2] = { -Q_NOTE(_E4 ) , -Q_NOTE(_E4 ) , -Q_NOTE(_F4 ) , -Q_NOTE(_G4 ) , -Q_NOTE(_G4 ) , -Q_NOTE(_F4 ) , -Q_NOTE(_E4 ) , -Q_NOTE(_D4 ) , -Q_NOTE(_C4 ) , -Q_NOTE(_C4 ) , -Q_NOTE(_D4 ) , -Q_NOTE(_E4 ) , -H_NOTE(_E4 ) , -Q_NOTE(_D4 ) , -H_NOTE(_D4 ) , + +float start_up[][2] = SONG(ODE_TO_JOY); + +float tone_lw[][2] = { + /* + Q__NOTE(_C1 ) , + Q__NOTE(_CS1 ) , + Q__NOTE(_D1 ) , + Q__NOTE(_DS1 ) , + Q__NOTE(_E1 ) , + Q__NOTE(_F1 ) , + Q__NOTE(_FS1 ) , + Q__NOTE(_G1 ) , + Q__NOTE(_GS1 ) , + Q__NOTE(_A1 ) , + Q__NOTE(_AS1 ) , + Q__NOTE(_B1 ) , + */ + + Q__NOTE(_C4 ) , + Q__NOTE(_CS4 ) , + Q__NOTE(_D4 ) , + Q__NOTE(_DS4 ) , + Q__NOTE(_E4 ) , + Q__NOTE(_F4 ) , + Q__NOTE(_FS4 ) , + Q__NOTE(_G4 ) , + Q__NOTE(_GS4 ) , + Q__NOTE(_A4 ) , + Q__NOTE(_AS4 ) , + Q__NOTE(_B1 ) , + + Q__NOTE(_C2 ) , + Q__NOTE(_CS2 ) , + Q__NOTE(_D2 ) , + Q__NOTE(_DS2 ) , + Q__NOTE(_E2 ) , + Q__NOTE(_F2 ) , + Q__NOTE(_FS2 ) , + Q__NOTE(_G2 ) , + Q__NOTE(_GS2 ) , + Q__NOTE(_A2 ) , + Q__NOTE(_AS2 ) , + Q__NOTE(_B2 ) , + Q__NOTE(_C3 ) , + Q__NOTE(_CS3 ) , + Q__NOTE(_D3 ) , + Q__NOTE(_DS3 ) , + Q__NOTE(_E3 ) , + Q__NOTE(_F3 ) , + Q__NOTE(_FS3 ) , + Q__NOTE(_G3 ) , + Q__NOTE(_GS3 ) , + Q__NOTE(_A3 ) , + Q__NOTE(_AS3 ) , + Q__NOTE(_B3 ) , + Q__NOTE(_C4 ) , + Q__NOTE(_CS4 ) , + Q__NOTE(_D4 ) , + Q__NOTE(_DS4 ) , + Q__NOTE(_E4 ) , + Q__NOTE(_F4 ) , + Q__NOTE(_FS4 ) , + Q__NOTE(_G4 ) , + Q__NOTE(_GS4 ) , + Q__NOTE(_A4 ) , + Q__NOTE(_AS4 ) , + Q__NOTE(_B4 ) , + Q__NOTE(_C5 ) , + Q__NOTE(_CS5 ) , + Q__NOTE(_D5 ) , + Q__NOTE(_DS5 ) , + Q__NOTE(_E5 ) , + Q__NOTE(_F5 ) , + Q__NOTE(_FS5 ) , + Q__NOTE(_G5 ) , + Q__NOTE(_GS5 ) , + Q__NOTE(_A5 ) , + Q__NOTE(_AS5 ) , + Q__NOTE(_B5 ) , + Q__NOTE(_C6 ) , + Q__NOTE(_CS6 ) , + Q__NOTE(_D6 ) , + Q__NOTE(_DS6 ) , + Q__NOTE(_E6 ) , + Q__NOTE(_F6 ) , + Q__NOTE(_FS6 ) , + Q__NOTE(_G6 ) , + Q__NOTE(_GS6 ) , + Q__NOTE(_A6 ) , + Q__NOTE(_AS6 ) , + Q__NOTE(_B6 ) , + Q__NOTE(_C7 ) , + Q__NOTE(_CS7 ) , + Q__NOTE(_D7 ) , + Q__NOTE(_DS7 ) , + Q__NOTE(_E7 ) , + Q__NOTE(_F7 ) , + Q__NOTE(_FS7 ) , + Q__NOTE(_G7 ) , + Q__NOTE(_GS7 ) , + Q__NOTE(_A7 ) , + Q__NOTE(_AS7 ) , + Q__NOTE(_B7 ) , + Q__NOTE(_C8 ) , + Q__NOTE(_CS8 ) , + Q__NOTE(_D8 ) , + Q__NOTE(_DS8 ) , + Q__NOTE(_E8 ) , + Q__NOTE(_F8 ) , + Q__NOTE(_FS8 ) , + Q__NOTE(_G8 ) , + Q__NOTE(_GS8 ) , + Q__NOTE(_A8 ) , + Q__NOTE(_AS8 ) , + Q__NOTE(_B8 ) , +}; + +float tone_rs[][2] = { + Q__NOTE(_A4 ) , + Q__NOTE(_A4 ) , + Q__NOTE(_A4 ) , + Q__NOTE(_A4 ) , + Q__NOTE(_AS8 ) , + Q__NOTE(_B8 ) , }; -#endif void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - init_notes(); - PLAY_NOTE_ARRAY(start_up, false, STACCATO); - println("Matrix Init"); - #endif + init_notes(); + PLAY_NOTE_ARRAY(start_up, false, STACCATO); + println("Matrix Init"); } + +#endif -- cgit v1.2.3 From 29e495be2a57d1eb41699909b204c12ac6bc4c0e Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sun, 17 Apr 2016 02:52:38 -0500 Subject: Added trimble and tempo adjustments! --- keyboard/atomic/keymaps/pvc/keymap.c | 216 ++++++++++++++++++++--------------- 1 file changed, 123 insertions(+), 93 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 9a2c57cb18..aaef6b041d 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -17,6 +17,13 @@ #define M_LW 1 #define M_RS 2 #define M_FN 3 +#define M_T1 4 +#define M_T2 5 +#define M_T3 6 +#define M_T4 7 +#define M_TU 8 +#define M_TD 9 +#define M_DF 10 #define _______ KC_TRNS @@ -63,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, + { _______, M(M_T1), M(M_T2), M(M_T3), M(M_T4), M(M_TU), M(M_TD), M(M_DF), _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, [_AD] = { /* ADJUST */ @@ -75,76 +82,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, }; -void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) -{ - if (order) - { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - layer_on(layer3); - } - else - { - layer_off(layer3); - layer_off(layer4); - } - } - else - { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - layer_on(layer4); - } - else - { - layer_off(layer3); - layer_off(layer4); - } - } -} - - -const uint16_t PROGMEM fn_actions[] = { -}; - - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - - // MACRODOWN only works in this function - switch(id) { - case M_LW: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - println("PlayNotes LW"); - PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); - #endif - layer_on(_LW); - update_tri_layer(_LW, _RS, _FN); - } else { - layer_off(_LW); - update_tri_layer(_LW, _RS, _FN); - } - break; - case M_RS: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - println("PlayNotes RS"); - PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); - #endif - layer_on(_RS); - update_tri_layer(_LW, _RS, _FN); - } else { - layer_off(_RS); - update_tri_layer(_LW, _RS, _FN); - } - break; - default: - break; - } - return MACRO_NONE; -}; - #ifdef AUDIO_ENABLE @@ -152,20 +89,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) float start_up[][2] = SONG(ODE_TO_JOY); float tone_lw[][2] = { - /* - Q__NOTE(_C1 ) , - Q__NOTE(_CS1 ) , - Q__NOTE(_D1 ) , - Q__NOTE(_DS1 ) , - Q__NOTE(_E1 ) , - Q__NOTE(_F1 ) , - Q__NOTE(_FS1 ) , - Q__NOTE(_G1 ) , - Q__NOTE(_GS1 ) , - Q__NOTE(_A1 ) , - Q__NOTE(_AS1 ) , - Q__NOTE(_B1 ) , - */ Q__NOTE(_C4 ) , Q__NOTE(_CS4 ) , @@ -178,6 +101,7 @@ float tone_lw[][2] = { Q__NOTE(_GS4 ) , Q__NOTE(_A4 ) , Q__NOTE(_AS4 ) , + Q__NOTE(_B1 ) , Q__NOTE(_C2 ) , @@ -266,14 +190,7 @@ float tone_lw[][2] = { Q__NOTE(_B8 ) , }; -float tone_rs[][2] = { - Q__NOTE(_A4 ) , - Q__NOTE(_A4 ) , - Q__NOTE(_A4 ) , - Q__NOTE(_A4 ) , - Q__NOTE(_AS8 ) , - Q__NOTE(_B8 ) , -}; +float tone_rs[][2] = SONG(ROCK_A_BYE_BABY); void matrix_init_user(void) { init_notes(); @@ -282,3 +199,116 @@ void matrix_init_user(void) { } #endif + + +void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) +{ + if (order) + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer3); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } + else + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer4); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } +} + + +const uint16_t PROGMEM fn_actions[] = { +}; + + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + + // MACRODOWN only works in this function + switch(id) + { + case M_LW: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); + #endif + layer_on(_LW); + update_tri_layer(_LW, _RS, _AD); + } else { + layer_off(_LW); + update_tri_layer(_LW, _RS, _AD); + } + break; + case M_RS: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); + #endif + layer_on(_RS); + update_tri_layer(_LW, _RS, _AD); + } else { + layer_off(_RS); + update_tri_layer(_LW, _RS, _AD); + } + break; + + case M_FN: + if (record->event.pressed) { + layer_on(_FN); + } else { + layer_off(_FN); + } + break; + + case M_T1: + if (record->event.pressed) set_timbre(TIMBRE_12); + break; + + case M_T2: + if (record->event.pressed) set_timbre(TIMBRE_25); + break; + + case M_T3: + if (record->event.pressed) set_timbre(TIMBRE_50); + break; + + case M_T4: + if (record->event.pressed) set_timbre(TIMBRE_75); + break; + + + case M_TU: + if (record->event.pressed) increase_tempo(10); + break; + + case M_TD: + if (record->event.pressed) decrease_tempo(10); + break; + + case M_DF: + if (record->event.pressed) + { + set_timbre(TIMBRE_DEFAULT); + set_tempo(TEMPO_DEFAULT); + } + break; + + default: + break; + + } + return MACRO_NONE; +}; \ No newline at end of file -- cgit v1.2.3 From 5c98ad59606ee95b82c27bf2525383a9ec88542b Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sun, 17 Apr 2016 20:14:37 -0500 Subject: Added extra songs, LED indicator notes --- keyboard/atomic/keymaps/pvc/keymap.c | 292 ++++++++++++++++++++--------------- 1 file changed, 168 insertions(+), 124 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index aaef6b041d..563519e4c0 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -1,17 +1,18 @@ #include "atomic.h" #include "action_layer.h" +#include "led.h" #ifdef AUDIO_ENABLE #include "audio.h" #include "song_list.h" #endif - #define _QW 0 #define _LW 1 #define _RS 2 #define _AD 3 #define _FN 4 +#define _MUSIC 4 #define M_QW 0 #define M_LW 1 @@ -24,6 +25,24 @@ #define M_TU 8 #define M_TD 9 #define M_DF 10 +#define M_MUSIC_ON 11 +#define M_MUSIC_OFF 12 +#define M_AUDIO_ON 13 +#define M_AUDIO_OFF 14 + +#define TIMBR_1 M(M_T1) +#define TIMBR_2 M(M_T2) +#define TIMBR_3 M(M_T3) +#define TIMBR_4 M(M_T4) +#define TMPO_UP M(M_TU) +#define TMPO_DN M(M_TD) +#define TMPO_DF M(M_DF) + + +#define MUS_ON M(M_MUSIC_ON) +#define MUS_OFF M(M_MUSIC_OFF) +#define AUD_OFF M(M_AUDIO_OFF) +#define AUD_ON M(M_AUDIO_ON) #define _______ KC_TRNS @@ -70,135 +89,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, - { _______, M(M_T1), M(M_T2), M(M_T3), M(M_T4), M(M_TU), M(M_TD), M(M_DF), _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, [_AD] = { /* ADJUST */ + { _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, +[_MUSIC] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - }, -}; - - - -#ifdef AUDIO_ENABLE +} -float start_up[][2] = SONG(ODE_TO_JOY); - -float tone_lw[][2] = { - - Q__NOTE(_C4 ) , - Q__NOTE(_CS4 ) , - Q__NOTE(_D4 ) , - Q__NOTE(_DS4 ) , - Q__NOTE(_E4 ) , - Q__NOTE(_F4 ) , - Q__NOTE(_FS4 ) , - Q__NOTE(_G4 ) , - Q__NOTE(_GS4 ) , - Q__NOTE(_A4 ) , - Q__NOTE(_AS4 ) , - - Q__NOTE(_B1 ) , - - Q__NOTE(_C2 ) , - Q__NOTE(_CS2 ) , - Q__NOTE(_D2 ) , - Q__NOTE(_DS2 ) , - Q__NOTE(_E2 ) , - Q__NOTE(_F2 ) , - Q__NOTE(_FS2 ) , - Q__NOTE(_G2 ) , - Q__NOTE(_GS2 ) , - Q__NOTE(_A2 ) , - Q__NOTE(_AS2 ) , - Q__NOTE(_B2 ) , - Q__NOTE(_C3 ) , - Q__NOTE(_CS3 ) , - Q__NOTE(_D3 ) , - Q__NOTE(_DS3 ) , - Q__NOTE(_E3 ) , - Q__NOTE(_F3 ) , - Q__NOTE(_FS3 ) , - Q__NOTE(_G3 ) , - Q__NOTE(_GS3 ) , - Q__NOTE(_A3 ) , - Q__NOTE(_AS3 ) , - Q__NOTE(_B3 ) , - Q__NOTE(_C4 ) , - Q__NOTE(_CS4 ) , - Q__NOTE(_D4 ) , - Q__NOTE(_DS4 ) , - Q__NOTE(_E4 ) , - Q__NOTE(_F4 ) , - Q__NOTE(_FS4 ) , - Q__NOTE(_G4 ) , - Q__NOTE(_GS4 ) , - Q__NOTE(_A4 ) , - Q__NOTE(_AS4 ) , - Q__NOTE(_B4 ) , - Q__NOTE(_C5 ) , - Q__NOTE(_CS5 ) , - Q__NOTE(_D5 ) , - Q__NOTE(_DS5 ) , - Q__NOTE(_E5 ) , - Q__NOTE(_F5 ) , - Q__NOTE(_FS5 ) , - Q__NOTE(_G5 ) , - Q__NOTE(_GS5 ) , - Q__NOTE(_A5 ) , - Q__NOTE(_AS5 ) , - Q__NOTE(_B5 ) , - Q__NOTE(_C6 ) , - Q__NOTE(_CS6 ) , - Q__NOTE(_D6 ) , - Q__NOTE(_DS6 ) , - Q__NOTE(_E6 ) , - Q__NOTE(_F6 ) , - Q__NOTE(_FS6 ) , - Q__NOTE(_G6 ) , - Q__NOTE(_GS6 ) , - Q__NOTE(_A6 ) , - Q__NOTE(_AS6 ) , - Q__NOTE(_B6 ) , - Q__NOTE(_C7 ) , - Q__NOTE(_CS7 ) , - Q__NOTE(_D7 ) , - Q__NOTE(_DS7 ) , - Q__NOTE(_E7 ) , - Q__NOTE(_F7 ) , - Q__NOTE(_FS7 ) , - Q__NOTE(_G7 ) , - Q__NOTE(_GS7 ) , - Q__NOTE(_A7 ) , - Q__NOTE(_AS7 ) , - Q__NOTE(_B7 ) , - Q__NOTE(_C8 ) , - Q__NOTE(_CS8 ) , - Q__NOTE(_D8 ) , - Q__NOTE(_DS8 ) , - Q__NOTE(_E8 ) , - Q__NOTE(_F8 ) , - Q__NOTE(_FS8 ) , - Q__NOTE(_G8 ) , - Q__NOTE(_GS8 ) , - Q__NOTE(_A8 ) , - Q__NOTE(_AS8 ) , - Q__NOTE(_B8 ) , }; -float tone_rs[][2] = SONG(ROCK_A_BYE_BABY); +#ifdef AUDIO_ENABLE -void matrix_init_user(void) { - init_notes(); - PLAY_NOTE_ARRAY(start_up, false, STACCATO); - println("Matrix Init"); -} +float tone_my_startup[][2] = SONG(ODE_TO_JOY); +float tone_my_goodbye[][2] = SONG(ROCK_A_BYE_BABY); +float tone_audio_on[][2] = SONG(CLOSE_ENCOUNTERS_5_NOTE); +float tone_music_on[][2] = SONG(DOE_A_DEER); +float tone_caps_on[][2] = SONG(CAPS_LOCK_ON_SOUND); +float tone_caps_off[][2] = SONG(CAPS_LOCK_OFF_SOUND); +float tone_numlk_on[][2] = SONG(NUM_LOCK_ON_SOUND); +float tone_numlk_off[][2] = SONG(NUM_LOCK_OFF_SOUND); +float tone_scroll_on[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float tone_scroll_off[][2] = SONG(SCROLL_LOCK_OFF_SOUND); -#endif +#endif /* AUDIO_ENABLE */ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) @@ -242,9 +166,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { case M_LW: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); - #endif layer_on(_LW); update_tri_layer(_LW, _RS, _AD); } else { @@ -254,9 +175,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; case M_RS: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); - #endif layer_on(_RS); update_tri_layer(_LW, _RS, _AD); } else { @@ -306,9 +224,135 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; + case M_AUDIO_OFF: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + audio_off(); + #endif + } + break; + + case M_AUDIO_ON: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + audio_on(); + PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO); + #endif + } + break; + + case M_MUSIC_ON: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO); + layer_on(_MUSIC); + #endif + } + break; + + case M_MUSIC_OFF: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + layer_off(_MUSIC); + stop_all_notes(); + #endif + } + break; + default: break; } return MACRO_NONE; -}; \ No newline at end of file +}; + + +#ifdef AUDIO_ENABLE + +uint8_t starting_note = 0x0C; +int offset = 7; + + +void process_action_user(keyrecord_t *record) +{ + if (IS_LAYER_ON(_MUSIC)) + { + if (record->event.pressed) + { + play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); + } + else + { + stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); + } + } +} + + +void matrix_init_user(void) +{ + init_notes(); + play_startup_tone(); + println("Matrix Init"); +} + +void led_set_user(uint8_t usb_led) +{ + static uint8_t old_usb_led = 0; + static bool first_run = true; + + // Skip first execution to avoid beeps caused by LED states being detected on power-up + if (!first_run) + { + + if ((usb_led & (1< Date: Sun, 17 Apr 2016 22:08:05 -0500 Subject: Notes Bugfix --- keyboard/atomic/keymaps/pvc/keymap.c | 65 ++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 36 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 563519e4c0..f88d5117c9 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -302,45 +302,38 @@ void matrix_init_user(void) void led_set_user(uint8_t usb_led) { static uint8_t old_usb_led = 0; - static bool first_run = true; - // Skip first execution to avoid beeps caused by LED states being detected on power-up - if (!first_run) + if ((usb_led & (1< Date: Mon, 18 Apr 2016 01:58:25 -0500 Subject: Added CM/DK --- keyboard/atomic/keymaps/pvc/keymap.c | 298 ++++++++++++++++++++++++----------- 1 file changed, 202 insertions(+), 96 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index f88d5117c9..380e69ee93 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -1,55 +1,66 @@ #include "atomic.h" #include "action_layer.h" +#include "eeconfig.h" #include "led.h" #ifdef AUDIO_ENABLE -#include "audio.h" -#include "song_list.h" + #include "audio.h" + #include "song_list.h" #endif -#define _QW 0 -#define _LW 1 -#define _RS 2 -#define _AD 3 -#define _FN 4 -#define _MUSIC 4 - -#define M_QW 0 -#define M_LW 1 -#define M_RS 2 -#define M_FN 3 -#define M_T1 4 -#define M_T2 5 -#define M_T3 6 -#define M_T4 7 -#define M_TU 8 -#define M_TD 9 -#define M_DF 10 -#define M_MUSIC_ON 11 -#define M_MUSIC_OFF 12 -#define M_AUDIO_ON 13 -#define M_AUDIO_OFF 14 - -#define TIMBR_1 M(M_T1) -#define TIMBR_2 M(M_T2) -#define TIMBR_3 M(M_T3) -#define TIMBR_4 M(M_T4) -#define TMPO_UP M(M_TU) -#define TMPO_DN M(M_TD) -#define TMPO_DF M(M_DF) - - -#define MUS_ON M(M_MUSIC_ON) -#define MUS_OFF M(M_MUSIC_OFF) -#define AUD_OFF M(M_AUDIO_OFF) -#define AUD_ON M(M_AUDIO_ON) - - -#define _______ KC_TRNS -#define ___T___ KC_TRNS -#define XXXXXXX KC_NO - -/* +#define LAYER_QWERTY 0 +#define LAYER_COLEMAK 1 +#define LAYER_DVORAK 2 +#define LAYER_LOWER 3 +#define LAYER_RAISE 4 +#define LAYER_ADJUST 5 +#define LAYER_FUNCTION 6 +#define LAYER_MUSIC 7 + +#define MACRO_QWERTY 0 +#define MACRO_COLEMAK 1 +#define MACRO_DVORAK 2 +#define MACRO_LOWER 3 +#define MACRO_RAISE 4 +#define MACRO_FUNCTION 5 +#define MACRO_TIMBRE_1 6 +#define MACRO_TIMBRE_2 7 +#define MACRO_TIMBRE_3 8 +#define MACRO_TIMBRE_4 9 +#define MACRO_TEMPO_U 10 +#define MACRO_TEMPO_D 11 +#define MACRO_TONE_DEFAULT 12 +#define MACRO_MUSIC_ON 13 +#define MACRO_MUSIC_OFF 14 +#define MACRO_AUDIO_ON 15 +#define MACRO_AUDIO_OFF 16 + +#define M_QWRTY M(MACRO_QWERTY) +#define M_COLMK M(MACRO_COLEMAK) +#define M_DVORK M(MACRO_DVORAK) +#define M_LOWER M(MACRO_LOWER) +#define M_RAISE M(MACRO_RAISE) +#define M_FUNCT M(MACRO_FUNCTION) +#define TIMBR_1 M(MACRO_TIMBRE_1) +#define TIMBR_2 M(MACRO_TIMBRE_2) +#define TIMBR_3 M(MACRO_TIMBRE_3) +#define TIMBR_4 M(MACRO_TIMBRE_4) +#define TMPO_UP M(MACRO_TEMPO_U) +#define TMPO_DN M(MACRO_TEMPO_D) +#define TMPO_DF M(MACRO_TONE_DEFAULT) + + +#define MUS_ON M(MACRO_MUSIC_ON) +#define MUS_OFF M(MACRO_MUSIC_OFF) +#define AUD_OFF M(MACRO_AUDIO_OFF) +#define AUD_ON M(MACRO_AUDIO_ON) + + +#define _______ KC_TRNS +#define ___T___ KC_TRNS +#define XXXXXXX KC_NO + +/* QWERTY * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| @@ -64,55 +75,109 @@ */ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QW] = { /* QWERTY */ + [LAYER_QWERTY] = { /* QWERTY */ { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX }, { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP }, { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN }, - { KC_LCTL, KC_LGUI, M(M_FN), KC_LALT, M(M_RS), KC_SPC, XXXXXXX, M(M_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + }, + + /* COLEMAK + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | Q | W | F | P | G | J | L | U | Y | ; | [ | ] | \ | DEL | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | CAPS | A | R | S | T | D | H | N | E | I | O | ' | XXXXXX . ENTER | PG UP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | LSHIFT | Z | X | C | V | B | K | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | LCTRL | LWIN | FN | LALT | RAISED | XXXXXX . SPACE | LOWER | RALT | HOME | END | RCTRL | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [LAYER_COLEMAK] = { /* COLEMAK */ + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC }, + { KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, + { KC_CAPS, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP }, + { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN }, + { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + }, + +/* DVORAK + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | ' | , | . | P | Y | F | G | C | R | L | [ | ] | \ | DEL | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | CAPS | A | O | E | U | I | D | H | T | N | S | / | XXXXXX . ENTER | PG UP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | LSHIFT | ; | Q | J | K | X | B | M | W | V | Z | XXXXXX . RSHIFT | UP | PG DN | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | LCTRL | LWIN | FN | LALT | RAISED | XXXXXX . SPACE | LOWER | RALT | HOME | END | RCTRL | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [LAYER_DVORAK] = { /* DVORAK */ + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC }, + { KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, + { KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, KC_ENT, KC_ENT, KC_PGUP }, + { KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN }, + { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, }, - [_LW] = { /* LOWERED */ + + + [LAYER_LOWER] = { /* LOWERED */ { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, }, - [_RS] = { /* RAISED */ + + [LAYER_RAISE] = { /* RAISED */ { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, }, - [_FN] = { /* FUNCTION */ + + [LAYER_FUNCTION] = { /* FUNCTION */ { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, - [_AD] = { /* ADJUST */ + + [LAYER_ADJUST] = { /* ADJUST */ { _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF, ___T___, ___T___ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, }, -[_MUSIC] = { + + [LAYER_MUSIC] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, -} - + }, }; #ifdef AUDIO_ENABLE float tone_my_startup[][2] = SONG(ODE_TO_JOY); float tone_my_goodbye[][2] = SONG(ROCK_A_BYE_BABY); + +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(COLEMAK_SOUND); +float tone_colemak[][2] = SONG(DVORAK_SOUND); + float tone_audio_on[][2] = SONG(CLOSE_ENCOUNTERS_5_NOTE); float tone_music_on[][2] = SONG(DOE_A_DEER); float tone_caps_on[][2] = SONG(CAPS_LOCK_ON_SOUND); @@ -124,7 +189,7 @@ float tone_scroll_off[][2] = SONG(SCROLL_LOCK_OFF_SOUND); #endif /* AUDIO_ENABLE */ - +/* void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) { if (order) @@ -152,71 +217,111 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l } } } +*/ +void persistant_default_layer_set(uint16_t default_layer) +{ + eeconfig_write_default_layer(default_layer); + default_layer_set(default_layer); +} const uint16_t PROGMEM fn_actions[] = { }; - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function switch(id) { - case M_LW: - if (record->event.pressed) { - layer_on(_LW); - update_tri_layer(_LW, _RS, _AD); - } else { - layer_off(_LW); - update_tri_layer(_LW, _RS, _AD); + + case MACRO_QWERTY: + if (record->event.pressed) + { + persistant_default_layer_set(1UL<event.pressed) + { + persistant_default_layer_set(1UL<event.pressed) + { + persistant_default_layer_set(1UL<event.pressed) + { + layer_on(LAYER_LOWER); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); + } + else + { + layer_off(LAYER_LOWER); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } break; - case M_RS: - if (record->event.pressed) { - layer_on(_RS); - update_tri_layer(_LW, _RS, _AD); - } else { - layer_off(_RS); - update_tri_layer(_LW, _RS, _AD); + + case MACRO_RAISE: + if (record->event.pressed) + { + layer_on(LAYER_RAISE); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); + } + else + { + layer_off(LAYER_RAISE); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } break; - case M_FN: - if (record->event.pressed) { - layer_on(_FN); - } else { - layer_off(_FN); + case MACRO_FUNCTION: + if (record->event.pressed) + { + layer_on(LAYER_FUNCTION); + } + else + { + layer_off(LAYER_FUNCTION); } break; - case M_T1: + case MACRO_TIMBRE_1: if (record->event.pressed) set_timbre(TIMBRE_12); break; - case M_T2: + case MACRO_TIMBRE_2: if (record->event.pressed) set_timbre(TIMBRE_25); break; - case M_T3: + case MACRO_TIMBRE_3: if (record->event.pressed) set_timbre(TIMBRE_50); break; - case M_T4: + case MACRO_TIMBRE_4: if (record->event.pressed) set_timbre(TIMBRE_75); break; - - case M_TU: + case MACRO_TEMPO_U: if (record->event.pressed) increase_tempo(10); break; - case M_TD: + case MACRO_TEMPO_D: if (record->event.pressed) decrease_tempo(10); break; - case M_DF: + case MACRO_TONE_DEFAULT: if (record->event.pressed) { set_timbre(TIMBRE_DEFAULT); @@ -224,40 +329,41 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; - case M_AUDIO_OFF: - if (record->event.pressed) { + case MACRO_AUDIO_OFF: + if (record->event.pressed) + { #ifdef AUDIO_ENABLE - audio_off(); + audio_off(); #endif } break; - case M_AUDIO_ON: + case MACRO_AUDIO_ON: if (record->event.pressed) { #ifdef AUDIO_ENABLE - audio_on(); + audio_on(); PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO); #endif } break; - case M_MUSIC_ON: + case MACRO_MUSIC_ON: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO); - layer_on(_MUSIC); + PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO); + layer_on(LAYER_MUSIC); #endif } break; - case M_MUSIC_OFF: + case MACRO_MUSIC_OFF: if (record->event.pressed) { #ifdef AUDIO_ENABLE - layer_off(_MUSIC); - stop_all_notes(); + layer_off(LAYER_MUSIC); + stop_all_notes(); #endif } break; @@ -278,7 +384,7 @@ int offset = 7; void process_action_user(keyrecord_t *record) { - if (IS_LAYER_ON(_MUSIC)) + if (IS_LAYER_ON(LAYER_MUSIC)) { if (record->event.pressed) { -- cgit v1.2.3 From 4b3358acc270772e5605397bab26fb5db981084d Mon Sep 17 00:00:00 2001 From: IBNobody Date: Mon, 18 Apr 2016 18:58:37 -0500 Subject: Fixed speaker being on during sleep. --- keyboard/atomic/keymaps/pvc/keymap.c | 462 ++++++++++++++++++----------------- 1 file changed, 237 insertions(+), 225 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 380e69ee93..36098f1eba 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -4,8 +4,8 @@ #include "led.h" #ifdef AUDIO_ENABLE - #include "audio.h" - #include "song_list.h" + #include "audio.h" + #include "song_list.h" #endif #define LAYER_QWERTY 0 @@ -56,6 +56,18 @@ #define AUD_ON M(MACRO_AUDIO_ON) +#define SC_UNDO LCTL(KC_Z) +#define SC_REDO LCTL(KC_Y) +#define SC_CUT LCTL(KC_X) +#define SC_COPY LCTL(KC_C) +#define SC_PSTE LCTL(KC_V) +#define SC_SELA LCTL(KC_A) +#define SC_SAVE LCTL(KC_S) +#define SC_OPEN LCTL(KC_O) +#define SC_ACLS LALT(KC_F4) +#define SC_CCLS LCTL(KC_F4) + + #define _______ KC_TRNS #define ___T___ KC_TRNS #define XXXXXXX KC_NO @@ -107,11 +119,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* DVORAK * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. - * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | [ | ] | XXXXXX . BACKSP | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| - * | TAB | ' | , | . | P | Y | F | G | C | R | L | [ | ] | \ | DEL | + * | TAB | ' | , | . | P | Y | F | G | C | R | L | / | = | \ | DEL | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| - * | CAPS | A | O | E | U | I | D | H | T | N | S | / | XXXXXX . ENTER | PG UP | + * | CAPS | A | O | E | U | I | D | H | T | N | S | - | XXXXXX . ENTER | PG UP | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| * | LSHIFT | ; | Q | J | K | X | B | M | W | V | Z | XXXXXX . RSHIFT | UP | PG DN | * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| @@ -120,9 +132,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [LAYER_DVORAK] = { /* DVORAK */ - { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC }, - { KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, - { KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, KC_ENT, KC_ENT, KC_PGUP }, + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_BSPC }, + { KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_DEL }, + { KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_ENT, KC_PGUP }, { KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN }, { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, }, @@ -130,18 +142,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [LAYER_LOWER] = { /* LOWERED */ { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, _______, _______, _______, SC_CCLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, SC_REDO, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, _______, _______, _______, _______, _______, _______, _______ }, }, [LAYER_RAISE] = { /* RAISED */ { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, SC_ACLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, SC_SELA, SC_SAVE, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, SC_UNDO, SC_CUT, SC_COPY, SC_PSTE, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, _______, _______ }, }, [LAYER_FUNCTION] = { /* FUNCTION */ @@ -157,7 +169,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, _______, _______ }, }, [LAYER_MUSIC] = { @@ -165,7 +177,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, _______, _______ }, }, }; @@ -192,37 +204,37 @@ float tone_scroll_off[][2] = SONG(SCROLL_LOCK_OFF_SOUND); /* void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) { - if (order) - { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - layer_on(layer3); - } - else - { - layer_off(layer3); - layer_off(layer4); - } - } - else - { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - layer_on(layer4); - } - else - { - layer_off(layer3); - layer_off(layer4); - } - } + if (order) + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer3); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } + else + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer4); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } } */ void persistant_default_layer_set(uint16_t default_layer) { - eeconfig_write_default_layer(default_layer); - default_layer_set(default_layer); + eeconfig_write_default_layer(default_layer); + default_layer_set(default_layer); } const uint16_t PROGMEM fn_actions[] = { @@ -231,148 +243,148 @@ const uint16_t PROGMEM fn_actions[] = { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - // MACRODOWN only works in this function - switch(id) - { - - case MACRO_QWERTY: - if (record->event.pressed) - { - persistant_default_layer_set(1UL<event.pressed) - { - persistant_default_layer_set(1UL<event.pressed) - { - persistant_default_layer_set(1UL<event.pressed) - { - layer_on(LAYER_LOWER); - update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); - } - else - { - layer_off(LAYER_LOWER); - update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); - } - break; - - case MACRO_RAISE: - if (record->event.pressed) - { - layer_on(LAYER_RAISE); - update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); - } - else - { - layer_off(LAYER_RAISE); - update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); - } - break; - - case MACRO_FUNCTION: - if (record->event.pressed) - { - layer_on(LAYER_FUNCTION); - } - else - { - layer_off(LAYER_FUNCTION); - } - break; - - case MACRO_TIMBRE_1: - if (record->event.pressed) set_timbre(TIMBRE_12); - break; - - case MACRO_TIMBRE_2: - if (record->event.pressed) set_timbre(TIMBRE_25); - break; - - case MACRO_TIMBRE_3: - if (record->event.pressed) set_timbre(TIMBRE_50); - break; - - case MACRO_TIMBRE_4: - if (record->event.pressed) set_timbre(TIMBRE_75); - break; - - case MACRO_TEMPO_U: - if (record->event.pressed) increase_tempo(10); - break; - - case MACRO_TEMPO_D: - if (record->event.pressed) decrease_tempo(10); - break; - - case MACRO_TONE_DEFAULT: - if (record->event.pressed) - { - set_timbre(TIMBRE_DEFAULT); - set_tempo(TEMPO_DEFAULT); - } - break; - - case MACRO_AUDIO_OFF: - if (record->event.pressed) - { - #ifdef AUDIO_ENABLE - audio_off(); - #endif - } - break; - - case MACRO_AUDIO_ON: - if (record->event.pressed) - { - #ifdef AUDIO_ENABLE - audio_on(); - PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO); - #endif - } - break; - - case MACRO_MUSIC_ON: - if (record->event.pressed) - { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO); - layer_on(LAYER_MUSIC); - #endif - } - break; - - case MACRO_MUSIC_OFF: - if (record->event.pressed) - { - #ifdef AUDIO_ENABLE - layer_off(LAYER_MUSIC); - stop_all_notes(); - #endif - } - break; - - default: - break; - - } - return MACRO_NONE; + // MACRODOWN only works in this function + switch(id) + { + + case MACRO_QWERTY: + if (record->event.pressed) + { + persistant_default_layer_set(1UL<event.pressed) + { + persistant_default_layer_set(1UL<event.pressed) + { + persistant_default_layer_set(1UL<event.pressed) + { + layer_on(LAYER_LOWER); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); + } + else + { + layer_off(LAYER_LOWER); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); + } + break; + + case MACRO_RAISE: + if (record->event.pressed) + { + layer_on(LAYER_RAISE); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); + } + else + { + layer_off(LAYER_RAISE); + update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); + } + break; + + case MACRO_FUNCTION: + if (record->event.pressed) + { + layer_on(LAYER_FUNCTION); + } + else + { + layer_off(LAYER_FUNCTION); + } + break; + + case MACRO_TIMBRE_1: + if (record->event.pressed) set_timbre(TIMBRE_12); + break; + + case MACRO_TIMBRE_2: + if (record->event.pressed) set_timbre(TIMBRE_25); + break; + + case MACRO_TIMBRE_3: + if (record->event.pressed) set_timbre(TIMBRE_50); + break; + + case MACRO_TIMBRE_4: + if (record->event.pressed) set_timbre(TIMBRE_75); + break; + + case MACRO_TEMPO_U: + if (record->event.pressed) increase_tempo(10); + break; + + case MACRO_TEMPO_D: + if (record->event.pressed) decrease_tempo(10); + break; + + case MACRO_TONE_DEFAULT: + if (record->event.pressed) + { + set_timbre(TIMBRE_DEFAULT); + set_tempo(TEMPO_DEFAULT); + } + break; + + case MACRO_AUDIO_OFF: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + audio_off(); + #endif + } + break; + + case MACRO_AUDIO_ON: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + audio_on(); + PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO); + #endif + } + break; + + case MACRO_MUSIC_ON: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO); + layer_on(LAYER_MUSIC); + #endif + } + break; + + case MACRO_MUSIC_OFF: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + layer_off(LAYER_MUSIC); + stop_all_notes(); + #endif + } + break; + + default: + break; + + } + return MACRO_NONE; }; @@ -384,74 +396,74 @@ int offset = 7; void process_action_user(keyrecord_t *record) { - if (IS_LAYER_ON(LAYER_MUSIC)) - { - if (record->event.pressed) - { - play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); - } - else - { - stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); - } - } + if (IS_LAYER_ON(LAYER_MUSIC)) + { + if (record->event.pressed) + { + play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); + } + else + { + stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); + } + } } void matrix_init_user(void) { - init_notes(); - play_startup_tone(); - println("Matrix Init"); + init_notes(); + play_startup_tone(); + println("Matrix Init"); } void led_set_user(uint8_t usb_led) { - static uint8_t old_usb_led = 0; + static uint8_t old_usb_led = 0; - if ((usb_led & (1< Date: Thu, 21 Apr 2016 19:35:18 -0700 Subject: Update functions used to write to EEPROM --- keyboard/atomic/keymaps/pvc/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 36098f1eba..95a26c5b4d 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -233,7 +233,7 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l void persistant_default_layer_set(uint16_t default_layer) { - eeconfig_write_default_layer(default_layer); + eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } -- cgit v1.2.3 From 082a0f313d8c842a5de7bae30ec8a3597e35880b Mon Sep 17 00:00:00 2001 From: IBNobody Date: Fri, 22 Apr 2016 00:01:38 -0500 Subject: fixed compiler warnings (#273) --- keyboard/atomic/keymaps/pvc/keymap.c | 69 +++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 20 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 95a26c5b4d..c6642919b8 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -13,9 +13,9 @@ #define LAYER_DVORAK 2 #define LAYER_LOWER 3 #define LAYER_RAISE 4 -#define LAYER_ADJUST 5 -#define LAYER_FUNCTION 6 -#define LAYER_MUSIC 7 +#define LAYER_FUNCTION 5 +#define LAYER_MUSIC 6 +#define LAYER_ADJUST 7 #define MACRO_QWERTY 0 #define MACRO_COLEMAK 1 @@ -34,6 +34,8 @@ #define MACRO_MUSIC_OFF 14 #define MACRO_AUDIO_ON 15 #define MACRO_AUDIO_OFF 16 +#define MACRO_INC_VOICE 17 +#define MACRO_DEC_VOICE 18 #define M_QWRTY M(MACRO_QWERTY) #define M_COLMK M(MACRO_COLEMAK) @@ -54,6 +56,8 @@ #define MUS_OFF M(MACRO_MUSIC_OFF) #define AUD_OFF M(MACRO_AUDIO_OFF) #define AUD_ON M(MACRO_AUDIO_ON) +#define VC_UP M(MACRO_INC_VOICE) +#define VC_DOWN M(MACRO_DEC_VOICE) #define SC_UNDO LCTL(KC_Z) @@ -164,20 +168,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, + [LAYER_MUSIC] = { + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_RAISE, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, + }, + [LAYER_ADJUST] = { /* ADJUST */ { _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF, ___T___, ___T___ }, { _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, _______, _______ }, - }, - - [LAYER_MUSIC] = { - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, ___T___, ___T___, VC_UP, _______ }, + { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, VC_DOWN, _______ }, }, }; @@ -187,8 +191,8 @@ float tone_my_startup[][2] = SONG(ODE_TO_JOY); float tone_my_goodbye[][2] = SONG(ROCK_A_BYE_BABY); float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dvorak[][2] = SONG(COLEMAK_SOUND); -float tone_colemak[][2] = SONG(DVORAK_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_audio_on[][2] = SONG(CLOSE_ENCOUNTERS_5_NOTE); float tone_music_on[][2] = SONG(DOE_A_DEER); @@ -198,6 +202,7 @@ float tone_numlk_on[][2] = SONG(NUM_LOCK_ON_SOUND); float tone_numlk_off[][2] = SONG(NUM_LOCK_OFF_SOUND); float tone_scroll_on[][2] = SONG(SCROLL_LOCK_ON_SOUND); float tone_scroll_off[][2] = SONG(SCROLL_LOCK_OFF_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif /* AUDIO_ENABLE */ @@ -380,6 +385,26 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; + case MACRO_INC_VOICE: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + voice_iterate(); + PLAY_NOTE_ARRAY(music_scale, false, STACCATO); + #endif + } + break; + + case MACRO_DEC_VOICE: + if (record->event.pressed) + { + #ifdef AUDIO_ENABLE + voice_deiterate(); + PLAY_NOTE_ARRAY(music_scale, false, STACCATO); + #endif + } + break; + default: break; @@ -390,12 +415,13 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE -uint8_t starting_note = 0x0C; -int offset = 7; - void process_action_user(keyrecord_t *record) { + + uint8_t starting_note = 0x0C; + int offset = 7; + if (IS_LAYER_ON(LAYER_MUSIC)) { if (record->event.pressed) @@ -412,7 +438,7 @@ void process_action_user(keyrecord_t *record) void matrix_init_user(void) { - init_notes(); + set_voice(default_voice); play_startup_tone(); println("Matrix Init"); } @@ -421,6 +447,8 @@ void led_set_user(uint8_t usb_led) { static uint8_t old_usb_led = 0; + _delay_ms(10); // gets rid of tick + if ((usb_led & (1< Date: Sun, 24 Apr 2016 21:06:59 -0500 Subject: updating personal atomic keymap (#285) --- keyboard/atomic/keymaps/pvc/keymap.c | 183 +++++++++++++++++++---------------- 1 file changed, 97 insertions(+), 86 deletions(-) (limited to 'keyboard/atomic/keymaps/pvc/keymap.c') diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index c6642919b8..28aa2c3592 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -14,8 +14,9 @@ #define LAYER_LOWER 3 #define LAYER_RAISE 4 #define LAYER_FUNCTION 5 -#define LAYER_MUSIC 6 -#define LAYER_ADJUST 7 +#define LAYER_MOUSE 6 +#define LAYER_MUSIC 7 +#define LAYER_ADJUST 8 #define MACRO_QWERTY 0 #define MACRO_COLEMAK 1 @@ -23,19 +24,20 @@ #define MACRO_LOWER 3 #define MACRO_RAISE 4 #define MACRO_FUNCTION 5 -#define MACRO_TIMBRE_1 6 -#define MACRO_TIMBRE_2 7 -#define MACRO_TIMBRE_3 8 -#define MACRO_TIMBRE_4 9 -#define MACRO_TEMPO_U 10 -#define MACRO_TEMPO_D 11 -#define MACRO_TONE_DEFAULT 12 -#define MACRO_MUSIC_ON 13 -#define MACRO_MUSIC_OFF 14 -#define MACRO_AUDIO_ON 15 -#define MACRO_AUDIO_OFF 16 -#define MACRO_INC_VOICE 17 -#define MACRO_DEC_VOICE 18 +#define MACRO_MOUSE 6 +#define MACRO_TIMBRE_1 7 +#define MACRO_TIMBRE_2 8 +#define MACRO_TIMBRE_3 9 +#define MACRO_TIMBRE_4 10 +#define MACRO_TEMPO_U 11 +#define MACRO_TEMPO_D 12 +#define MACRO_TONE_DEFAULT 13 +#define MACRO_MUSIC_ON 14 +#define MACRO_MUSIC_OFF 15 +#define MACRO_AUDIO_ON 16 +#define MACRO_AUDIO_OFF 17 +#define MACRO_INC_VOICE 18 +#define MACRO_DEC_VOICE 19 #define M_QWRTY M(MACRO_QWERTY) #define M_COLMK M(MACRO_COLEMAK) @@ -43,6 +45,7 @@ #define M_LOWER M(MACRO_LOWER) #define M_RAISE M(MACRO_RAISE) #define M_FUNCT M(MACRO_FUNCTION) +#define M_MOUSE M(MACRO_MOUSE) #define TIMBR_1 M(MACRO_TIMBRE_1) #define TIMBR_2 M(MACRO_TIMBRE_2) #define TIMBR_3 M(MACRO_TIMBRE_3) @@ -73,8 +76,11 @@ #define _______ KC_TRNS -#define ___T___ KC_TRNS #define XXXXXXX KC_NO +#define ________________ _______, _______ +#define XXXXXXXXXXXXXXXX XXXXXXX, XXXXXXX + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* QWERTY * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. @@ -90,13 +96,12 @@ * '--------------------------------------------------------------------------------------------------------------------------------------' */ -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [LAYER_QWERTY] = { /* QWERTY */ - { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX }, + [LAYER_QWERTY] = { /* QWERTY */ + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC }, { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, - { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP }, - { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN }, - { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP }, + { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN }, + { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_LGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, }, /* COLEMAK @@ -105,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| * | TAB | Q | W | F | P | G | J | L | U | Y | ; | [ | ] | \ | DEL | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| - * | CAPS | A | R | S | T | D | H | N | E | I | O | ' | XXXXXX . ENTER | PG UP | + * | BACKSP | A | R | S | T | D | H | N | E | I | O | ' | XXXXXX . ENTER | PG UP | * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| * | LSHIFT | Z | X | C | V | B | K | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN | * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| @@ -113,12 +118,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * '--------------------------------------------------------------------------------------------------------------------------------------' */ - [LAYER_COLEMAK] = { /* COLEMAK */ + [LAYER_COLEMAK] = { /* COLEMAK */ { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC }, { KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, - { KC_CAPS, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP }, + { KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP }, { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN }, - { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_LGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, }, /* DVORAK @@ -135,40 +140,52 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * '--------------------------------------------------------------------------------------------------------------------------------------' */ - [LAYER_DVORAK] = { /* DVORAK */ + [LAYER_DVORAK] = { /* DVORAK */ { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_BSPC }, { KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_DEL }, { KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_ENT, KC_PGUP }, { KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN }, - { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, XXXXXXX, M_LOWER, KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_LGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, }, - [LAYER_LOWER] = { /* LOWERED */ - { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + [LAYER_LOWER] = { /* LOWERED */ + { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, { _______, _______, _______, _______, SC_CCLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, SC_REDO, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME }, + { _______, SC_REDO, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END }, { _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, _______, _______, _______, _______, _______, _______, _______ }, }, - [LAYER_RAISE] = { /* RAISED */ - { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + [LAYER_RAISE] = { /* RAISED */ + { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, { _______, _______, _______, _______, SC_ACLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, SC_SELA, SC_SAVE, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, SC_UNDO, SC_CUT, SC_COPY, SC_PSTE, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, SC_SELA, SC_SAVE, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME }, + { _______, SC_UNDO, SC_CUT, SC_COPY, SC_PSTE, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END }, + { _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + + [LAYER_FUNCTION] = { /* FUNCTION */ + { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, + { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______, KC_PAUS }, + { KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_PSCR }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_VOLU, KC_MUTE }, + { _______, _______, _______, _______, _______, KC_MPLY, KC_MPLY, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT }, }, - [LAYER_FUNCTION] = { /* FUNCTION */ - { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, - { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, +#ifdef MOUSEKEY_ENABLE + + [LAYER_MOUSE] = { /* MOUSE */ + { _______, KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXXXXXXXXXXX }, + { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, + { XXXXXXX, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXXXXXXXXXXX, KC_WH_U }, + { _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, ________________, KC_MS_U, KC_WH_D }, { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, }, - [LAYER_MUSIC] = { +#endif + + [LAYER_MUSIC] = { /* MUSIC */ { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, @@ -176,13 +193,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_RAISE, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, }, - [LAYER_ADJUST] = { /* ADJUST */ - { _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF, ___T___, ___T___ }, + [LAYER_ADJUST] = { /* ADJUST */ + { _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF, ________________ }, { _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, ___T___, ___T___, VC_UP, _______ }, - { _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______, _______, _______, _______, _______, VC_DOWN, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______ }, + { _______, _______, _______, _______, _______, RESET, _______, M_MOUSE, _______, _______, _______, ________________, VC_UP, _______ }, + { _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, VC_DOWN, _______ }, }, + + +/* + [LAYER_EMPTY] = { + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______, _______ }, + { _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, +*/ + }; #ifdef AUDIO_ENABLE @@ -206,36 +235,6 @@ float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); #endif /* AUDIO_ENABLE */ -/* -void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) -{ - if (order) - { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - layer_on(layer3); - } - else - { - layer_off(layer3); - layer_off(layer4); - } - } - else - { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - layer_on(layer4); - } - else - { - layer_off(layer3); - layer_off(layer4); - } - } -} -*/ - void persistant_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); @@ -314,6 +313,18 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; +#ifdef MOUSEKEY_ENABLE + + case MACRO_MOUSE: + if (record->event.pressed) + { + layer_invert(LAYER_MOUSE); + } + break; + +#endif /* MOUSEKEY_ENABLE */ + + case MACRO_TIMBRE_1: if (record->event.pressed) set_timbre(TIMBRE_12); break; @@ -389,8 +400,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE - voice_iterate(); - PLAY_NOTE_ARRAY(music_scale, false, STACCATO); + voice_iterate(); + PLAY_NOTE_ARRAY(music_scale, false, STACCATO); #endif } break; @@ -399,8 +410,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE - voice_deiterate(); - PLAY_NOTE_ARRAY(music_scale, false, STACCATO); + voice_deiterate(); + PLAY_NOTE_ARRAY(music_scale, false, STACCATO); #endif } break; @@ -419,8 +430,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) void process_action_user(keyrecord_t *record) { - uint8_t starting_note = 0x0C; - int offset = 7; + uint8_t starting_note = 0x0C; + int offset = 7; if (IS_LAYER_ON(LAYER_MUSIC)) { @@ -485,7 +496,7 @@ void led_set_user(uint8_t usb_led) void play_startup_tone() { - _delay_ms(10); // gets rid of tick + _delay_ms(10); // gets rid of tick PLAY_NOTE_ARRAY(tone_my_startup, false, STACCATO); } @@ -495,4 +506,4 @@ void play_goodbye_tone() _delay_ms(1000); } -#endif /* AUDIO_ENABLE */ +#endif /* AUDIO_ENABLE */ \ No newline at end of file -- cgit v1.2.3