1
0
Fork 0

Merge pull request #256 from jackhumbert/new_defaults

New default planck layout, audio fixes, makefile overwrites, tri-layer quantum-wide
This commit is contained in:
Jack Humbert 2016-04-15 16:19:43 -04:00
commit 9111963663
11 changed files with 241 additions and 72 deletions

View file

@ -16,13 +16,21 @@ The documentation below explains QMK customizations and elaborates on some of th
* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there. * If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there.
* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project. * If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project.
### Makefile Options
You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you.
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = yes # MIDI controls MIDI_ENABLE = yes # MIDI controls
# UNICODE_ENABLE = yes # Unicode support - this is commented out, just as an example. You have to use #, not // UNICODE_ENABLE = no # <-- This is how you disable an option, just set it to "no"
BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
### Customizing Makefile options on a per-keymap basis
If your keymap directory has a file called `makefile.mk` (note the lowercase filename, and the `.mk` extension), any Makefile options you set in that file will take precedence over other Makefile options (those set for Quantum as a whole or for your particular keyboard).
So let's say your keyboard's makefile has `CONSOLE_ENABLE = yes` (or maybe doesn't even list the `CONSOLE_ENABLE` option, which would cause it to revert to the global Quantum default). You want your particular keymap to not have the debug console, so you make a file called `makefile.mk` and specify `CONSOLE_ENABLE = no`.
## Quick aliases to common actions ## Quick aliases to common actions
Your keymap can include shortcuts to common operations (called "function actions" in tmk). Your keymap can include shortcuts to common operations (called "function actions" in tmk).
@ -199,6 +207,10 @@ This will clear all mods currently pressed.
This will clear all keys besides the mods currently pressed. This will clear all keys besides the mods currently pressed.
* `update_tri_layer(layer_1, layer_2, layer_3);`
If the user attempts to activate layer 1 AND layer 2 at the same time (for example, by hitting their respective layer keys), layer 3 will be activated. Layers 1 and 2 will _also_ be activated, for the purposes of fallbacks (so a given key will fall back from 3 to 2, to 1 -- and only then to 0).
#### Timer functionality #### Timer functionality
It's possible to start timers and read values for time-specific events - here's an example: It's possible to start timers and read values for time-specific events - here's an example:

View file

@ -41,7 +41,6 @@
# Target file name (without extension). # Target file name (without extension).
TARGET = planck TARGET = planck
# Directory common source filess exist # Directory common source filess exist
TOP_DIR = ../.. TOP_DIR = ../..
TMK_DIR = ../../tmk_core TMK_DIR = ../../tmk_core
@ -62,17 +61,28 @@ ifneq ("$(wildcard keymaps/$(KEYMAP).c)","")
else else
ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","") ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","")
KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c
ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
include keymaps/$(KEYMAP)/makefile.mk
endif
else else
$(error Keymap file does not exist) $(error Keymap file does not exist)
endif
endif endif
endif
else else
ifneq ("$(wildcard keymaps/default.c)","") ifneq ("$(wildcard keymaps/default.c)","")
KEYMAP_FILE = keymaps/default.c KEYMAP_FILE = keymaps/default.c
else else
KEYMAP_FILE = keymaps/default/keymap.c KEYMAP_FILE = keymaps/default/keymap.c
endif endif
ifneq ("$(wildcard keymaps/default/makefile.mk)","")
include keymaps/default/makefile.mk
endif endif
endif
SRC := $(KEYMAP_FILE) $(SRC) SRC := $(KEYMAP_FILE) $(SRC)
CONFIG_H = config.h CONFIG_H = config.h
@ -94,7 +104,6 @@ MCU = atmega32u4
# software delays. # software delays.
F_CPU = 16000000 F_CPU = 16000000
# #
# LUFA specific # LUFA specific
# #
@ -126,31 +135,45 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# USBaspLoader 2048 # USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# comment out to disable the 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) BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400) CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration 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 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 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
# MIDI_ENABLE = yes # MIDI controls MIDI_ENABLE = no # MIDI controls
# AUDIO_ENABLE = yes # Audio output on port C6 AUDIO_ENABLE = no # Audio output on port C6
# UNICODE_ENABLE = yes # Unicode UNICODE_ENABLE = no # Unicode
# BLUETOOTH_ENABLE = ye # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = no # 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. 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 # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifdef KEYMAP
ifdef BACKLIGHT_ENABLE ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
SRC += backlight.c ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
include keymaps/$(KEYMAP)/makefile.mk
endif
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" # Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax #EXTRALDFLAGS = -Wl,--relax

View file

