From 9cfc74c35b940884618b0fe1e6fd25c570e1c974 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Thu, 7 Apr 2016 15:21:06 +0300 Subject: [Erez & Jack] Makes tri-layer available across Quantum --- keyboard/planck/keymaps/default/keymap.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index dee2840f2d..56092d04fb 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -174,16 +174,7 @@ float tone_dv[][2] = { }; #endif -#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) -#define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer))) -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { - layer_on(layer3); - } else { - layer_off(layer3); - } -} const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function -- cgit v1.2.3 From 4b4d3069b4e71de370f0fea8a949f1ae39bb0993 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Thu, 14 Apr 2016 08:50:01 -0500 Subject: Update and rename pc_atomic.c to pvc_atomic.c Also removed unused FNs --- keyboard/atomic/keymaps/pc_atomic.c | 75 ------------------------------------ keyboard/atomic/keymaps/pvc_atomic.c | 69 +++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 75 deletions(-) delete mode 100644 keyboard/atomic/keymaps/pc_atomic.c create mode 100644 keyboard/atomic/keymaps/pvc_atomic.c (limited to 'keyboard') diff --git a/keyboard/atomic/keymaps/pc_atomic.c b/keyboard/atomic/keymaps/pc_atomic.c deleted file mode 100644 index bdf575046b..0000000000 --- a/keyboard/atomic/keymaps/pc_atomic.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "atomic.h" - -#define _QW 0 -#define _LW 1 -#define _RS 2 -#define _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, MO(_FN), KC_LALT, MO(_RS), KC_SPC, XXXXXXX, MO(_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 }, - }, -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // MACRODOWN only works in this function - switch(id) { - case 0: - return MACRODOWN(TYPE(KC_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/atomic/keymaps/pvc_atomic.c b/keyboard/atomic/keymaps/pvc_atomic.c new file mode 100644 index 0000000000..b18e3a377a --- /dev/null +++ b/keyboard/atomic/keymaps/pvc_atomic.c @@ -0,0 +1,69 @@ +#include "atomic.h" + +#define _QW 0 +#define _LW 1 +#define _RS 2 +#define _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, MO(_FN), KC_LALT, MO(_RS), KC_SPC, XXXXXXX, MO(_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 }, + }, +}; + +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 0: + return MACRODOWN(TYPE(KC_T), END); + break; + } + return MACRO_NONE; +}; -- cgit v1.2.3 From 3dd20f2b6c16ea56bacc5e1581db3fbc1cfc5444 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Thu, 14 Apr 2016 11:35:49 -0500 Subject: Rename pc.c to pvc_planck.c --- keyboard/planck/keymaps/pc.c | 158 ----------------------------------- keyboard/planck/keymaps/pvc_planck.c | 158 +++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 158 deletions(-) delete mode 100644 keyboard/planck/keymaps/pc.c create mode 100644 keyboard/planck/keymaps/pvc_planck.c (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/pc.c b/keyboard/planck/keymaps/pc.c deleted file mode 100644 index ed062609f4..0000000000 --- a/keyboard/planck/keymaps/pc.c +++ /dev/null @@ -1,158 +0,0 @@ -// This is the canonical layout file for the Quantum project. If you want to add another keyboard, -// this is the style you want to emulate. - -#include "planck.h" -#ifdef BACKLIGHT_ENABLE - #include "backlight.h" -#endif - -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -#define _QW 0 -#define _CM 1 -#define _DV 2 -#define _LW 3 -#define _RS 4 -#define _FN 5 - -#define XXXXXXX KC_NO -#define _______ KC_TRNS - -#define ASFT(kc) LSFT(RSFT(kc)) -#define MG_B ASFT(KC_B) -#define MG_H ASFT(KC_H) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | Up |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | GUI | Alt | Del |Raise | Space |Lower | / | Left | Down |Right | - * `-----------------------------------------------------------------------------------' - */ -[_QW] = { - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} -}, - -/* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_CM] = { - {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, - -/* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_DV] = { - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, - {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, - -/* Raise - * ,-----------------------------------------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_RS] = { - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______}, - {_______, _______, _______, _______, MO(_FN), _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, - -/* Lower - * ,-----------------------------------------------------------------------------------. - * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_LW] = { - {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______}, - {_______, _______, _______, _______, _______, _______, _______, MO(_FN), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, - -/* Function - * ,-----------------------------------------------------------------------------------. - * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_FN] = { - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MG_H, 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} -} -}; - -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 0: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - } else { - unregister_code(KC_RSFT); - } - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/keymaps/pvc_planck.c b/keyboard/planck/keymaps/pvc_planck.c new file mode 100644 index 0000000000..ed062609f4 --- /dev/null +++ b/keyboard/planck/keymaps/pvc_planck.c @@ -0,0 +1,158 @@ +// This is the canonical layout file for the Quantum project. If you want to add another keyboard, +// this is the style you want to emulate. + +#include "planck.h" +#ifdef BACKLIGHT_ENABLE + #include "backlight.h" +#endif + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QW 0 +#define _CM 1 +#define _DV 2 +#define _LW 3 +#define _RS 4 +#define _FN 5 + +#define XXXXXXX KC_NO +#define _______ KC_TRNS + +#define ASFT(kc) LSFT(RSFT(kc)) +#define MG_B ASFT(KC_B) +#define MG_H ASFT(KC_H) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | Up |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt | Del |Raise | Space |Lower | / | Left | Down |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QW] = { + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} +}, + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_CM] = { + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, + {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DV] = { + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, + {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, + {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RS] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______}, + {_______, _______, _______, _______, MO(_FN), _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LW] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______}, + {_______, _______, _______, _______, _______, _______, _______, MO(_FN), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Function + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_FN] = { + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MG_H, 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} +} +}; + +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 0: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; -- cgit v1.2.3 From cf17687f29820b6bf9b8feb3b23dec6e271572c5 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Thu, 14 Apr 2016 12:59:16 -0500 Subject: Adding personal build file settings --- keyboard/atomic/Makefile | 4 ++-- keyboard/planck/Makefile | 4 ++-- keyboard/planck/config.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'keyboard') diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index 20cf4fff18..f95b2350cd 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -119,8 +119,8 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration -#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +#BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality #MIDI_ENABLE = yes # MIDI controls #UNICODE_ENABLE = yes # Unicode #BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index ae637fc295..5271c27957 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -135,8 +135,8 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration -# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # MIDI_ENABLE = yes # MIDI controls # AUDIO_ENABLE = yes # Audio output on port C6 # UNICODE_ENABLE = yes # Unicode diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h index d3719e0cb1..7d64f09773 100644 --- a/keyboard/planck/config.h +++ b/keyboard/planck/config.h @@ -73,10 +73,10 @@ along with this program. If not, see . */ /* disable debug print */ -#define NO_DEBUG +//#define NO_DEBUG /* disable print */ -#define NO_PRINT +//#define NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER -- cgit v1.2.3 From f051496f1343259f4da8c5d917b9c9e47b97e38c Mon Sep 17 00:00:00 2001 From: IBNobody Date: Thu, 14 Apr 2016 18:01:29 -0500 Subject: Checkin --- keyboard/atomic/Makefile | 7 ++ keyboard/atomic/keymaps/pvc_atomic.c | 170 +++++++++++++++++++++++++++++++++-- 2 files changed, 168 insertions(+), 9 deletions(-) (limited to 'keyboard') diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index f95b2350cd..206b5f119c 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -136,4 +136,11 @@ VPATH += $(TARGET_DIR) VPATH += $(TOP_DIR) VPATH += $(TMK_DIR) +debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION +debug-on: all + +debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT +debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS)) +debug-off: all + include $(TOP_DIR)/quantum/quantum.mk diff --git a/keyboard/atomic/keymaps/pvc_atomic.c b/keyboard/atomic/keymaps/pvc_atomic.c index b18e3a377a..3ddd3e3294 100644 --- a/keyboard/atomic/keymaps/pvc_atomic.c +++ b/keyboard/atomic/keymaps/pvc_atomic.c @@ -1,9 +1,12 @@ #include "atomic.h" +#include "action_layer.h" #define _QW 0 #define _LW 1 #define _RS 2 #define _FN 3 +#define _F1 4 +#define _F2 5 #define _______ KC_TRNS #define ___T___ KC_TRNS @@ -29,7 +32,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { 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, MO(_FN), KC_LALT, MO(_RS), KC_SPC, XXXXXXX, MO(_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + { KC_LCTL, KC_LGUI, M(_FN), KC_LALT, M(_RS), KC_SPC, XXXXXXX, 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___ }, @@ -52,18 +55,167 @@ 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 }, }, + [_F1] = { /* 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 }, + }, + [_F2] = { /* 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))) + +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) +{ + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + 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); + } + } +} + +/* ignore me +void change_quad_layer(uint8_t focus_layer, bool desired_focus_layer_state, uint8_t pair_layer, uint8_t layer3, uint8_t layer4) +{ + + // If desired focus layer state == 1 and current focus layer state == 1 + if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) + { + // Do Nothing + } + // If desired focus layer state == 0 and current focus layer state == 1 + else if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) + { + // If + 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) + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - // MACRODOWN only works in this function - switch(id) { - case 0: - return MACRODOWN(TYPE(KC_T), END); - break; - } - return MACRO_NONE; + + // MACRODOWN only works in this function + switch(id) + { + case _FN: + if (record->event.pressed) { + print("FN_DN\n"); + print_val_bin32(layer_state); + layer_on(_FN); + print_val_bin32(layer_state); + } else { + print("FN_UP\n"); + print_val_bin32(layer_state); + layer_off(_FN); + print_val_bin32(layer_state); + } + break; + + case _RS: + if (record->event.pressed) { + print("RS_DN\n"); + print_val_bin32(layer_state); + layer_on(_RS); + //tri_layer++; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 0); + print_val_bin32(layer_state); + } else { + print("RS_UP\n"); + print_val_bin32(layer_state); + layer_off(_RS); + //tri_layer--; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 0); + print_val_bin32(layer_state); + } + break; + + case _LW: + if (record->event.pressed) { + print("LW_DN\n"); + print_val_bin32(layer_state); + layer_on(_LW); + //tri_layer++; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 1); + print_val_bin32(layer_state); + } else { + print("LW_UP\n"); + print_val_bin32(layer_state); + layer_off(_LW); + //tri_layer--; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 1); + print_val_bin32(layer_state); + } + break; + + default: + break; + } + return MACRO_NONE; }; -- cgit v1.2.3 From ddbe4307789b6087c3e6f146a5e02f1084f3cecc Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 14 Apr 2016 19:13:24 -0400 Subject: new defaults --- keyboard/planck/Makefile | 2 +- keyboard/planck/keymaps/default/keymap.c | 146 ++++++++++++++++++++++++++++--- 2 files changed, 133 insertions(+), 15 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index ae637fc295..ee1c60feda 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -138,7 +138,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration # NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality # MIDI_ENABLE = yes # MIDI controls -# AUDIO_ENABLE = yes # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output on port C6 # UNICODE_ENABLE = yes # Unicode # BLUETOOTH_ENABLE = ye # Enable Bluetooth with the Adafruit EZ-Key HID # RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 30ad877605..e06567339e 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -5,6 +5,10 @@ #ifdef BACKLIGHT_ENABLE #include "backlight.h" #endif +#include "action_layer.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. @@ -15,6 +19,15 @@ #define _DV 2 #define _LW 3 #define _RS 4 +#define _AD 5 + +// Macro name shortcuts +#define M_QW 0 +#define M_CM 1 +#define M_DV 2 +#define M_LW 3 +#define M_RS 4 +#define M_BL 5 // Fillers to make layering more clear #define _______ KC_TRNS @@ -37,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Colemak @@ -55,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Dvorak @@ -73,24 +86,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Raise * ,-----------------------------------------------------------------------------------. * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Next | Vol- | Vol+ | Play | + * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ [_RS] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, _______}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, @@ -98,18 +111,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Next | Vol- | Vol+ | Play | + * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ [_LW] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, _______}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | |Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_AD] = { + {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, + {_______, _______, _______, _______, _______, _______, _______, M(M_QW), M(M_CM), M(M_DV), _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } }; @@ -117,11 +148,85 @@ const uint16_t PROGMEM fn_actions[] = { }; +float tone_qw[][2] = { + {440.0*pow(2.0,(67)/12.0), 400}, + {440.0*pow(2.0,(60)/12.0), 400}, + {0, 400}, + {440.0*pow(2.0,(67)/12.0), 1600} +}; + +float tone_cm[][2] = { + {440.0*pow(2.0,(67)/12.0), 400}, + {440.0*pow(2.0,(60)/12.0), 400}, + {0, 400}, + {440.0*pow(2.0,(67)/12.0), 1000}, + {0, 200}, + {440.0*pow(2.0,(67)/12.0), 1000} +}; + +float tone_dv[][2] = { + {440.0*pow(2.0,(67)/12.0), 400}, + {440.0*pow(2.0,(60)/12.0), 400}, + {0, 400}, + {440.0*pow(2.0,(67)/12.0), 800}, + {0, 200}, + {440.0*pow(2.0,(67)/12.0), 800}, + {0, 200}, + {440.0*pow(2.0,(67)/12.0), 800} +}; + + +#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) +#define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer))) + +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + layer_on(layer3); + } else { + layer_off(layer3); + } +} const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function switch(id) { - case 0: + case M_QW: + if (record->event.pressed) { + play_notes(&tone_qw, 4, false); + default_layer_set(1UL<<_QW); + } + break; + case M_CM: + if (record->event.pressed) { + play_notes(&tone_cm, 6, false); + default_layer_set(1UL<<_CM); + } + break; + case M_DV: + if (record->event.pressed) { + play_notes(&tone_dv, 8, false); + default_layer_set(1UL<<_DV); + } + break; + 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); + } + 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); + } + break; + case M_BL: if (record->event.pressed) { register_code(KC_RSFT); #ifdef BACKLIGHT_ENABLE @@ -134,3 +239,16 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } return MACRO_NONE; }; + +float start_up[][2] = { + {440.0*pow(2.0,(67)/12.0), 650}, + {440.0*pow(2.0,(64)/12.0), 450}, + {440.0*pow(2.0,(55)/12.0), 450}, + {440.0*pow(2.0,(60)/12.0), 450}, + {440.0*pow(2.0,(64)/12.0), 1000} +}; + +void matrix_init_user(void) { + init_notes(); + play_notes(&start_up, 5, false); +} -- cgit v1.2.3 From 63462bf8c12cea1c13ca1bd1f105fe53f556806e Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 14 Apr 2016 20:42:14 -0400 Subject: changing up the makefile a bit --- keyboard/planck/Makefile | 56 +++++++++++++++++------------ keyboard/planck/keymaps/default/keymap.c | 49 +++++++++++++++---------- keyboard/planck/keymaps/default/makefile.mk | 1 + 3 files changed, 65 insertions(+), 41 deletions(-) create mode 100644 keyboard/planck/keymaps/default/makefile.mk (limited to 'keyboard') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index ee1c60feda..dc6e46df2c 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -38,6 +38,27 @@ # To rebuild project do "make clean" then "make all". #---------------------------------------------------------------------------- +# Build Options +# change to "no" to disable the options, or define them in the makefile.mk in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: + # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + # Target file name (without extension). TARGET = planck @@ -62,17 +83,28 @@ ifneq ("$(wildcard keymaps/$(KEYMAP).c)","") else ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","") KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c +ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") + include keymaps/$(KEYMAP)/makefile.mk +endif else $(error Keymap file does not exist) +endif endif -endif + else + ifneq ("$(wildcard keymaps/default.c)","") KEYMAP_FILE = keymaps/default.c else KEYMAP_FILE = keymaps/default/keymap.c endif + +ifneq ("$(wildcard keymaps/default/makefile.mk)","") + include keymaps/default/makefile.mk endif + +endif + SRC := $(KEYMAP_FILE) $(SRC) CONFIG_H = config.h @@ -127,27 +159,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT OPT_DEFS += -DBOOTLOADER_SIZE=4096 -# Build Options -# comment out to disable the options. -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -# MIDI_ENABLE = yes # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 -# UNICODE_ENABLE = yes # Unicode -# BLUETOOTH_ENABLE = ye # Enable Bluetooth with the Adafruit EZ-Key HID -# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend - - -ifdef BACKLIGHT_ENABLE +ifeq ($(BACKLIGHT_ENABLE), yes) SRC += backlight.c endif diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index e06567339e..97ba5d285e 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -89,38 +89,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, -/* Raise +/* Lower * ,-----------------------------------------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * |------+------+------+------+------+------|------+------+------+------+------+------| * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_RS] = { - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, +[_LW] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, -/* Lower +/* Raise * ,-----------------------------------------------------------------------------------. - * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * |------+------+------+------+------+------|------+------+------+------+------+------| * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_LW] = { - {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, +[_RS] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, @@ -148,17 +148,18 @@ const uint16_t PROGMEM fn_actions[] = { }; +#ifdef AUDIO_ENABLE float tone_qw[][2] = { {440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(60)/12.0), 400}, - {0, 400}, + {0, 800}, {440.0*pow(2.0,(67)/12.0), 1600} }; float tone_cm[][2] = { {440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(60)/12.0), 400}, - {0, 400}, + {0, 800}, {440.0*pow(2.0,(67)/12.0), 1000}, {0, 200}, {440.0*pow(2.0,(67)/12.0), 1000} @@ -167,14 +168,14 @@ float tone_cm[][2] = { float tone_dv[][2] = { {440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(60)/12.0), 400}, - {0, 400}, + {0, 800}, {440.0*pow(2.0,(67)/12.0), 800}, {0, 200}, {440.0*pow(2.0,(67)/12.0), 800}, {0, 200}, {440.0*pow(2.0,(67)/12.0), 800} }; - +#endif #define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) #define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer))) @@ -192,19 +193,25 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) switch(id) { case M_QW: if (record->event.pressed) { - play_notes(&tone_qw, 4, false); + #ifdef AUDIO_ENABLE + play_notes(&tone_qw, 4, false); + #endif default_layer_set(1UL<<_QW); } break; case M_CM: if (record->event.pressed) { - play_notes(&tone_cm, 6, false); + #ifdef AUDIO_ENABLE + play_notes(&tone_cm, 6, false); + #endif default_layer_set(1UL<<_CM); } break; case M_DV: if (record->event.pressed) { - play_notes(&tone_dv, 8, false); + #ifdef AUDIO_ENABLE + play_notes(&tone_dv, 8, false); + #endif default_layer_set(1UL<<_DV); } break; @@ -240,6 +247,7 @@ 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] = { {440.0*pow(2.0,(67)/12.0), 650}, {440.0*pow(2.0,(64)/12.0), 450}, @@ -247,8 +255,11 @@ float start_up[][2] = { {440.0*pow(2.0,(60)/12.0), 450}, {440.0*pow(2.0,(64)/12.0), 1000} }; +#endif void matrix_init_user(void) { + #ifdef AUDIO_ENABLE init_notes(); play_notes(&start_up, 5, false); + #endif } diff --git a/keyboard/planck/keymaps/default/makefile.mk b/keyboard/planck/keymaps/default/makefile.mk new file mode 100644 index 0000000000..628167ff66 --- /dev/null +++ b/keyboard/planck/keymaps/default/makefile.mk @@ -0,0 +1 @@ +AUDIO_ENABLE = yes \ No newline at end of file -- cgit v1.2.3 From 3993afbb2e022f4e6371c729ac6a025f16bc734e Mon Sep 17 00:00:00 2001 From: IBNobody Date: Thu, 14 Apr 2016 22:27:28 -0500 Subject: adding new per-keymap makefile --- keyboard/atomic/Makefile | 85 ++++++++---- keyboard/atomic/keymaps/pvc/makefile.mk | 16 +++ keyboard/atomic/keymaps/pvc/pvc_atomic.c | 221 +++++++++++++++++++++++++++++++ keyboard/atomic/keymaps/pvc_atomic.c | 221 ------------------------------- 4 files changed, 294 insertions(+), 249 deletions(-) create mode 100644 keyboard/atomic/keymaps/pvc/makefile.mk create mode 100644 keyboard/atomic/keymaps/pvc/pvc_atomic.c delete mode 100644 keyboard/atomic/keymaps/pvc_atomic.c (limited to 'keyboard') diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index 206b5f119c..364efa3fa5 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -27,7 +27,7 @@ # make flip-ee = Download the eeprom file to the device, using Atmel FLIP # (must have Atmel FLIP installed). # -# make debug = Start either simulavr or avarice as specified for debugging, +# make debug = Start either simulavr or avarice as specified for debugging, # with avr-gdb or avr-insight as the front end for debugging. # # make filename.s = Just compile filename.c into the assembler code only. @@ -38,6 +38,27 @@ # To rebuild project do "make clean" then "make all". #---------------------------------------------------------------------------- +# Build Options +# change to "no" to disable the options, or define them in the makefile.mk in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: + # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + # Target file name (without extension). TARGET = atomic @@ -50,15 +71,42 @@ TMK_DIR = ../../tmk_core TARGET_DIR = . # # project specific files -SRC = atomic.c \ - backlight.c +SRC = atomic.c + +ifdef keymap + KEYMAP = $(keymap) +endif ifdef KEYMAP - SRC := keymaps/$(KEYMAP).c $(SRC) +ifneq ("$(wildcard keymaps/$(KEYMAP).c)","") + KEYMAP_FILE = keymaps/$(KEYMAP).c +else +ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","") + KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c +ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") + include keymaps/$(KEYMAP)/makefile.mk +endif +else +$(error Keymap file does not exist) +endif +endif + else - SRC := keymaps/default.c $(SRC) + +ifneq ("$(wildcard keymaps/default.c)","") + KEYMAP_FILE = keymaps/default.c +else + KEYMAP_FILE = keymaps/default/keymap.c +endif + +ifneq ("$(wildcard keymaps/default/makefile.mk)","") + include keymaps/default/makefile.mk +endif + endif +SRC := $(KEYMAP_FILE) $(SRC) + CONFIG_H = config.h # MCU name @@ -111,22 +159,10 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT OPT_DEFS += -DBOOTLOADER_SIZE=4096 -# Build Options -# comment out to disable the options. -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA -#BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -#MIDI_ENABLE = yes # MIDI controls -#UNICODE_ENABLE = yes # Unicode -#BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID +ifeq ($(BACKLIGHT_ENABLE), yes) + SRC += backlight.c +endif -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax @@ -136,11 +172,4 @@ VPATH += $(TARGET_DIR) VPATH += $(TOP_DIR) VPATH += $(TMK_DIR) -debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION -debug-on: all - -debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT -debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS)) -debug-off: all - -include $(TOP_DIR)/quantum/quantum.mk +include $(TOP_DIR)/quantum/quantum.mk \ No newline at end of file diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk new file mode 100644 index 0000000000..ff0a9c338b --- /dev/null +++ b/keyboard/atomic/keymaps/pvc/makefile.mk @@ -0,0 +1,16 @@ +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: + # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboard/atomic/keymaps/pvc/pvc_atomic.c b/keyboard/atomic/keymaps/pvc/pvc_atomic.c new file mode 100644 index 0000000000..3ddd3e3294 --- /dev/null +++ b/keyboard/atomic/keymaps/pvc/pvc_atomic.c @@ -0,0 +1,221 @@ +#include "atomic.h" +#include "action_layer.h" + +#define _QW 0 +#define _LW 1 +#define _RS 2 +#define _FN 3 +#define _F1 4 +#define _F2 5 + +#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(_FN), KC_LALT, M(_RS), KC_SPC, XXXXXXX, 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 }, + }, + [_F1] = { /* 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 }, + }, + [_F2] = { /* 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))) + +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) +{ + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + 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); + } + } +} + +/* ignore me +void change_quad_layer(uint8_t focus_layer, bool desired_focus_layer_state, uint8_t pair_layer, uint8_t layer3, uint8_t layer4) +{ + + // If desired focus layer state == 1 and current focus layer state == 1 + if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) + { + // Do Nothing + } + // If desired focus layer state == 0 and current focus layer state == 1 + else if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) + { + // If + 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 _FN: + if (record->event.pressed) { + print("FN_DN\n"); + print_val_bin32(layer_state); + layer_on(_FN); + print_val_bin32(layer_state); + } else { + print("FN_UP\n"); + print_val_bin32(layer_state); + layer_off(_FN); + print_val_bin32(layer_state); + } + break; + + case _RS: + if (record->event.pressed) { + print("RS_DN\n"); + print_val_bin32(layer_state); + layer_on(_RS); + //tri_layer++; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 0); + print_val_bin32(layer_state); + } else { + print("RS_UP\n"); + print_val_bin32(layer_state); + layer_off(_RS); + //tri_layer--; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 0); + print_val_bin32(layer_state); + } + break; + + case _LW: + if (record->event.pressed) { + print("LW_DN\n"); + print_val_bin32(layer_state); + layer_on(_LW); + //tri_layer++; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 1); + print_val_bin32(layer_state); + } else { + print("LW_UP\n"); + print_val_bin32(layer_state); + layer_off(_LW); + //tri_layer--; + print_val_bin32(layer_state); + //update_tri_layer(_RS, _LW, _FN); + update_quad_layer(_RS, _LW, _F1, _F2, 1); + print_val_bin32(layer_state); + } + break; + + default: + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/atomic/keymaps/pvc_atomic.c b/keyboard/atomic/keymaps/pvc_atomic.c deleted file mode 100644 index 3ddd3e3294..0000000000 --- a/keyboard/atomic/keymaps/pvc_atomic.c +++ /dev/null @@ -1,221 +0,0 @@ -#include "atomic.h" -#include "action_layer.h" - -#define _QW 0 -#define _LW 1 -#define _RS 2 -#define _FN 3 -#define _F1 4 -#define _F2 5 - -#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(_FN), KC_LALT, M(_RS), KC_SPC, XXXXXXX, 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 }, - }, - [_F1] = { /* 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 }, - }, - [_F2] = { /* 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))) - -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) -{ - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - 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); - } - } -} - -/* ignore me -void change_quad_layer(uint8_t focus_layer, bool desired_focus_layer_state, uint8_t pair_layer, uint8_t layer3, uint8_t layer4) -{ - - // If desired focus layer state == 1 and current focus layer state == 1 - if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) - { - // Do Nothing - } - // If desired focus layer state == 0 and current focus layer state == 1 - else if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) - { - // If - 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 _FN: - if (record->event.pressed) { - print("FN_DN\n"); - print_val_bin32(layer_state); - layer_on(_FN); - print_val_bin32(layer_state); - } else { - print("FN_UP\n"); - print_val_bin32(layer_state); - layer_off(_FN); - print_val_bin32(layer_state); - } - break; - - case _RS: - if (record->event.pressed) { - print("RS_DN\n"); - print_val_bin32(layer_state); - layer_on(_RS); - //tri_layer++; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 0); - print_val_bin32(layer_state); - } else { - print("RS_UP\n"); - print_val_bin32(layer_state); - layer_off(_RS); - //tri_layer--; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 0); - print_val_bin32(layer_state); - } - break; - - case _LW: - if (record->event.pressed) { - print("LW_DN\n"); - print_val_bin32(layer_state); - layer_on(_LW); - //tri_layer++; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 1); - print_val_bin32(layer_state); - } else { - print("LW_UP\n"); - print_val_bin32(layer_state); - layer_off(_LW); - //tri_layer--; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 1); - print_val_bin32(layer_state); - } - break; - - default: - break; - } - return MACRO_NONE; -}; -- cgit v1.2.3 From 2597fb7c508cf36704291cd48b2c752dd21f2b0d Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 14 Apr 2016 23:33:46 -0400 Subject: might have broken something --- keyboard/planck/config.h | 4 ++-- keyboard/planck/keymaps/default/makefile.mk | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h index d3719e0cb1..7d64f09773 100644 --- a/keyboard/planck/config.h +++ b/keyboard/planck/config.h @@ -73,10 +73,10 @@ along with this program. If not, see . */ /* disable debug print */ -#define NO_DEBUG +//#define NO_DEBUG /* disable print */ -#define NO_PRINT +//#define NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER diff --git a/keyboard/planck/keymaps/default/makefile.mk b/keyboard/planck/keymaps/default/makefile.mk index 628167ff66..e1c5bd2e80 100644 --- a/keyboard/planck/keymaps/default/makefile.mk +++ b/keyboard/planck/keymaps/default/makefile.mk @@ -1 +1,2 @@ -AUDIO_ENABLE = yes \ No newline at end of file +AUDIO_ENABLE = yes +BACKLIGHT_ENABLE = yes \ No newline at end of file -- cgit v1.2.3 From 43a4ffc25971b2aea94b65ca1db66371e653ec5f Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 14 Apr 2016 23:53:35 -0400 Subject: bootmagic somehow not getting enabled, so adding eeconfig to backlight src include cond --- keyboard/planck/Makefile | 11 ++++------- keyboard/planck/keymaps/default/keymap.c | 3 --- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index dc6e46df2c..693e9c8aa5 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -107,6 +107,10 @@ endif SRC := $(KEYMAP_FILE) $(SRC) +ifeq ($(BACKLIGHT_ENABLE), yes) + SRC := backlight.c $(SRC) +endif + CONFIG_H = config.h # MCU name @@ -126,7 +130,6 @@ MCU = atmega32u4 # software delays. F_CPU = 16000000 - # # LUFA specific # @@ -158,12 +161,6 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 - -ifeq ($(BACKLIGHT_ENABLE), yes) - SRC += backlight.c -endif - - # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 97ba5d285e..151a6b4f46 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -2,9 +2,6 @@ // this is the style you want to emulate. #include "planck.h" -#ifdef BACKLIGHT_ENABLE - #include "backlight.h" -#endif #include "action_layer.h" #ifdef AUDIO_ENABLE #include "audio.h" -- cgit v1.2.3 From bb0836c62016f482f517771a9f5a8dbc68bd0a1c Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 15 Apr 2016 00:26:22 -0400 Subject: the spacessss --- keyboard/planck/Makefile | 66 +++++++++++++++++------------ keyboard/planck/keymaps/default/makefile.mk | 3 +- 2 files changed, 41 insertions(+), 28 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index 693e9c8aa5..8d4e7787a6 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -38,31 +38,9 @@ # To rebuild project do "make clean" then "make all". #---------------------------------------------------------------------------- -# Build Options -# change to "no" to disable the options, or define them in the makefile.mk in -# the appropriate keymap folder that will get included automatically -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: - # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no # Audio output on port C6 -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - # Target file name (without extension). TARGET = planck - # Directory common source filess exist TOP_DIR = ../.. TMK_DIR = ../../tmk_core @@ -107,10 +85,6 @@ endif SRC := $(KEYMAP_FILE) $(SRC) -ifeq ($(BACKLIGHT_ENABLE), yes) - SRC := backlight.c $(SRC) -endif - CONFIG_H = config.h # MCU name @@ -161,6 +135,46 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 +# Build Options +# change to "no" to disable the options, or define them in the makefile.mk in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifdef KEYMAP + +ifeq ("$(wildcard keymaps/$(KEYMAP).c)","") +ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") + include keymaps/$(KEYMAP)/makefile.mk +endif +endif + +else + +ifneq ("$(wildcard keymaps/default/makefile.mk)","") + include keymaps/default/makefile.mk +endif + +endif + +ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) + SRC := backlight.c $(SRC) +endif + # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/keyboard/planck/keymaps/default/makefile.mk b/keyboard/planck/keymaps/default/makefile.mk index e1c5bd2e80..8cbec4a1f5 100644 --- a/keyboard/planck/keymaps/default/makefile.mk +++ b/keyboard/planck/keymaps/default/makefile.mk @@ -1,2 +1 @@ -AUDIO_ENABLE = yes -BACKLIGHT_ENABLE = yes \ No newline at end of file +AUDIO_ENABLE = yes \ No newline at end of file -- cgit v1.2.3 From ee2ee7f4f049dda385a9db7dddd8e7e91681315b Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 15 Apr 2016 13:44:07 -0400 Subject: audio note length fixes --- keyboard/planck/keymaps/default/keymap.c | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 151a6b4f46..dee2840f2d 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -147,30 +147,30 @@ const uint16_t PROGMEM fn_actions[] = { #ifdef AUDIO_ENABLE float tone_qw[][2] = { - {440.0*pow(2.0,(67)/12.0), 400}, - {440.0*pow(2.0,(60)/12.0), 400}, - {0, 800}, - {440.0*pow(2.0,(67)/12.0), 1600} + {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_cm[][2] = { - {440.0*pow(2.0,(67)/12.0), 400}, - {440.0*pow(2.0,(60)/12.0), 400}, - {0, 800}, - {440.0*pow(2.0,(67)/12.0), 1000}, - {0, 200}, - {440.0*pow(2.0,(67)/12.0), 1000} + {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_dv[][2] = { - {440.0*pow(2.0,(67)/12.0), 400}, - {440.0*pow(2.0,(60)/12.0), 400}, - {0, 800}, - {440.0*pow(2.0,(67)/12.0), 800}, - {0, 200}, - {440.0*pow(2.0,(67)/12.0), 800}, - {0, 200}, - {440.0*pow(2.0,(67)/12.0), 800} + {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 @@ -246,11 +246,11 @@ 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), 650}, - {440.0*pow(2.0,(64)/12.0), 450}, - {440.0*pow(2.0,(55)/12.0), 450}, - {440.0*pow(2.0,(60)/12.0), 450}, - {440.0*pow(2.0,(64)/12.0), 1000} + {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 -- cgit v1.2.3 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/Makefile | 67 ++++++---- keyboard/atomic/keymaps/pvc/config.h | 157 ++++++++++++++++++++++ keyboard/atomic/keymaps/pvc/keymap.c | 202 ++++++++++++++++++++++++++++ keyboard/atomic/keymaps/pvc/makefile.mk | 6 +- keyboard/atomic/keymaps/pvc/pvc_atomic.c | 221 ------------------------------- keyboard/planck/Makefile | 31 +---- 6 files changed, 403 insertions(+), 281 deletions(-) create mode 100644 keyboard/atomic/keymaps/pvc/config.h create mode 100644 keyboard/atomic/keymaps/pvc/keymap.c delete mode 100644 keyboard/atomic/keymaps/pvc/pvc_atomic.c (limited to 'keyboard') diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index 364efa3fa5..1203cf6a39 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -38,31 +38,9 @@ # To rebuild project do "make clean" then "make all". #---------------------------------------------------------------------------- -# Build Options -# change to "no" to disable the options, or define them in the makefile.mk in -# the appropriate keymap folder that will get included automatically -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: - # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no # Audio output on port C6 -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - # Target file name (without extension). TARGET = atomic - # Directory common source filess exist TOP_DIR = ../.. TMK_DIR = ../../tmk_core @@ -73,6 +51,8 @@ TARGET_DIR = . # # project specific files SRC = atomic.c +CONFIG_H = config.h + ifdef keymap KEYMAP = $(keymap) endif @@ -88,7 +68,7 @@ ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") endif else $(error Keymap file does not exist) -endif +endif endif else @@ -107,8 +87,6 @@ endif SRC := $(KEYMAP_FILE) $(SRC) -CONFIG_H = config.h - # MCU name #MCU = at90usb1287 MCU = atmega32u4 @@ -126,7 +104,6 @@ MCU = atmega32u4 # software delays. F_CPU = 16000000 - # # LUFA specific # @@ -158,11 +135,45 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 +# Build Options +# change to "no" to disable the options, or define them in the makefile.mk in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifdef KEYMAP + +ifeq ("$(wildcard keymaps/$(KEYMAP).c)","") +ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") + include keymaps/$(KEYMAP)/makefile.mk +endif +endif + +else + +ifneq ("$(wildcard keymaps/default/makefile.mk)","") + include keymaps/default/makefile.mk +endif -ifeq ($(BACKLIGHT_ENABLE), yes) - SRC += backlight.c endif +ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) + SRC := backlight.c $(SRC) +endif # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/keyboard/atomic/keymaps/pvc/config.h b/keyboard/atomic/keymaps/pvc/config.h new file mode 100644 index 0000000000..8449fa06de --- /dev/null +++ b/keyboard/atomic/keymaps/pvc/config.h @@ -0,0 +1,157 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Ortholinear Keyboards +#define PRODUCT The Atomic Keyboard +#define DESCRIPTION A compact ortholinear keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } +#define ROWS (int []){ D0, D5, B5, B6, B3 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +#define MAGIC_KEY_BOOTLOADER B +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif 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 +} diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk index ff0a9c338b..c41102f5d4 100644 --- a/keyboard/atomic/keymaps/pvc/makefile.mk +++ b/keyboard/atomic/keymaps/pvc/makefile.mk @@ -1,16 +1,18 @@ BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no # Audio output on port C6 +AUDIO_ENABLE = yes # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +CONFIG_H = keymaps/$(KEYMAP)/config.h \ No newline at end of file diff --git a/keyboard/atomic/keymaps/pvc/pvc_atomic.c b/keyboard/atomic/keymaps/pvc/pvc_atomic.c deleted file mode 100644 index 3ddd3e3294..0000000000 --- a/keyboard/atomic/keymaps/pvc/pvc_atomic.c +++ /dev/null @@ -1,221 +0,0 @@ -#include "atomic.h" -#include "action_layer.h" - -#define _QW 0 -#define _LW 1 -#define _RS 2 -#define _FN 3 -#define _F1 4 -#define _F2 5 - -#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(_FN), KC_LALT, M(_RS), KC_SPC, XXXXXXX, 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 }, - }, - [_F1] = { /* 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 }, - }, - [_F2] = { /* 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))) - -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) -{ - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) - { - 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); - } - } -} - -/* ignore me -void change_quad_layer(uint8_t focus_layer, bool desired_focus_layer_state, uint8_t pair_layer, uint8_t layer3, uint8_t layer4) -{ - - // If desired focus layer state == 1 and current focus layer state == 1 - if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) - { - // Do Nothing - } - // If desired focus layer state == 0 and current focus layer state == 1 - else if ((desired_focus_layer_state) && IS_LAYER_ON(layer1)) - { - // If - 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 _FN: - if (record->event.pressed) { - print("FN_DN\n"); - print_val_bin32(layer_state); - layer_on(_FN); - print_val_bin32(layer_state); - } else { - print("FN_UP\n"); - print_val_bin32(layer_state); - layer_off(_FN); - print_val_bin32(layer_state); - } - break; - - case _RS: - if (record->event.pressed) { - print("RS_DN\n"); - print_val_bin32(layer_state); - layer_on(_RS); - //tri_layer++; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 0); - print_val_bin32(layer_state); - } else { - print("RS_UP\n"); - print_val_bin32(layer_state); - layer_off(_RS); - //tri_layer--; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 0); - print_val_bin32(layer_state); - } - break; - - case _LW: - if (record->event.pressed) { - print("LW_DN\n"); - print_val_bin32(layer_state); - layer_on(_LW); - //tri_layer++; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 1); - print_val_bin32(layer_state); - } else { - print("LW_UP\n"); - print_val_bin32(layer_state); - layer_off(_LW); - //tri_layer--; - print_val_bin32(layer_state); - //update_tri_layer(_RS, _LW, _FN); - update_quad_layer(_RS, _LW, _F1, _F2, 1); - print_val_bin32(layer_state); - } - break; - - default: - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index c8517e756f..83b8303b02 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -157,39 +157,10 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend ifdef KEYMAP -<<<<<<< HEAD -<<<<<<< HEAD -# Build Options -# comment out to disable the options. -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -# MIDI_ENABLE = yes # MIDI controls -# AUDIO_ENABLE = yes # Audio output on port C6 -# UNICODE_ENABLE = yes # Unicode -# BLUETOOTH_ENABLE = ye # Enable Bluetooth with the Adafruit EZ-Key HID -# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend - - -ifdef BACKLIGHT_ENABLE -======= -ifeq ($(BACKLIGHT_ENABLE), yes) ->>>>>>> master - SRC += backlight.c -======= ifeq ("$(wildcard keymaps/$(KEYMAP).c)","") ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") include keymaps/$(KEYMAP)/makefile.mk endif ->>>>>>> remotes/jackhumbert/new_defaults endif else @@ -212,4 +183,4 @@ VPATH += $(TARGET_DIR) VPATH += $(TOP_DIR) VPATH += $(TMK_DIR) -include $(TOP_DIR)/quantum/quantum.mk +include $(TOP_DIR)/quantum/quantum.mk \ No newline at end of file -- 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/Makefile | 30 +++++++++++++++--------------- keyboard/atomic/keymaps/pvc/keymap.c | 13 +++++++++++-- keyboard/atomic/keymaps/pvc/makefile.mk | 27 +++++++++++++-------------- 3 files changed, 39 insertions(+), 31 deletions(-) (limited to 'keyboard') diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index 1203cf6a39..3f066aebcd 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -51,8 +51,6 @@ TARGET_DIR = . # # project specific files SRC = atomic.c -CONFIG_H = config.h - ifdef keymap KEYMAP = $(keymap) endif @@ -87,6 +85,8 @@ endif SRC := $(KEYMAP_FILE) $(SRC) +CONFIG_H = config.h + # MCU name #MCU = at90usb1287 MCU = atmega32u4 @@ -139,21 +139,21 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # change to "no" to disable the options, or define them in the makefile.mk in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = no # Audio output on port C6 -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend ifdef KEYMAP 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))) diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk index c41102f5d4..d469966501 100644 --- a/keyboard/atomic/keymaps/pvc/makefile.mk +++ b/keyboard/atomic/keymaps/pvc/makefile.mk @@ -1,18 +1,17 @@ -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: - # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE = no # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = yes # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CONFIG_H = keymaps/$(KEYMAP)/config.h \ No newline at end of file -- cgit v1.2.3 From 549b797ad1ebb30ebaa19af2cf3b7cc2a2c055bc Mon Sep 17 00:00:00 2001 From: Jason Janse van Rensburg Date: Sat, 16 Apr 2016 01:36:18 +0200 Subject: My Attempt at adapting the Bone2 layout with Neo2 navigation cluster & number block to the Planck. Very much a WIP, will most likely start tweaking further once my Planck kit has dropped --- keyboard/planck/keymaps/bone2planck.c | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 keyboard/planck/keymaps/bone2planck.c (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/bone2planck.c b/keyboard/planck/keymaps/bone2planck.c new file mode 100644 index 0000000000..a99e7719f9 --- /dev/null +++ b/keyboard/planck/keymaps/bone2planck.c @@ -0,0 +1,112 @@ + +#include "planck.h" +#ifdef BACKLIGHT_ENABLE +#include "backlight.h" +#endif +#include "..\..\quantum\keymap_extras\keymap_german.h" + +/* This Layout tries to emulate the Bone2 Variant of Neo2, and is intended to be used with a German QWERTZ Softwarelayout. + It has Umlauts and "ß" as it is optimized for a mix of German & English. + My favourite features are the placement of the special characters often used for programming right on the home row + and the number & navigation block combo, so you never have to move your hands from their home position. + + Bone2 wiki page: http://wiki.neo-layout.org/wiki/Bone +*/ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Bone2 + * ,-----------------------------------------------------------------------------------. + * | Q | J | D | U | A | X | P | H | L | M | W | ẞ | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | M1 | C | T | I | E | O | B | N | R | S | G | M1 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| F | V | Ü | Ä | Ö | Y | Z | , | . | K |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Esc | Tab |Enter | + * `-----------------------------------------------------------------------------------' + */ + [0] = { + { DE_Q, DE_J, DE_D, DE_U, DE_A, DE_X, DE_P, DE_H, DE_L, DE_M, DE_W, DE_SS }, + { MO(1), DE_C, DE_T, DE_I, DE_E, DE_O, DE_B, DE_N, DE_R, DE_S, DE_G, MO(1) }, + { DE_S, DE_F, DE_V, DE_UE, DE_AE, DE_OE, DE_Y, DE_Z, DE_COMM, DE_DOT, DE_K, DE_S }, + { KC_LCTL, KC_LGUI, KC_LALT, MO(3), MO(2), KC_SPC, KC_SPC, MO(2), MO(3), KC_ESC, KC_TAB, KC_ENT } + }, + + /* M1 Special Characters + * ,-----------------------------------------------------------------------------------. + * | ° | @ | _ | [ | ] | ^ | ! | < | > | = | & | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | M1 | \ | / | { | } | * | ? | ( | ) | - | : | M1 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | # | $ | | | ~ | € | + | % | " | ' | ; | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Esc | Tab |Enter | + * `-----------------------------------------------------------------------------------' + */ + [1] = { + { DE_RING, DE_AT, DE_UNDS, DE_LBRC, DE_RBRC, DE_CIRC, DE_EXLM, DE_LESS, DE_MORE, DE_EQL, DE_AMPR, KC_NO }, + { KC_TRNS, DE_BSLS, DE_SLSH, DE_LCBR, DE_RCBR, DE_ASTR, DE_QST, DE_LPRN, DE_RPRN, DE_MINS, DE_COLN, KC_TRNS }, + { KC_NO , DE_HASH, DE_DLR, DE_PIPE, DE_TILD, DE_EURO, DE_PLUS, DE_PERC, DE_DQOT, DE_QUOT, DE_SCLN, KC_NO }, + { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS } + }, + + /* Navigation & Number Blocks + * ,-----------------------------------------------------------------------------------. + * | | PgUp | Bksp | Up | DEL | PgDn | | 7 | 8 | 9 | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | Home | Lft | Down | Right| End | . | 4 | 5 | 6 | , | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| | Tab | Ins | Enter| | 0 | 1 | 2 | 3 | ; |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Esc | Tab |Enter | + * `-----------------------------------------------------------------------------------' + */ + [2] = { + { KC_NO, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, KC_NO, DE_7, DE_8, DE_9, KC_NO, KC_NO }, + { KC_NO, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, DE_DOT, DE_4, DE_5, DE_6, DE_COMM, KC_NO }, + { DE_S, KC_NO, KC_TAB, KC_INS, KC_ENT, KC_NO, KC_0, DE_1, DE_2, DE_3, DE_SCLN, DE_S }, + { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS } + }, + + /* Function & Media Keys + * ,-----------------------------------------------------------------------------------. + * | | | Print|Scroll|Pause | | | F7 | F8 | F9 | F12 | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | Mute | Vol- | Vol+ | | ³ | F4 | F5 | F6 | F11 | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| | Prev | Play | Next | | ² | F1 | F2 | F3 | F10 |Shift | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Alt | M3 | | Space | | M3 | Esc | Tab |Enter | + * `-----------------------------------------------------------------------------------' + */ + [3] = { + { KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_F12, KC_NO }, + { KC_NO, KC_NO, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, DE_SQ3, KC_F4, KC_F5, KC_F6, KC_F11, KC_NO }, + { KC_TRNS, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_NO, DE_SQ2, KC_F1, KC_F2, KC_F3, KC_F10, KC_TRNS}, + { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + } +}; + +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 0: + if (record->event.pressed) { + register_code(KC_RSFT); +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif + } + else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; -- cgit v1.2.3 From 0faa18eab996c2cfcc5da0b60b702f52335c5854 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 15 Apr 2016 23:38:21 -0400 Subject: audio enable stored in eeprom --- keyboard/planck/keymaps/default/keymap.c | 7 ++++++- keyboard/preonic/Makefile | 4 ++-- keyboard/preonic/keymaps/default/keymap.c | 12 +++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 56092d04fb..3f34ba4120 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -135,7 +135,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_AD] = { {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, _______, _______, _______, _______, M(M_QW), M(M_CM), M(M_DV), _______, _______}, + {_______, _______, _______, _______, M(6), _______, _______, M(M_QW), M(M_CM), M(M_DV), _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } @@ -231,6 +231,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) unregister_code(KC_RSFT); } break; + case 6: + if (record->event.pressed) { + audio_toggle(); + } + break; } return MACRO_NONE; }; diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile index 664aff7321..e48052c825 100644 --- a/keyboard/preonic/Makefile +++ b/keyboard/preonic/Makefile @@ -139,8 +139,8 @@ COMMAND_ENABLE = yes # Commands for debug and configuration # SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend # NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -MIDI_ENABLE = YES # MIDI controls -AUDIO_ENABLE = YES # Audio output on port C6 +MIDI_ENABLE = yes # MIDI controls +AUDIO_ENABLE = yes # Audio output on port C6 # UNICODE_ENABLE = YES # Unicode # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID # RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with MIDI at the same time. diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 7846707848..3da69c2155 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -59,11 +59,11 @@ const uint16_t PROGMEM fn_actions[] = { }; float start_up[][2] = { - {440.0*pow(2.0,(67)/12.0), 600}, - {440.0*pow(2.0,(64)/12.0), 400}, - {440.0*pow(2.0,(55)/12.0), 400}, - {440.0*pow(2.0,(60)/12.0), 400}, - {440.0*pow(2.0,(64)/12.0), 1000}, + {440.0*pow(2.0,(67)/12.0), 4}, + {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), 10}, }; const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) @@ -76,8 +76,10 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef BACKLIGHT_ENABLE backlight_step(); #endif + audio_toggle(); } else { unregister_code(KC_RSFT); + play_notes(&start_up, 5, false); } break; } -- 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') 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 d81ef5b7eb888ae2878e60d548854413ee3023c6 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 16 Apr 2016 01:19:37 -0400 Subject: new defaults for planck and preonic --- keyboard/planck/keymaps/default/keymap.c | 74 ++++---- keyboard/preonic/Makefile | 55 ++++-- keyboard/preonic/keymaps/default/README.md | 35 +--- keyboard/preonic/keymaps/default/keymap.c | 260 +++++++++++++++++++++++---- keyboard/preonic/keymaps/default/makefile.mk | 1 + 5 files changed, 308 insertions(+), 117 deletions(-) create mode 100644 keyboard/preonic/keymaps/default/makefile.mk (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 3f34ba4120..ede08ad7f1 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -19,12 +19,16 @@ #define _AD 5 // Macro name shortcuts -#define M_QW 0 -#define M_CM 1 -#define M_DV 2 -#define M_LW 3 -#define M_RS 4 +#define QWERTY M(_QW) +#define COLEMAK M(_CM) +#define DVORAK M(_DV) +#define LOWER M(_LW) +#define RAISE M(_RS) #define M_BL 5 +#ifdef AUDIO_ENABLE + #define AUD_OFF M(6) + #define AUD_ON M(7) +#endif // Fillers to make layering more clear #define _______ KC_TRNS @@ -47,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Colemak @@ -65,7 +69,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Dvorak @@ -83,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Lower @@ -126,7 +130,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | | Reset| | | | | | | | | | Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | | | | | |Qwerty|Colemk|Dvorak| | | + * | | | |Aud on|Audoff| | |Qwerty|Colemk|Dvorak| | | * |------+------+------+------+------+------|------+------+------+------+------+------| * | | | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| @@ -135,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_AD] = { {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, _______, M(6), _______, _______, M(M_QW), M(M_CM), M(M_DV), _______, _______}, + {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } @@ -146,6 +150,14 @@ const uint16_t PROGMEM fn_actions[] = { }; #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} +}; + float tone_qw[][2] = { {440.0*pow(2.0,(59)/12.0), 8}, {440.0*pow(2.0,(60)/12.0), 8}, @@ -157,20 +169,20 @@ float tone_cm[][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}, + {440.0*pow(2.0,(67)/12.0), 12}, {0, 4}, - {440.0*pow(2.0,(71)/12.0), 16} + {440.0*pow(2.0,(71)/12.0), 12} }; float tone_dv[][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}, + {440.0*pow(2.0,(67)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(69)/12.0), 16}, + {440.0*pow(2.0,(69)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} + {440.0*pow(2.0,(67)/12.0), 8} }; #endif @@ -179,7 +191,7 @@ 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_QW: + case _QW: if (record->event.pressed) { #ifdef AUDIO_ENABLE play_notes(&tone_qw, 4, false); @@ -187,7 +199,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) default_layer_set(1UL<<_QW); } break; - case M_CM: + case _CM: if (record->event.pressed) { #ifdef AUDIO_ENABLE play_notes(&tone_cm, 6, false); @@ -195,7 +207,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) default_layer_set(1UL<<_CM); } break; - case M_DV: + case _DV: if (record->event.pressed) { #ifdef AUDIO_ENABLE play_notes(&tone_dv, 8, false); @@ -203,7 +215,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) default_layer_set(1UL<<_DV); } break; - case M_LW: + case _LW: if (record->event.pressed) { layer_on(_LW); update_tri_layer(_LW, _RS, _AD); @@ -212,7 +224,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) update_tri_layer(_LW, _RS, _AD); } break; - case M_RS: + case _RS: if (record->event.pressed) { layer_on(_RS); update_tri_layer(_LW, _RS, _AD); @@ -233,23 +245,23 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; case 6: if (record->event.pressed) { - audio_toggle(); + #ifdef AUDIO_ENABLE + audio_off(); + #endif + } + break; + case 7: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + audio_on(); + play_notes(&start_up, 5, false); + #endif } 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(); diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile index e48052c825..eaf9ef927c 100644 --- a/keyboard/preonic/Makefile +++ b/keyboard/preonic/Makefile @@ -126,27 +126,44 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # USBaspLoader 2048 OPT_DEFS += -DBOOTLOADER_SIZE=4096 - # Build Options -# comment out to disable the options. -# -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration +# change to "no" to disable the options, or define them in the makefile.mk in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -MIDI_ENABLE = yes # MIDI controls -AUDIO_ENABLE = yes # Audio output on port C6 -# UNICODE_ENABLE = YES # Unicode -# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID -# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with MIDI at the same time. - -ifdef BACKLIGHT_ENABLE - SRC += backlight.c +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifdef KEYMAP + +ifeq ("$(wildcard keymaps/$(KEYMAP).c)","") +ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") + include keymaps/$(KEYMAP)/makefile.mk +endif +endif + +else + +ifneq ("$(wildcard keymaps/default/makefile.mk)","") + include keymaps/default/makefile.mk +endif + +endif + +ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) + SRC := backlight.c $(SRC) endif diff --git a/keyboard/preonic/keymaps/default/README.md b/keyboard/preonic/keymaps/default/README.md index d2f43bbdb8..e911968dd9 100644 --- a/keyboard/preonic/keymaps/default/README.md +++ b/keyboard/preonic/keymaps/default/README.md @@ -1,34 +1 @@ -# The Default Planck Layout - - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QW] = { /* Qwerty */ - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_CM] = { /* Colemak */ - {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_DV] = { /* Dvorak */ - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, - {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_RS] = { /* RAISE */ - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} - }, - [_LW] = { /* LOWER */ - {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} - } - }; \ No newline at end of file +# The default Preonic layout - largely based on the Planck's \ No newline at end of file diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 3da69c2155..c52d8472f4 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -1,9 +1,7 @@ -// This is the canonical layout file for the Quantum project. If you want to add another keyboard, -// this is the style you want to emulate. - #include "preonic.h" -#ifdef BACKLIGHT_ENABLE - #include "backlight.h" +#include "action_layer.h" +#ifdef AUDIO_ENABLE + #include "audio.h" #endif // Each layer gets a name for readability, which is then used in the keymap matrix below. @@ -15,42 +13,150 @@ #define _DV 2 #define _LW 3 #define _RS 4 +#define _AD 5 + +// Macro name shortcuts +#define QWERTY M(_QW) +#define COLEMAK M(_CM) +#define DVORAK M(_DV) +#define LOWER M(_LW) +#define RAISE M(_RS) +#define M_BL 5 +#ifdef AUDIO_ENABLE + #define AUD_OFF M(6) + #define AUD_ON M(7) +#endif + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[_QW] = { /* Qwerty */ + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QW] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, -[_CM] = { /* Colemak */ + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_CM] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, -[_DV] = { /* Dvorak */ + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | " | , | . | P | Y | F | G | C | R | L | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DV] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_BSPC}, + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, -[_RS] = { /* RAISE */ - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LW] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, -[_LW] = { /* LOWER */ + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RS] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Audoff|Aud on| | |Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_AD] = { + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, + {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, + {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } }; @@ -58,28 +164,116 @@ const uint16_t PROGMEM fn_actions[] = { }; +#ifdef AUDIO_ENABLE float start_up[][2] = { - {440.0*pow(2.0,(67)/12.0), 4}, + {440.0*pow(2.0,(55)/12.0), 12}, + {0, 2}, + {440.0*pow(2.0,(67)/12.0), 8}, {440.0*pow(2.0,(64)/12.0), 8}, {440.0*pow(2.0,(55)/12.0), 8}, + {440.0*pow(2.0,(67)/12.0), 12}, + {0, 2}, + {440.0*pow(2.0,(67)/12.0), 12} +}; + +float tone_qw[][2] = { + {440.0*pow(2.0,(59)/12.0), 8}, {440.0*pow(2.0,(60)/12.0), 8}, - {440.0*pow(2.0,(64)/12.0), 10}, + {0, 4}, + {440.0*pow(2.0,(67)/12.0), 16} }; +float tone_cm[][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), 12}, + {0, 4}, + {440.0*pow(2.0,(71)/12.0), 12} +}; + +float tone_dv[][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), 8}, + {0, 4}, + {440.0*pow(2.0,(69)/12.0), 8}, + {0, 4}, + {440.0*pow(2.0,(67)/12.0), 8} +}; +#endif + + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function switch(id) { - case 0: + case _QW: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + play_notes(&tone_qw, 4, false); + #endif + default_layer_set(1UL<<_QW); + } + break; + case _CM: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + play_notes(&tone_cm, 6, false); + #endif + default_layer_set(1UL<<_CM); + } + break; + case _DV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + play_notes(&tone_dv, 8, false); + #endif + default_layer_set(1UL<<_DV); + } + break; + case _LW: + if (record->event.pressed) { + layer_on(_LW); + update_tri_layer(_LW, _RS, _AD); + } else { + layer_off(_LW); + update_tri_layer(_LW, _RS, _AD); + } + break; + case _RS: + if (record->event.pressed) { + layer_on(_RS); + update_tri_layer(_LW, _RS, _AD); + } else { + layer_off(_RS); + update_tri_layer(_LW, _RS, _AD); + } + break; + case M_BL: if (record->event.pressed) { register_code(KC_RSFT); #ifdef BACKLIGHT_ENABLE backlight_step(); #endif - audio_toggle(); } else { unregister_code(KC_RSFT); - play_notes(&start_up, 5, false); + } + break; + case 6: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + audio_off(); + #endif + } + break; + case 7: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + audio_on(); + play_notes(&start_up, 7, false); + #endif } break; } @@ -87,8 +281,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) }; void matrix_init_user(void) { -#ifdef AUDIO_ENABLE + #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 5, false); -#endif + play_notes(&start_up, 7, false); + #endif } diff --git a/keyboard/preonic/keymaps/default/makefile.mk b/keyboard/preonic/keymaps/default/makefile.mk new file mode 100644 index 0000000000..628167ff66 --- /dev/null +++ b/keyboard/preonic/keymaps/default/makefile.mk @@ -0,0 +1 @@ +AUDIO_ENABLE = yes \ No newline at end of file -- cgit v1.2.3 From 86169833c597fa5f2b5226e1587c48a6692ec017 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 16 Apr 2016 15:47:17 -0400 Subject: updates to preonic default, music mode integrated --- keyboard/preonic/keymaps/default/keymap.c | 160 ++++++++++++++++++++---------- 1 file changed, 110 insertions(+), 50 deletions(-) (limited to 'keyboard') diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index c52d8472f4..6824f68b60 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -1,31 +1,40 @@ #include "preonic.h" #include "action_layer.h" +#include "eeconfig.h" #ifdef AUDIO_ENABLE #include "audio.h" + #define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ + 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ + 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \ + 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \ + 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } #endif // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QW 0 -#define _CM 1 -#define _DV 2 -#define _LW 3 -#define _RS 4 -#define _AD 5 +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 5 +#define _MUSIC 6 // Macro name shortcuts -#define QWERTY M(_QW) -#define COLEMAK M(_CM) -#define DVORAK M(_DV) -#define LOWER M(_LW) -#define RAISE M(_RS) +#define QWERTY M(_QWERTY) +#define COLEMAK M(_COLEMAK) +#define DVORAK M(_DVORAK) +#define LOWER M(_LOWER) +#define RAISE M(_RAISE) #define M_BL 5 #ifdef AUDIO_ENABLE #define AUD_OFF M(6) #define AUD_ON M(7) #endif +#define MUS_OFF M(8) +#define MUS_ON M(9) // Fillers to make layering more clear #define _______ KC_TRNS @@ -46,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_QW] = { +[_QWERTY] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_DEL}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, @@ -67,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_CM] = { +[_COLEMAK] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_DEL}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, @@ -88,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_DV] = { +[_DVORAK] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_DEL}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, @@ -109,7 +118,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_LW] = { +[_LOWER] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, @@ -130,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_RS] = { +[_RAISE] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, @@ -151,10 +160,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ -[_AD] = { +[_ADJUST] = { {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* Music (reserved for process_action_user) + * + */ +[_MUSIC] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } @@ -166,24 +186,20 @@ const uint16_t PROGMEM fn_actions[] = { #ifdef AUDIO_ENABLE float start_up[][2] = { - {440.0*pow(2.0,(55)/12.0), 12}, - {0, 2}, - {440.0*pow(2.0,(67)/12.0), 8}, - {440.0*pow(2.0,(64)/12.0), 8}, - {440.0*pow(2.0,(55)/12.0), 8}, - {440.0*pow(2.0,(67)/12.0), 12}, - {0, 2}, - {440.0*pow(2.0,(67)/12.0), 12} + {440.0*pow(2.0,(50)/12.0), 20}, + {440.0*pow(2.0,(62)/12.0), 8}, + {440.0*pow(2.0,(54)/12.0), 20}, + {440.0*pow(2.0,(62)/12.0), 8} }; -float tone_qw[][2] = { +float tone_qwerty[][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_cm[][2] = { +float tone_colemak[][2] = { {440.0*pow(2.0,(59)/12.0), 8}, {440.0*pow(2.0,(60)/12.0), 8}, {0, 4}, @@ -192,7 +208,7 @@ float tone_cm[][2] = { {440.0*pow(2.0,(71)/12.0), 12} }; -float tone_dv[][2] = { +float tone_dvorak[][2] = { {440.0*pow(2.0,(59)/12.0), 8}, {440.0*pow(2.0,(60)/12.0), 8}, {0, 4}, @@ -202,53 +218,66 @@ float tone_dv[][2] = { {0, 4}, {440.0*pow(2.0,(67)/12.0), 8} }; + +float tone_music[][2] = { + {440.0*pow(2.0,(48)/12.0), 8}, + {440.0*pow(2.0,(50)/12.0), 8}, + {440.0*pow(2.0,(52)/12.0), 8}, + {440.0*pow(2.0,(53)/12.0), 8}, + {440.0*pow(2.0,(55)/12.0), 8}, + {440.0*pow(2.0,(57)/12.0), 8}, + {440.0*pow(2.0,(59)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8} +}; #endif const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - // MACRODOWN only works in this function switch(id) { - case _QW: + case _QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qw, 4, false); + play_notes(&tone_qwerty, 4, false); #endif - default_layer_set(1UL<<_QW); + eeconfig_write_default_layer(1UL<<_QWERTY); + default_layer_set(1UL<<_QWERTY); } break; - case _CM: + case _COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_cm, 6, false); + play_notes(&tone_colemak, 6, false); #endif - default_layer_set(1UL<<_CM); + eeconfig_write_default_layer(1UL<<_COLEMAK); + default_layer_set(1UL<<_COLEMAK); } break; - case _DV: + case _DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dv, 8, false); + play_notes(&tone_dvorak, 8, false); #endif - default_layer_set(1UL<<_DV); + eeconfig_write_default_layer(1UL<<_DVORAK); + default_layer_set(1UL<<_DVORAK); } break; - case _LW: + case _LOWER: if (record->event.pressed) { - layer_on(_LW); - update_tri_layer(_LW, _RS, _AD); + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { - layer_off(_LW); - update_tri_layer(_LW, _RS, _AD); + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; - case _RS: + case _RAISE: if (record->event.pressed) { - layer_on(_RS); - update_tri_layer(_LW, _RS, _AD); + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { - layer_off(_RS); - update_tri_layer(_LW, _RS, _AD); + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; case M_BL: @@ -272,7 +301,23 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 7, false); + play_notes(&start_up, 4, false); + #endif + } + break; + case 8: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + layer_off(_MUSIC); + stop_all_notes(); + #endif + } + break; + case 9: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + play_notes(&tone_music, 8, false); + layer_on(_MUSIC); #endif } break; @@ -280,9 +325,24 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; }; +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)261.626)*pow(2.0, -2.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)261.626)*pow(2.0, -2.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) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 7, false); + play_notes(&start_up, 4, false); #endif } -- cgit v1.2.3 From ab19ebd08a8b955775e6fa94cdf6b8d128d8b43c Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 16 Apr 2016 18:51:58 -0400 Subject: MAGIC functionality, AG swap in default layout --- keyboard/planck/keymaps/default/README.md | 32 ------------------------------- keyboard/preonic/Makefile | 2 +- keyboard/preonic/keymaps/default/keymap.c | 19 +++++++++--------- 3 files changed, 11 insertions(+), 42 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/README.md b/keyboard/planck/keymaps/default/README.md index d2f43bbdb8..de9680b498 100644 --- a/keyboard/planck/keymaps/default/README.md +++ b/keyboard/planck/keymaps/default/README.md @@ -1,34 +1,2 @@ # The Default Planck Layout - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QW] = { /* Qwerty */ - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_CM] = { /* Colemak */ - {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_DV] = { /* Dvorak */ - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, - {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_RS] = { /* RAISE */ - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} - }, - [_LW] = { /* LOWER */ - {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} - } - }; \ No newline at end of file diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile index eaf9ef927c..9199968c3d 100644 --- a/keyboard/preonic/Makefile +++ b/keyboard/preonic/Makefile @@ -130,7 +130,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # change to "no" to disable the options, or define them in the makefile.mk in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 6824f68b60..e1f9b62029 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -153,9 +153,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | | Reset| | | | | | | | | | Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Audoff|Aud on| | |Qwerty|Colemk|Dvorak| | | + * | | | |Audoff|Aud on|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | + * | | | |Musoff|Mus on| | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' @@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = { {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} }, @@ -231,6 +231,10 @@ float tone_music[][2] = { }; #endif +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_write_default_layer(default_layer); + default_layer_set(default_layer); +} const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { @@ -240,8 +244,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE play_notes(&tone_qwerty, 4, false); #endif - eeconfig_write_default_layer(1UL<<_QWERTY); - default_layer_set(1UL<<_QWERTY); + persistant_default_layer_set(1UL<<_QWERTY); } break; case _COLEMAK: @@ -249,8 +252,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE play_notes(&tone_colemak, 6, false); #endif - eeconfig_write_default_layer(1UL<<_COLEMAK); - default_layer_set(1UL<<_COLEMAK); + persistant_default_layer_set(1UL<<_COLEMAK); } break; case _DVORAK: @@ -258,8 +260,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) #ifdef AUDIO_ENABLE play_notes(&tone_dvorak, 8, false); #endif - eeconfig_write_default_layer(1UL<<_DVORAK); - default_layer_set(1UL<<_DVORAK); + persistant_default_layer_set(1UL<<_DVORAK); } break; case _LOWER: -- cgit v1.2.3 From c83aa16f1d614c1c10f7597a67ffb9f2ae871951 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 16 Apr 2016 20:26:02 -0400 Subject: fixes audio prescaler to emit correct freq --- keyboard/preonic/keymaps/default/keymap.c | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'keyboard') diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index e1f9b62029..6b62623180 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -186,48 +186,48 @@ const uint16_t PROGMEM fn_actions[] = { #ifdef AUDIO_ENABLE float start_up[][2] = { - {440.0*pow(2.0,(50)/12.0), 20}, - {440.0*pow(2.0,(62)/12.0), 8}, - {440.0*pow(2.0,(54)/12.0), 20}, - {440.0*pow(2.0,(62)/12.0), 8} + {440.0*pow(2.0,(14)/12.0), 20}, + {440.0*pow(2.0,(26)/12.0), 8}, + {440.0*pow(2.0,(18)/12.0), 20}, + {440.0*pow(2.0,(26)/12.0), 8} }; float tone_qwerty[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} + {440.0*pow(2.0,(31)/12.0), 16} }; float tone_colemak[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 12}, + {440.0*pow(2.0,(31)/12.0), 12}, {0, 4}, - {440.0*pow(2.0,(71)/12.0), 12} + {440.0*pow(2.0,(35)/12.0), 12} }; float tone_dvorak[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8}, + {440.0*pow(2.0,(31)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(69)/12.0), 8}, + {440.0*pow(2.0,(33)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8} + {440.0*pow(2.0,(31)/12.0), 8} }; float tone_music[][2] = { - {440.0*pow(2.0,(48)/12.0), 8}, - {440.0*pow(2.0,(50)/12.0), 8}, - {440.0*pow(2.0,(52)/12.0), 8}, - {440.0*pow(2.0,(53)/12.0), 8}, - {440.0*pow(2.0,(55)/12.0), 8}, - {440.0*pow(2.0,(57)/12.0), 8}, - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8} + {440.0*pow(2.0,(12)/12.0), 8}, + {440.0*pow(2.0,(14)/12.0), 8}, + {440.0*pow(2.0,(16)/12.0), 8}, + {440.0*pow(2.0,(17)/12.0), 8}, + {440.0*pow(2.0,(19)/12.0), 8}, + {440.0*pow(2.0,(21)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8} }; #endif @@ -333,9 +333,9 @@ void process_action_user(keyrecord_t *record) { if (IS_LAYER_ON(_MUSIC)) { if (record->event.pressed) { - play_note(((double)261.626)*pow(2.0, -2.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); + play_note(((double)261.626)*pow(2.0, -3.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)261.626)*pow(2.0, -2.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); + stop_note(((double)261.626)*pow(2.0, -3.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); } } -- 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') 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 41cc35425ab32c9a9492006da8b667d01d32dfa6 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 16 Apr 2016 21:31:40 -0400 Subject: rests between notes as an argument --- keyboard/planck/keymaps/default/keymap.c | 10 +++++----- keyboard/preonic/keymaps/default/keymap.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index ede08ad7f1..a6edefefd9 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -194,7 +194,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _QW: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qw, 4, false); + play_notes(&tone_qw, 4, false, 0); #endif default_layer_set(1UL<<_QW); } @@ -202,7 +202,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _CM: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_cm, 6, false); + play_notes(&tone_cm, 6, false, 0); #endif default_layer_set(1UL<<_CM); } @@ -210,7 +210,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _DV: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dv, 8, false); + play_notes(&tone_dv, 8, false, 0); #endif default_layer_set(1UL<<_DV); } @@ -254,7 +254,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 5, false); + play_notes(&start_up, 5, false, 0); #endif } break; @@ -265,6 +265,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 5, false); + play_notes(&start_up, 5, false, 0); #endif } diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 6b62623180..1223793cfa 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -242,7 +242,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qwerty, 4, false); + play_notes(&tone_qwerty, 4, false, 0); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -250,7 +250,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_colemak, 6, false); + play_notes(&tone_colemak, 6, false, 1); #endif persistant_default_layer_set(1UL<<_COLEMAK); } @@ -258,7 +258,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dvorak, 8, false); + play_notes(&tone_dvorak, 8, false, 10); #endif persistant_default_layer_set(1UL<<_DVORAK); } @@ -302,7 +302,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 4, false); + play_notes(&start_up, 4, false, 0); #endif } break; @@ -317,7 +317,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 9: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_music, 8, false); + play_notes(&tone_music, 8, false, 0); layer_on(_MUSIC); #endif } @@ -333,9 +333,9 @@ void process_action_user(keyrecord_t *record) { if (IS_LAYER_ON(_MUSIC)) { if (record->event.pressed) { - play_note(((double)261.626)*pow(2.0, -3.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); + 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)261.626)*pow(2.0, -3.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); + 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))); } } @@ -344,6 +344,6 @@ void process_action_user(keyrecord_t *record) { void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 4, false); + play_notes(&start_up, 4, false, 0); #endif } -- 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') 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 8bbd064cf52a76508589579f19595607a1f3af21 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 16 Apr 2016 23:07:50 -0400 Subject: changes to play_notes, goodbye --- keyboard/planck/keymaps/default/keymap.c | 10 +++++----- keyboard/preonic/Makefile | 2 +- keyboard/preonic/config.h | 4 ++-- keyboard/preonic/keymaps/default/keymap.c | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index a6edefefd9..5591b337dd 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -194,7 +194,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _QW: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qw, 4, false, 0); + play_notes(&tone_qw, false, 0); #endif default_layer_set(1UL<<_QW); } @@ -202,7 +202,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _CM: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_cm, 6, false, 0); + play_notes(&tone_cm, false, 0); #endif default_layer_set(1UL<<_CM); } @@ -210,7 +210,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _DV: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dv, 8, false, 0); + play_notes(&tone_dv, false, 0); #endif default_layer_set(1UL<<_DV); } @@ -254,7 +254,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 5, false, 0); + play_notes(&start_up, false, 0); #endif } break; @@ -265,6 +265,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 5, false, 0); + play_notes(&start_up, false, 0); #endif } diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile index 9199968c3d..3504e27201 100644 --- a/keyboard/preonic/Makefile +++ b/keyboard/preonic/Makefile @@ -133,7 +133,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality diff --git a/keyboard/preonic/config.h b/keyboard/preonic/config.h index 5528667fa7..bb9d29dab7 100644 --- a/keyboard/preonic/config.h +++ b/keyboard/preonic/config.h @@ -73,10 +73,10 @@ along with this program. If not, see . */ /* disable debug print */ -#define NO_DEBUG +// #define NO_DEBUG /* disable print */ -#define NO_PRINT +// #define NO_PRINT /* disable action features */ //#define NO_ACTION_LAYER diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 1223793cfa..c7b6b89f2c 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -242,7 +242,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qwerty, 4, false, 0); + play_notes(&tone_qwerty, false, 0); #endif persistant_default_layer_set(1UL<<_QWERTY); } @@ -250,7 +250,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_colemak, 6, false, 1); + play_notes(&tone_colemak, false, 0); #endif persistant_default_layer_set(1UL<<_COLEMAK); } @@ -258,7 +258,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dvorak, 8, false, 10); + play_notes(&tone_dvorak, false, 0); #endif persistant_default_layer_set(1UL<<_DVORAK); } @@ -302,7 +302,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 4, false, 0); + play_notes(&start_up, false, 0); #endif } break; @@ -317,7 +317,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 9: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_music, 8, false, 0); + play_notes(&tone_music, false, 0); layer_on(_MUSIC); #endif } @@ -344,6 +344,6 @@ void process_action_user(keyrecord_t *record) { void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 4, false, 0); + play_notes(&start_up, false, 0); #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') 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 a67d425f4d5278595e7ab785a0f246b83fb1a09f Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sun, 17 Apr 2016 01:00:39 -0400 Subject: planck default layout updates --- keyboard/planck/Makefile | 4 +- keyboard/planck/keymaps/default/keymap.c | 183 ++++++++++++++++++++----------- 2 files changed, 123 insertions(+), 64 deletions(-) (limited to 'keyboard') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index 83b8303b02..01d9e3ce9a 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -139,10 +139,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # change to "no" to disable the options, or define them in the makefile.mk in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 207af2a1df..aecddec4a1 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -11,24 +11,27 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QW 0 -#define _CM 1 -#define _DV 2 -#define _LW 3 -#define _RS 4 -#define _AD 5 +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 5 +#define _MUSIC 6 // Macro name shortcuts -#define QWERTY M(_QW) -#define COLEMAK M(_CM) -#define DVORAK M(_DV) -#define LOWER M(_LW) -#define RAISE M(_RS) +#define QWERTY M(_QWERTY) +#define COLEMAK M(_COLEMAK) +#define DVORAK M(_DVORAK) +#define LOWER M(_LOWER) +#define RAISE M(_RAISE) #define M_BL 5 #ifdef AUDIO_ENABLE #define AUD_OFF M(6) #define AUD_ON M(7) #endif +#define MUS_OFF M(8) +#define MUS_ON M(9) // Fillers to make layering more clear #define _______ KC_TRNS @@ -47,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_QW] = { +[_QWERTY] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, @@ -65,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_CM] = { +[_COLEMAK] = { {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, @@ -83,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_DV] = { +[_DVORAK] = { {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, @@ -101,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_LW] = { +[_LOWER] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, @@ -119,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_RS] = { +[_RAISE] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, @@ -130,16 +133,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | | Reset| | | | | | | | | | Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff| | |Qwerty|Colemk|Dvorak| | | + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * |------+------+------+------+------+------|------+------+------+------+------+------| * | | | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ -[_AD] = { +[_ADJUST] = { {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* Music (reserved for process_action_user) + * + */ +[_MUSIC] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } @@ -150,87 +163,102 @@ const uint16_t PROGMEM fn_actions[] = { }; #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} +float tone_startup[][2] = { + {440.0*pow(2.0,(31)/12.0), 12}, + {440.0*pow(2.0,(28)/12.0), 8}, + {440.0*pow(2.0,(19)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, + {440.0*pow(2.0,(28)/12.0), 20} }; -float tone_qw[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, +float tone_qwerty[][2] = { + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} + {440.0*pow(2.0,(31)/12.0), 16} }; -float tone_cm[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, +float tone_colemak[][2] = { + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 12}, + {440.0*pow(2.0,(31)/12.0), 12}, {0, 4}, - {440.0*pow(2.0,(71)/12.0), 12} + {440.0*pow(2.0,(35)/12.0), 12} }; -float tone_dv[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, +float tone_dvorak[][2] = { + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8}, + {440.0*pow(2.0,(31)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(69)/12.0), 8}, + {440.0*pow(2.0,(33)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8} + {440.0*pow(2.0,(31)/12.0), 8} +}; + +float tone_music[][2] = { + {440.0*pow(2.0,(12)/12.0), 8}, + {440.0*pow(2.0,(14)/12.0), 8}, + {440.0*pow(2.0,(16)/12.0), 8}, + {440.0*pow(2.0,(17)/12.0), 8}, + {440.0*pow(2.0,(19)/12.0), 8}, + {440.0*pow(2.0,(21)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8} }; #endif +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_write_default_layer(default_layer); + default_layer_set(default_layer); +} + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - // MACRODOWN only works in this function switch(id) { - case _QW: + case _QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qw, false, 0); + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); #endif - default_layer_set(1UL<<_QW); + persistant_default_layer_set(1UL<<_QWERTY); } break; - case _CM: + case _COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_cm, false, 0); + PLAY_NOTE_ARRAY(tone_colemak, false, 0); #endif - default_layer_set(1UL<<_CM); + persistant_default_layer_set(1UL<<_COLEMAK); } break; - case _DV: + case _DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_dv, false, 0); + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); #endif - default_layer_set(1UL<<_DV); + persistant_default_layer_set(1UL<<_DVORAK); } break; - case _LW: + case _LOWER: if (record->event.pressed) { - layer_on(_LW); - update_tri_layer(_LW, _RS, _AD); + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { - layer_off(_LW); - update_tri_layer(_LW, _RS, _AD); + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; - case _RS: + case _RAISE: if (record->event.pressed) { - layer_on(_RS); - update_tri_layer(_LW, _RS, _AD); + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { - layer_off(_RS); - update_tri_layer(_LW, _RS, _AD); + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; case M_BL: @@ -254,7 +282,23 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - PLAY_NOTE_ARRAY(start_up, false, 0); + PLAY_NOTE_ARRAY(tone_startup, false, 0); + #endif + } + break; + case 8: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + layer_off(_MUSIC); + stop_all_notes(); + #endif + } + break; + case 9: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_music, false, 0); + layer_on(_MUSIC); #endif } break; @@ -262,9 +306,24 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; }; +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) { #ifdef AUDIO_ENABLE init_notes(); - PLAY_NOTE_ARRAY(start_up, false, 0); + PLAY_NOTE_ARRAY(tone_startup, false, 0); #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') 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 ++++++++++++++++++-------------- keyboard/atomic/keymaps/pvc/makefile.mk | 2 +- 2 files changed, 124 insertions(+), 94 deletions(-) (limited to 'keyboard') 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 diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk index d469966501..eefa42855f 100644 --- a/keyboard/atomic/keymaps/pvc/makefile.mk +++ b/keyboard/atomic/keymaps/pvc/makefile.mk @@ -1,7 +1,7 @@ BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -- cgit v1.2.3 From 23231fa577f7c6c585124226a83f21a7668e62dd Mon Sep 17 00:00:00 2001 From: IBNobody Date: Sun, 17 Apr 2016 14:16:03 -0500 Subject: Converted goodbye to notes, fixed eighth dotted note macro --- keyboard/atomic/keymaps/pvc/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboard') diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk index eefa42855f..d469966501 100644 --- a/keyboard/atomic/keymaps/pvc/makefile.mk +++ b/keyboard/atomic/keymaps/pvc/makefile.mk @@ -1,7 +1,7 @@ BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -- cgit v1.2.3 From ce463ef424c5bd26b84ead7de5f31eab366f98eb Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sun, 17 Apr 2016 18:14:42 -0400 Subject: audio fixes --- keyboard/preonic/keymaps/default/keymap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'keyboard') diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 48bc72dab7..2591af9f02 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -224,6 +224,7 @@ float tone_music[][2] = { {440.0*pow(2.0,(23)/12.0), 8}, {440.0*pow(2.0,(24)/12.0), 8} }; +float ode_to_joy[][2] = SONG(ODE_TO_JOY); #endif void persistant_default_layer_set(uint16_t default_layer) { @@ -312,7 +313,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 9: if (record->event.pressed) { #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_music, false, 0); + init_notes(); + set_tempo(150); + PLAY_NOTE_ARRAY(ode_to_joy, false, .25); layer_on(_MUSIC); #endif } @@ -339,6 +342,6 @@ void process_action_user(keyrecord_t *record) { void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, false, 0); + PLAY_NOTE_ARRAY(start_up, false, 0); #endif } -- 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/atomic.c | 31 +++- keyboard/atomic/keymaps/pvc/config.h | 10 +- keyboard/atomic/keymaps/pvc/keymap.c | 292 ++++++++++++++++++-------------- keyboard/atomic/keymaps/pvc/makefile.mk | 2 +- keyboard/planck/keymaps/pvc_planck.c | 24 +-- keyboard/retro_refit/retro_refit.c | 32 ++-- 6 files changed, 222 insertions(+), 169 deletions(-) (limited to 'keyboard') diff --git a/keyboard/atomic/atomic.c b/keyboard/atomic/atomic.c index 30e8122893..5e31264e68 100644 --- a/keyboard/atomic/atomic.c +++ b/keyboard/atomic/atomic.c @@ -2,12 +2,22 @@ __attribute__ ((weak)) void matrix_init_user(void) { - // leave these blank -} + // leave this function blank - it can be defined in a keymap file +}; __attribute__ ((weak)) void matrix_scan_user(void) { - // leave these blank + // leave this function blank - it can be defined in a keymap file +} + +__attribute__ ((weak)) +void process_action_user(keyrecord_t *record) { + // leave this function blank - it can be defined in a keymap file +} + +__attribute__ ((weak)) +void led_set_user(uint8_t usb_led) { + // leave this function blank - it can be defined in a keymap file } void matrix_init_kb(void) { @@ -33,4 +43,17 @@ void matrix_scan_kb(void) { // runs every cycle (a lot) matrix_scan_user(); -} \ No newline at end of file +} + +void process_action_kb(keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + process_action_user(record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboard/atomic/keymaps/pvc/config.h b/keyboard/atomic/keymaps/pvc/config.h index 8449fa06de..cb0b78e447 100644 --- a/keyboard/atomic/keymaps/pvc/config.h +++ b/keyboard/atomic/keymaps/pvc/config.h @@ -41,7 +41,7 @@ along with this program. If not, see . * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * -*/ +*/ #define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } #define ROWS (int []){ D0, D5, B5, B6, B3 } @@ -62,17 +62,17 @@ along with this program. If not, see . /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE -/* +/* * Force NKRO * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the * makefile for this to work.) * * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) * until the next keyboard reset. * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is * fully operational during normal computer usage. * * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) @@ -90,7 +90,7 @@ along with this program. If not, see . * the keyboard. They are best used in combination with the HID Listen program, * found here: https://www.pjrc.com/teensy/hid_listen.html * - * The options below allow the magic key functionality to be changed. This is + * The options below allow the magic key functionality to be changed. This is * useful if your keyboard/keypad is missing keys and you want magic key support. * */ 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< 1) { - layer_on(layer); - } else { - layer_off(layer); - } -} - - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function @@ -161,13 +151,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { print("RS_DN"); layer_on(_RS); - tri_layer++; - update_tri_layer(_FN); + update_tri_layer(_RS, _LW, _FN); } else { print("RS_UP"); layer_off(_RS); - tri_layer--; - update_tri_layer(_FN); + update_tri_layer(_RS, _LW, _FN); phex(layer_state); } break; @@ -176,13 +164,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { print("LW_DN"); layer_on(_LW); - tri_layer++; - update_tri_layer(_FN); + update_tri_layer(_RS, _LW, _FN); } else { print("LW_UP"); layer_off(_LW); - tri_layer--; - update_tri_layer(_FN); + update_tri_layer(_RS, _LW, _FN); } break; diff --git a/keyboard/retro_refit/retro_refit.c b/keyboard/retro_refit/retro_refit.c index 0b13eb8301..78b6edca75 100644 --- a/keyboard/retro_refit/retro_refit.c +++ b/keyboard/retro_refit/retro_refit.c @@ -2,39 +2,39 @@ __attribute__ ((weak)) void matrix_init_user(void) { - // leave this function blank - it can be defined in a keymap file + // leave this function blank - it can be defined in a keymap file }; __attribute__ ((weak)) void matrix_scan_user(void) { - // leave this function blank - it can be defined in a keymap file + // leave this function blank - it can be defined in a keymap file }; __attribute__ ((weak)) void led_set_user(uint8_t usb_led) { - // leave this function blank - it can be defined in a keymap file + // leave this function blank - it can be defined in a keymap file }; void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - - // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS) - DDRD |= (1<<6); - PORTD |= (1<<6); - - matrix_init_user(); + // put your keyboard start-up code here + // runs once when the firmware starts up + + // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS) + DDRD |= (1<<6); + PORTD |= (1<<6); + + matrix_init_user(); }; void amatrix_scan_kb(void) { // put your looping keyboard code here // runs every cycle (a lot) - matrix_scan_user(); + matrix_scan_user(); }; void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here 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') 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') 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