changing up the makefile a bit

example_keyboards
Jack Humbert 9 years ago
parent ddbe430778
commit 63462bf8c1

@ -38,6 +38,27 @@
# To rebuild project do "make clean" then "make all". # 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 file name (without extension).
TARGET = planck TARGET = planck
@ -62,17 +83,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
@ -127,27 +159,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options ifeq ($(BACKLIGHT_ENABLE), yes)
# 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
SRC += backlight.c SRC += backlight.c
endif endif

@ -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} {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 | * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play | * | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_RS] = { [_LW] = {
{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_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {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_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}
}, },
/* 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 | * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play | * | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LW] = { [_RS] = {
{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_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_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {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_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}
}, },
@ -148,17 +148,18 @@ const uint16_t PROGMEM fn_actions[] = {
}; };
#ifdef AUDIO_ENABLE
float tone_qw[][2] = { float tone_qw[][2] = {
{440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(67)/12.0), 400},
{440.0*pow(2.0,(60)/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} {440.0*pow(2.0,(67)/12.0), 1600}
}; };
float tone_cm[][2] = { float tone_cm[][2] = {
{440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(67)/12.0), 400},
{440.0*pow(2.0,(60)/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}, {440.0*pow(2.0,(67)/12.0), 1000},
{0, 200}, {0, 200},
{440.0*pow(2.0,(67)/12.0), 1000} {440.0*pow(2.0,(67)/12.0), 1000}
@ -167,14 +168,14 @@ float tone_cm[][2] = {
float tone_dv[][2] = { float tone_dv[][2] = {
{440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(67)/12.0), 400},
{440.0*pow(2.0,(60)/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}, {440.0*pow(2.0,(67)/12.0), 800},
{0, 200}, {0, 200},
{440.0*pow(2.0,(67)/12.0), 800}, {440.0*pow(2.0,(67)/12.0), 800},
{0, 200}, {0, 200},
{440.0*pow(2.0,(67)/12.0), 800} {440.0*pow(2.0,(67)/12.0), 800}
}; };
#endif
#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer))) #define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer)))
#define IS_LAYER_OFF(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) { switch(id) {
case M_QW: case M_QW:
if (record->event.pressed) { 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); default_layer_set(1UL<<_QW);
} }
break; break;
case M_CM: case M_CM:
if (record->event.pressed) { 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); default_layer_set(1UL<<_CM);
} }
break; break;
case M_DV: case M_DV:
if (record->event.pressed) { 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); default_layer_set(1UL<<_DV);
} }
break; break;
@ -240,6 +247,7 @@ 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] = { float start_up[][2] = {
{440.0*pow(2.0,(67)/12.0), 650}, {440.0*pow(2.0,(67)/12.0), 650},
{440.0*pow(2.0,(64)/12.0), 450}, {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,(60)/12.0), 450},
{440.0*pow(2.0,(64)/12.0), 1000} {440.0*pow(2.0,(64)/12.0), 1000}
}; };
#endif
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes(); init_notes();
play_notes(&start_up, 5, false); play_notes(&start_up, 5, false);
#endif
} }

@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX
SRC += $(QUANTUM_DIR)/matrix.c SRC += $(QUANTUM_DIR)/matrix.c
endif endif
ifdef MIDI_ENABLE ifeq ($(MIDI_ENABLE), yes)
SRC += $(QUANTUM_DIR)/keymap_midi.c SRC += $(QUANTUM_DIR)/keymap_midi.c
endif endif
ifdef AUDIO_ENABLE ifeq ($(AUDIO_ENABLE), yes)
SRC += $(QUANTUM_DIR)/audio.c SRC += $(QUANTUM_DIR)/audio.c
endif endif
ifdef UNICODE_ENABLE ifeq ($(UNICODE_ENABLE), yes)
SRC += $(QUANTUM_DIR)/keymap_unicode.c SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif endif
ifdef RGBLIGHT_ENABLE ifeq ($(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

@ -17,66 +17,66 @@ SRC += $(COMMON_DIR)/host.c \
# Option modules # Option modules
ifdef BOOTMAGIC_ENABLE ifeq ($(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 ($(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 ($(EXTRAKEY_ENABLE), yes)
OPT_DEFS += -DEXTRAKEY_ENABLE OPT_DEFS += -DEXTRAKEY_ENABLE
endif endif
ifdef CONSOLE_ENABLE ifeq ($(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 ($(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 ($(NKRO_ENABLE), yes)
OPT_DEFS += -DNKRO_ENABLE OPT_DEFS += -DNKRO_ENABLE
endif endif
ifdef MIDI_ENABLE ifeq ($(MIDI_ENABLE), yes)
OPT_DEFS += -DMIDI_ENABLE OPT_DEFS += -DMIDI_ENABLE
endif endif
ifdef AUDIO_ENABLE ifeq ($(AUDIO_ENABLE), yes)
OPT_DEFS += -DAUDIO_ENABLE OPT_DEFS += -DAUDIO_ENABLE
endif endif
ifdef USB_6KRO_ENABLE ifeq ($(USB_6KRO_ENABLE), yes)
OPT_DEFS += -DUSB_6KRO_ENABLE OPT_DEFS += -DUSB_6KRO_ENABLE
endif endif
ifdef SLEEP_LED_ENABLE ifeq ($(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 ($(BACKLIGHT_ENABLE), yes)
SRC += $(COMMON_DIR)/backlight.c SRC += $(COMMON_DIR)/backlight.c
OPT_DEFS += -DBACKLIGHT_ENABLE OPT_DEFS += -DBACKLIGHT_ENABLE
endif endif
ifdef BLUETOOTH_ENABLE ifeq ($(BLUETOOTH_ENABLE), yes)
OPT_DEFS += -DBLUETOOTH_ENABLE OPT_DEFS += -DBLUETOOTH_ENABLE
endif endif
ifdef KEYMAP_SECTION_ENABLE ifeq ($(KEYMAP_SECTION_ENABLE), yes)
OPT_DEFS += -DKEYMAP_SECTION_ENABLE OPT_DEFS += -DKEYMAP_SECTION_ENABLE
ifeq ($(strip $(MCU)),atmega32u2) ifeq ($(strip $(MCU)),atmega32u2)

@ -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 ($(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 ($(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

Loading…
Cancel
Save