@ -73,10 +73,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* disable debug print */ /* disable debug print */
#define NO_DEBUG //#define NO_DEBUG
/* disable print */ /* disable print */
#define NO_PRINT //#define NO_PRINT
/* disable action features */ /* disable action features */
//#define NO_ACTION_LAYER //#define NO_ACTION_LAYER

View file

@ -2,8 +2,9 @@
// this is the style you want to emulate. // this is the style you want to emulate.
#include "planck.h" #include "planck.h"
#ifdef BACKLIGHT_ENABLE #include "action_layer.h"
#include "backlight.h" #ifdef AUDIO_ENABLE
#include "audio.h"
#endif #endif
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
@ -15,6 +16,15 @@
#define _DV 2 #define _DV 2
#define _LW 3 #define _LW 3
#define _RS 4 #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 // Fillers to make layering more clear
#define _______ KC_TRNS #define _______ KC_TRNS
@ -37,7 +47,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_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_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 }, {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 /* Colemak
@ -55,7 +65,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_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_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 }, {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 /* Dvorak
@ -73,43 +83,61 @@ 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_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_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 }, {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 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | 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_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | 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] = { [_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_BSPC},
{_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {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, DF(_QW), DF(_CM), DF(_DV), RESET, _______}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | 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},
{_______, 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 +145,83 @@ const uint16_t PROGMEM fn_actions[] = {
}; };
#ifdef AUDIO_ENABLE
float tone_qw[][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] = {
{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,(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
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 // MACRODOWN only works in this function
switch(id) { switch(id) {
case 0: case M_QW:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
play_notes(&tone_qw, 4, false);
#endif
default_layer_set(1UL<<_QW);
}
break;
case M_CM:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
play_notes(&tone_cm, 6, false);
#endif
default_layer_set(1UL<<_CM);
}
break;
case M_DV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
play_notes(&tone_dv, 8, false);
#endif
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) { if (record->event.pressed) {
register_code(KC_RSFT); register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
@ -134,3 +234,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
} }
return MACRO_NONE; 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);
#endif
}

View file

@ -0,0 +1 @@
AUDIO_ENABLE = yes

View file

@ -255,7 +255,12 @@ ISR(TIMER3_COMPA_vect) {
note_position++; 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++; current_note++;
if (current_note >= notes_length) { if (current_note >= notes_length) {
if (notes_repeat) { if (notes_repeat) {

View file

@ -33,11 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "audio.h" #include "audio.h"
float goodbye[][2] = { float goodbye[][2] = {
{440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(67)/12.0), 8},
{0, 50}, {440.0*pow(2.0,(60)/12.0), 8},
{440.0*pow(2.0,(60)/12.0), 400}, {440.0*pow(2.0,(55)/12.0), 12},
{0, 50},
{440.0*pow(2.0,(55)/12.0), 600},
}; };
#endif #endif
@ -90,7 +88,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action_t action; action_t action;
clear_keyboard(); clear_keyboard();
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
play_notes(&goodbye, 5, false); play_notes(&goodbye, 3, false);
#endif #endif
_delay_ms(250); _delay_ms(250);
#ifdef ATREUS_ASTAR #ifdef ATREUS_ASTAR
@ -293,3 +291,11 @@ action_t keymap_func_to_action(uint16_t keycode)
// For FUNC without 8bit limit // For FUNC without 8bit limit
return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; 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);
}
}

View file

@ -208,5 +208,9 @@ extern const uint16_t fn_actions[];
#define UNICODE(n) (n | 0x8000) #define UNICODE(n) (n | 0x8000)
#define UC(n) UNICODE(n) #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 #endif

View file

@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX
SRC += $(QUANTUM_DIR)/matrix.c SRC += $(QUANTUM_DIR)/matrix.c
endif endif
ifdef MIDI_ENABLE ifeq ($(strip $(MIDI_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_midi.c SRC += $(QUANTUM_DIR)/keymap_midi.c
endif endif
ifdef AUDIO_ENABLE ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio.c SRC += $(QUANTUM_DIR)/audio.c
endif endif
ifdef UNICODE_ENABLE ifeq ($(strip $(UNICODE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_unicode.c SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif endif
ifdef RGBLIGHT_ENABLE ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c SRC += $(QUANTUM_DIR)/rgblight.c
OPT_DEFS += -DRGBLIGHT_ENABLE OPT_DEFS += -DRGBLIGHT_ENABLE

View file

@ -17,66 +17,67 @@ SRC += $(COMMON_DIR)/host.c \
# Option modules # Option modules
ifdef BOOTMAGIC_ENABLE ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes)
SRC += $(COMMON_DIR)/bootmagic.c SRC += $(COMMON_DIR)/bootmagic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBOOTMAGIC_ENABLE OPT_DEFS += -DBOOTMAGIC_ENABLE
endif endif
ifdef MOUSEKEY_ENABLE ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
SRC += $(COMMON_DIR)/mousekey.c SRC += $(COMMON_DIR)/mousekey.c
OPT_DEFS += -DMOUSEKEY_ENABLE OPT_DEFS += -DMOUSEKEY_ENABLE
OPT_DEFS += -DMOUSE_ENABLE OPT_DEFS += -DMOUSE_ENABLE
endif endif
ifdef EXTRAKEY_ENABLE ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
OPT_DEFS += -DEXTRAKEY_ENABLE OPT_DEFS += -DEXTRAKEY_ENABLE
endif endif
ifdef CONSOLE_ENABLE ifeq ($(strip $(CONSOLE_ENABLE)), yes)
OPT_DEFS += -DCONSOLE_ENABLE OPT_DEFS += -DCONSOLE_ENABLE
else else
OPT_DEFS += -DNO_PRINT OPT_DEFS += -DNO_PRINT
OPT_DEFS += -DNO_DEBUG OPT_DEFS += -DNO_DEBUG
endif endif
ifdef COMMAND_ENABLE ifeq ($(strip $(COMMAND_ENABLE)), yes)
SRC += $(COMMON_DIR)/command.c SRC += $(COMMON_DIR)/command.c
OPT_DEFS += -DCOMMAND_ENABLE OPT_DEFS += -DCOMMAND_ENABLE
endif endif
ifdef NKRO_ENABLE ifeq ($(strip $(NKRO_ENABLE)), yes)
OPT_DEFS += -DNKRO_ENABLE OPT_DEFS += -DNKRO_ENABLE
endif endif
ifdef MIDI_ENABLE ifeq ($(strip $(MIDI_ENABLE)), yes)
OPT_DEFS += -DMIDI_ENABLE OPT_DEFS += -DMIDI_ENABLE
endif endif
ifdef AUDIO_ENABLE ifeq ($(strip $(AUDIO_ENABLE)), yes)
OPT_DEFS += -DAUDIO_ENABLE OPT_DEFS += -DAUDIO_ENABLE
endif endif
ifdef USB_6KRO_ENABLE ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
OPT_DEFS += -DUSB_6KRO_ENABLE OPT_DEFS += -DUSB_6KRO_ENABLE
endif endif
ifdef SLEEP_LED_ENABLE ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
SRC += $(COMMON_DIR)/sleep_led.c SRC += $(COMMON_DIR)/sleep_led.c
OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DSLEEP_LED_ENABLE
OPT_DEFS += -DNO_SUSPEND_POWER_DOWN OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
endif endif
ifdef BACKLIGHT_ENABLE ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(COMMON_DIR)/backlight.c SRC += $(COMMON_DIR)/backlight.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBACKLIGHT_ENABLE OPT_DEFS += -DBACKLIGHT_ENABLE
endif endif
ifdef BLUETOOTH_ENABLE ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
OPT_DEFS += -DBLUETOOTH_ENABLE OPT_DEFS += -DBLUETOOTH_ENABLE
endif endif
ifdef KEYMAP_SECTION_ENABLE ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes)
OPT_DEFS += -DKEYMAP_SECTION_ENABLE OPT_DEFS += -DKEYMAP_SECTION_ENABLE
ifeq ($(strip $(MCU)),atmega32u2) ifeq ($(strip $(MCU)),atmega32u2)

View file

@ -17,7 +17,7 @@ LUFA_SRC = $(LUFA_DIR)/lufa.c \
$(LUFA_DIR)/descriptor.c \ $(LUFA_DIR)/descriptor.c \
$(LUFA_SRC_USB) $(LUFA_SRC_USB)
ifdef MIDI_ENABLE ifeq ($(strip $(MIDI_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/midi/midi.c \ LUFA_SRC += $(LUFA_DIR)/midi/midi.c \
$(LUFA_DIR)/midi/midi_device.c \ $(LUFA_DIR)/midi/midi_device.c \
$(LUFA_DIR)/midi/bytequeue/bytequeue.c \ $(LUFA_DIR)/midi/bytequeue/bytequeue.c \
@ -25,7 +25,7 @@ ifdef MIDI_ENABLE
$(LUFA_SRC_USBCLASS) $(LUFA_SRC_USBCLASS)
endif endif
ifdef BLUETOOTH_ENABLE ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c $(TMK_DIR)/protocol/serial_uart.c
endif endif