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/keymaps/default/keymap.c | 146 ++++++++++++++++++++++++++++--- 1 file changed, 132 insertions(+), 14 deletions(-) (limited to 'keyboard/planck/keymaps/default') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 30ad87760..e06567339 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 + quantum/quantum.mk | 8 ++--- tmk_core/common.mk | 26 +++++++------- tmk_core/protocol/lufa.mk | 4 +-- 6 files changed, 84 insertions(+), 60 deletions(-) create mode 100644 keyboard/planck/keymaps/default/makefile.mk (limited to 'keyboard/planck/keymaps/default') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index ee1c60fed..dc6e46df2 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 e06567339..97ba5d285 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 000000000..628167ff6 --- /dev/null +++ b/keyboard/planck/keymaps/default/makefile.mk @@ -0,0 +1 @@ +AUDIO_ENABLE = yes \ No newline at end of file diff --git a/quantum/quantum.mk b/quantum/quantum.mk index de93af7e8..3069f582c 100644 --- a/quantum/quantum.mk +++ b/quantum/quantum.mk @@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX SRC += $(QUANTUM_DIR)/matrix.c endif -ifdef MIDI_ENABLE +ifeq ($(MIDI_ENABLE), yes) SRC += $(QUANTUM_DIR)/keymap_midi.c endif -ifdef AUDIO_ENABLE +ifeq ($(AUDIO_ENABLE), yes) SRC += $(QUANTUM_DIR)/audio.c endif -ifdef UNICODE_ENABLE +ifeq ($(UNICODE_ENABLE), yes) SRC += $(QUANTUM_DIR)/keymap_unicode.c endif -ifdef RGBLIGHT_ENABLE +ifeq ($(RGBLIGHT_ENABLE), yes) SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += $(QUANTUM_DIR)/rgblight.c OPT_DEFS += -DRGBLIGHT_ENABLE diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 89c366f55..8d028d52a 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -17,66 +17,66 @@ SRC += $(COMMON_DIR)/host.c \ # Option modules -ifdef BOOTMAGIC_ENABLE +ifeq ($(BOOTMAGIC_ENABLE), yes) SRC += $(COMMON_DIR)/bootmagic.c SRC += $(COMMON_DIR)/avr/eeconfig.c OPT_DEFS += -DBOOTMAGIC_ENABLE endif -ifdef MOUSEKEY_ENABLE +ifeq ($(MOUSEKEY_ENABLE), yes) SRC += $(COMMON_DIR)/mousekey.c OPT_DEFS += -DMOUSEKEY_ENABLE OPT_DEFS += -DMOUSE_ENABLE endif -ifdef EXTRAKEY_ENABLE +ifeq ($(EXTRAKEY_ENABLE), yes) OPT_DEFS += -DEXTRAKEY_ENABLE endif -ifdef CONSOLE_ENABLE +ifeq ($(CONSOLE_ENABLE), yes) OPT_DEFS += -DCONSOLE_ENABLE else OPT_DEFS += -DNO_PRINT OPT_DEFS += -DNO_DEBUG endif -ifdef COMMAND_ENABLE +ifeq ($(COMMAND_ENABLE), yes) SRC += $(COMMON_DIR)/command.c OPT_DEFS += -DCOMMAND_ENABLE endif -ifdef NKRO_ENABLE +ifeq ($(NKRO_ENABLE), yes) OPT_DEFS += -DNKRO_ENABLE endif -ifdef MIDI_ENABLE +ifeq ($(MIDI_ENABLE), yes) OPT_DEFS += -DMIDI_ENABLE endif -ifdef AUDIO_ENABLE +ifeq ($(AUDIO_ENABLE), yes) OPT_DEFS += -DAUDIO_ENABLE endif -ifdef USB_6KRO_ENABLE +ifeq ($(USB_6KRO_ENABLE), yes) OPT_DEFS += -DUSB_6KRO_ENABLE endif -ifdef SLEEP_LED_ENABLE +ifeq ($(SLEEP_LED_ENABLE), yes) SRC += $(COMMON_DIR)/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif -ifdef BACKLIGHT_ENABLE +ifeq ($(BACKLIGHT_ENABLE), yes) SRC += $(COMMON_DIR)/backlight.c OPT_DEFS += -DBACKLIGHT_ENABLE endif -ifdef BLUETOOTH_ENABLE +ifeq ($(BLUETOOTH_ENABLE), yes) OPT_DEFS += -DBLUETOOTH_ENABLE endif -ifdef KEYMAP_SECTION_ENABLE +ifeq ($(KEYMAP_SECTION_ENABLE), yes) OPT_DEFS += -DKEYMAP_SECTION_ENABLE ifeq ($(strip $(MCU)),atmega32u2) diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index 4905760bb..f3209c227 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk @@ -17,7 +17,7 @@ LUFA_SRC = $(LUFA_DIR)/lufa.c \ $(LUFA_DIR)/descriptor.c \ $(LUFA_SRC_USB) -ifdef MIDI_ENABLE +ifeq ($(MIDI_ENABLE), yes) LUFA_SRC += $(LUFA_DIR)/midi/midi.c \ $(LUFA_DIR)/midi/midi_device.c \ $(LUFA_DIR)/midi/bytequeue/bytequeue.c \ @@ -25,7 +25,7 @@ ifdef MIDI_ENABLE $(LUFA_SRC_USBCLASS) endif -ifdef BLUETOOTH_ENABLE +ifeq ($(BLUETOOTH_ENABLE), yes) LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ $(TMK_DIR)/protocol/serial_uart.c endif -- 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/planck/keymaps/default') diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h index d3719e0cb..7d64f0977 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 628167ff6..e1c5bd2e8 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 --- tmk_core/common.mk | 1 + 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'keyboard/planck/keymaps/default') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index dc6e46df2..693e9c8aa 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 97ba5d285..151a6b4f4 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" diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 8d028d52a..030767cc3 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -69,6 +69,7 @@ endif ifeq ($(BACKLIGHT_ENABLE), yes) SRC += $(COMMON_DIR)/backlight.c + SRC += $(COMMON_DIR)/avr/eeconfig.c OPT_DEFS += -DBACKLIGHT_ENABLE endif -- 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 +- quantum/quantum.mk | 8 ++-- tmk_core/common.mk | 26 ++++++------ tmk_core/protocol/lufa.mk | 4 +- 5 files changed, 60 insertions(+), 47 deletions(-) (limited to 'keyboard/planck/keymaps/default') diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index 693e9c8aa..8d4e7787a 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 e1c5bd2e8..8cbec4a1f 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 diff --git a/quantum/quantum.mk b/quantum/quantum.mk index 3069f582c..17bb50171 100644 --- a/quantum/quantum.mk +++ b/quantum/quantum.mk @@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX SRC += $(QUANTUM_DIR)/matrix.c endif -ifeq ($(MIDI_ENABLE), yes) +ifeq ($(strip $(MIDI_ENABLE)), yes) SRC += $(QUANTUM_DIR)/keymap_midi.c endif -ifeq ($(AUDIO_ENABLE), yes) +ifeq ($(strip $(AUDIO_ENABLE)), yes) SRC += $(QUANTUM_DIR)/audio.c endif -ifeq ($(UNICODE_ENABLE), yes) +ifeq ($(strip $(UNICODE_ENABLE)), yes) SRC += $(QUANTUM_DIR)/keymap_unicode.c endif -ifeq ($(RGBLIGHT_ENABLE), yes) +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += $(QUANTUM_DIR)/rgblight.c OPT_DEFS += -DRGBLIGHT_ENABLE diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 030767cc3..f8006c670 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -17,67 +17,67 @@ SRC += $(COMMON_DIR)/host.c \ # Option modules -ifeq ($(BOOTMAGIC_ENABLE), yes) +ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes) SRC += $(COMMON_DIR)/bootmagic.c SRC += $(COMMON_DIR)/avr/eeconfig.c OPT_DEFS += -DBOOTMAGIC_ENABLE endif -ifeq ($(MOUSEKEY_ENABLE), yes) +ifeq ($(strip $(MOUSEKEY_ENABLE)), yes) SRC += $(COMMON_DIR)/mousekey.c OPT_DEFS += -DMOUSEKEY_ENABLE OPT_DEFS += -DMOUSE_ENABLE endif -ifeq ($(EXTRAKEY_ENABLE), yes) +ifeq ($(strip $(EXTRAKEY_ENABLE)), yes) OPT_DEFS += -DEXTRAKEY_ENABLE endif -ifeq ($(CONSOLE_ENABLE), yes) +ifeq ($(strip $(CONSOLE_ENABLE)), yes) OPT_DEFS += -DCONSOLE_ENABLE else OPT_DEFS += -DNO_PRINT OPT_DEFS += -DNO_DEBUG endif -ifeq ($(COMMAND_ENABLE), yes) +ifeq ($(strip $(COMMAND_ENABLE)), yes) SRC += $(COMMON_DIR)/command.c OPT_DEFS += -DCOMMAND_ENABLE endif -ifeq ($(NKRO_ENABLE), yes) +ifeq ($(strip $(NKRO_ENABLE)), yes) OPT_DEFS += -DNKRO_ENABLE endif -ifeq ($(MIDI_ENABLE), yes) +ifeq ($(strip $(MIDI_ENABLE)), yes) OPT_DEFS += -DMIDI_ENABLE endif -ifeq ($(AUDIO_ENABLE), yes) +ifeq ($(strip $(AUDIO_ENABLE)), yes) OPT_DEFS += -DAUDIO_ENABLE endif -ifeq ($(USB_6KRO_ENABLE), yes) +ifeq ($(strip $(USB_6KRO_ENABLE)), yes) OPT_DEFS += -DUSB_6KRO_ENABLE endif -ifeq ($(SLEEP_LED_ENABLE), yes) +ifeq ($(strip $(SLEEP_LED_ENABLE)), yes) SRC += $(COMMON_DIR)/sleep_led.c OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DNO_SUSPEND_POWER_DOWN endif -ifeq ($(BACKLIGHT_ENABLE), yes) +ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) SRC += $(COMMON_DIR)/backlight.c SRC += $(COMMON_DIR)/avr/eeconfig.c OPT_DEFS += -DBACKLIGHT_ENABLE endif -ifeq ($(BLUETOOTH_ENABLE), yes) +ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) OPT_DEFS += -DBLUETOOTH_ENABLE endif -ifeq ($(KEYMAP_SECTION_ENABLE), yes) +ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes) OPT_DEFS += -DKEYMAP_SECTION_ENABLE ifeq ($(strip $(MCU)),atmega32u2) diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index f3209c227..9ac6298f1 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk @@ -17,7 +17,7 @@ LUFA_SRC = $(LUFA_DIR)/lufa.c \ $(LUFA_DIR)/descriptor.c \ $(LUFA_SRC_USB) -ifeq ($(MIDI_ENABLE), yes) +ifeq ($(strip $(MIDI_ENABLE)), yes) LUFA_SRC += $(LUFA_DIR)/midi/midi.c \ $(LUFA_DIR)/midi/midi_device.c \ $(LUFA_DIR)/midi/bytequeue/bytequeue.c \ @@ -25,7 +25,7 @@ ifeq ($(MIDI_ENABLE), yes) $(LUFA_SRC_USBCLASS) endif -ifeq ($(BLUETOOTH_ENABLE), yes) +ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ $(TMK_DIR)/protocol/serial_uart.c endif -- 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 ++++++++++++++++---------------- quantum/audio.c | 7 ++++- quantum/keymap_common.c | 10 +++---- 3 files changed, 33 insertions(+), 30 deletions(-) (limited to 'keyboard/planck/keymaps/default') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 151a6b4f4..dee2840f2 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 diff --git a/quantum/audio.c b/quantum/audio.c index f29d941d7..50e5505fe 100644 --- a/quantum/audio.c +++ b/quantum/audio.c @@ -255,7 +255,12 @@ ISR(TIMER3_COMPA_vect) { note_position++; - if (note_position >= note_length) { + bool end_of_note = false; + if (ICR3 > 0) + end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF)); + else + end_of_note = (note_position >= (note_length * 0x7FF)); + if (end_of_note) { current_note++; if (current_note >= notes_length) { if (notes_repeat) { diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index ae6cddb34..e3030a886 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -33,11 +33,9 @@ along with this program. If not, see . #include "audio.h" float goodbye[][2] = { - {440.0*pow(2.0,(67)/12.0), 400}, - {0, 50}, - {440.0*pow(2.0,(60)/12.0), 400}, - {0, 50}, - {440.0*pow(2.0,(55)/12.0), 600}, + {440.0*pow(2.0,(67)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(55)/12.0), 12}, }; #endif @@ -90,7 +88,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) action_t action; clear_keyboard(); #ifdef AUDIO_ENABLE - play_notes(&goodbye, 5, false); + play_notes(&goodbye, 3, false); #endif _delay_ms(250); #ifdef ATREUS_ASTAR -- cgit v1.2.3 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 --------- quantum/keymap_common.c | 8 ++++++++ quantum/keymap_common.h | 4 ++++ 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'keyboard/planck/keymaps/default') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index dee2840f2..56092d04f 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 diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index e3030a886..3a00d36f0 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -291,3 +291,11 @@ action_t keymap_func_to_action(uint16_t keycode) // For FUNC without 8bit limit return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; } + +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); + } +} diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 4a877d2a7..7452a1ff3 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h @@ -208,5 +208,9 @@ extern const uint16_t fn_actions[]; #define UNICODE(n) (n | 0x8000) #define UC(n) UNICODE(n) +// For tri-layer +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); +#define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer))) +#define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer))) #endif -- cgit v1.2.3