summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIBNobody <protospherex@gmail.com>2016-04-18 15:47:10 -0500
committerIBNobody <protospherex@gmail.com>2016-04-18 15:47:10 -0500
commitcbcf0abe62b764a9f3d80848611dca8291d93eb8 (patch)
tree2014b1d839bfaa29acdbf432265d908562304834
parentd5cc31d7d4fc1a36fc3e3e0018369cb52553f50f (diff)
parent4f4b5b8c18d4f1bf4fd4c51ad6f316501dfbd6cc (diff)
Merge remote-tracking branch 'refs/remotes/origin/personal_atomic_planck'
-rw-r--r--README.md22
-rw-r--r--keyboard/atomic/Makefile91
-rw-r--r--keyboard/atomic/atomic.c31
-rw-r--r--keyboard/atomic/keymaps/pvc/config.h157
-rw-r--r--keyboard/atomic/keymaps/pvc/keymap.c457
-rw-r--r--keyboard/atomic/keymaps/pvc/makefile.mk17
-rw-r--r--keyboard/atomic/keymaps/pvc_atomic.c69
-rw-r--r--keyboard/planck/Makefile57
-rw-r--r--keyboard/planck/config.h4
-rw-r--r--keyboard/planck/keymaps/bone2planck.c112
-rw-r--r--keyboard/planck/keymaps/default/README.md32
-rw-r--r--keyboard/planck/keymaps/default/keymap.c255
-rw-r--r--keyboard/planck/keymaps/default/makefile.mk1
-rw-r--r--keyboard/planck/keymaps/pvc_planck.c24
-rw-r--r--keyboard/preonic/Makefile55
-rw-r--r--keyboard/preonic/config.h4
-rw-r--r--keyboard/preonic/keymaps/default/README.md35
-rw-r--r--keyboard/preonic/keymaps/default/keymap.c335
-rw-r--r--keyboard/preonic/keymaps/default/makefile.mk1
-rw-r--r--keyboard/retro_refit/retro_refit.c32
-rw-r--r--quantum/audio.c259
-rw-r--r--quantum/audio.h45
-rw-r--r--quantum/keymap_common.c275
-rw-r--r--quantum/keymap_common.h32
-rw-r--r--quantum/led.c1
-rw-r--r--quantum/musical_notes.h217
-rw-r--r--quantum/quantum.mk9
-rw-r--r--quantum/song_list.h101
-rw-r--r--quantum/tools/README.md6
-rw-r--r--quantum/tools/eeprom_reset.hex9
-rw-r--r--tmk_core/common.mk30
-rw-r--r--tmk_core/common/action.c8
-rw-r--r--tmk_core/common/action_layer.c12
-rw-r--r--tmk_core/common/action_layer.h1
-rw-r--r--tmk_core/common/action_macro.c8
-rw-r--r--tmk_core/common/action_tapping.c11
-rw-r--r--tmk_core/common/avr/eeconfig.c8
-rw-r--r--tmk_core/common/command.c32
-rw-r--r--tmk_core/common/eeconfig.h6
-rw-r--r--tmk_core/common/keyboard.c8
-rw-r--r--tmk_core/common/keymap.h3
-rw-r--r--tmk_core/common/magic.c36
-rw-r--r--tmk_core/common/magic.h6
-rw-r--r--tmk_core/common/print.h12
-rw-r--r--tmk_core/protocol/lufa.mk4
-rw-r--r--tmk_core/protocol/lufa/lufa.c18
46 files changed, 2373 insertions, 575 deletions
diff --git a/README.md b/README.md
index ab7373023a..6e1ab9bc53 100644
--- a/README.md
+++ b/README.md
@@ -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 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.
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
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
+### 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
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.
+* `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
It's possible to start timers and read values for time-specific events - here's an example:
@@ -292,7 +304,7 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring
Please note that the underglow is not compatible with audio output. So you cannot enable both of them at the same time.
-Please add the following options into your config.h, and set them up according your hardware configuration.
+Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the F4 by default:
#define ws2812_PORTREG PORTF
#define ws2812_DDRREG DDRF
@@ -302,6 +314,12 @@ Please add the following options into your config.h, and set them up according y
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
+You'll need to edit `PORTF`, `DDRF`, and `PF4` on the first three lines to the port/pin you have your LED(s) wired to, eg for B3 change things to:
+
+ #define ws2812_PORTREG PORTB
+ #define ws2812_DDRREG DDRB
+ #define ws2812_pin PB3
+
The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboard/planck/keymaps/yang/keymap.c`
### WS2812 Wiring
diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile
index 20cf4fff18..3f066aebcd 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.
@@ -41,7 +41,6 @@
# Target file name (without extension).
TARGET = atomic
-
# Directory common source filess exist
TOP_DIR = ../..
TMK_DIR = ../../tmk_core
@@ -50,15 +49,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
- SRC := keymaps/default.c $(SRC)
+$(error Keymap file does not exist)
+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
# MCU name
@@ -78,7 +104,6 @@ MCU = atmega32u4
# software delays.
F_CPU = 16000000
-
#
# LUFA specific
#
@@ -110,23 +135,45 @@ 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
-#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
+# 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
+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
@@ -136,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
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
new file mode 100644
index 0000000000..cb0b78e447
--- /dev/null
+++ b/keyboard/atomic/keymaps/pvc/config.h
@@ -0,0 +1,157 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#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..380e69ee93
--- /dev/null
+++ b/keyboard/atomic/keymaps/pvc/keymap.c
@@ -0,0 +1,457 @@
+#include "atomic.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+#include "led.h"
+
+#ifdef AUDIO_ENABLE
+ #include "audio.h"
+ #include "song_list.h"
+#endif
+
+#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 |
+ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
+ * | 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] = {
+ [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_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 },
+ },
+
+
+ [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___, _______, _______ },
+ { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
+ },
+
+ [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___, _______, _______ },
+ { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
+ },
+
+ [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 },
+ },
+
+ [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___, _______, _______ },
+ { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
+ },
+
+ [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);
+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 /* AUDIO_ENABLE */
+
+/*
+void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order)
+{
+ if (order)
+ {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
+ {
+ layer_on(layer3);
+ }
+ else
+ {
+ layer_off(layer3);
+ layer_off(layer4);
+ }
+ }
+ else
+ {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
+ {
+ layer_on(layer4);
+ }
+ else
+ {
+ layer_off(layer3);
+ layer_off(layer4);
+ }
+ }
+}
+*/
+
+void persistant_default_layer_set(uint16_t default_layer)
+{
+ eeconfig_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 MACRO_QWERTY:
+ if (record->event.pressed)
+ {
+ persistant_default_layer_set(1UL<<LAYER_QWERTY);
+ PLAY_NOTE_ARRAY(tone_qwerty, false, STACCATO);
+ }
+ break;
+
+ case MACRO_COLEMAK:
+ if (record->event.pressed)
+ {
+ persistant_default_layer_set(1UL<<LAYER_COLEMAK);
+ PLAY_NOTE_ARRAY(tone_colemak, false, STACCATO);
+ }
+ break;
+
+ case MACRO_DVORAK:
+ if (record->event.pressed)
+ {
+ persistant_default_layer_set(1UL<<LAYER_DVORAK);
+ PLAY_NOTE_ARRAY(tone_dvorak, false, STACCATO);
+ }
+ break;
+
+
+ case MACRO_LOWER:
+ if (record->event.pressed)
+ {
+ layer_on(LAYER_LOWER);
+ update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
+ }
+ else
+ {
+ layer_off(LAYER_LOWER);
+ update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
+ }
+ break;
+
+ case MACRO_RAISE:
+ if (record->event.pressed)
+ {
+ layer_on(LAYER_RAISE);
+ update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
+ }
+ else
+ {
+ layer_off(LAYER_RAISE);
+ update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
+ }
+ break;
+
+ case MACRO_FUNCTION:
+ if (record->event.pressed)
+ {
+ layer_on(LAYER_FUNCTION);
+ }
+ else
+ {
+ layer_off(LAYER_FUNCTION);
+ }
+ break;
+
+ case MACRO_TIMBRE_1:
+ if (record->event.pressed) set_timbre(TIMBRE_12);
+ break;
+
+ case MACRO_TIMBRE_2:
+ if (record->event.pressed) set_timbre(TIMBRE_25);
+ break;
+
+ case MACRO_TIMBRE_3:
+ if (record->event.pressed) set_timbre(TIMBRE_50);
+ break;
+
+ case MACRO_TIMBRE_4:
+ if (record->event.pressed) set_timbre(TIMBRE_75);
+ break;
+
+ case MACRO_TEMPO_U:
+ if (record->event.pressed) increase_tempo(10);
+ break;
+
+ case MACRO_TEMPO_D:
+ if (record->event.pressed) decrease_tempo(10);
+ break;
+
+ case MACRO_TONE_DEFAULT:
+ if (record->event.pressed)
+ {
+ set_timbre(TIMBRE_DEFAULT);
+ set_tempo(TEMPO_DEFAULT);
+ }
+ break;
+
+ case MACRO_AUDIO_OFF:
+ if (record->event.pressed)
+ {
+ #ifdef AUDIO_ENABLE
+ audio_off();
+ #endif
+ }
+ break;
+
+ case MACRO_AUDIO_ON:
+ if (record->event.pressed)
+ {
+ #ifdef AUDIO_ENABLE
+ audio_on();
+ PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO);
+ #endif
+ }
+ break;
+
+ case MACRO_MUSIC_ON:
+ if (record->event.pressed)
+ {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO);
+ layer_on(LAYER_MUSIC);
+ #endif
+ }
+ break;
+
+ case MACRO_MUSIC_OFF:
+ if (record->event.pressed)
+ {
+ #ifdef AUDIO_ENABLE
+ layer_off(LAYER_MUSIC);
+ stop_all_notes();
+ #endif
+ }
+ break;
+
+ default:
+ break;
+
+ }
+ return MACRO_NONE;
+};
+
+
+#ifdef AUDIO_ENABLE
+
+uint8_t starting_note = 0x0C;
+int offset = 7;
+
+
+void process_action_user(keyrecord_t *record)
+{
+ if (IS_LAYER_ON(LAYER_MUSIC))
+ {
+ if (record->event.pressed)
+ {
+ play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF);
+ }
+ else
+ {
+ stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)));
+ }
+ }
+}
+
+
+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;
+
+ if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
+ {
+ // If CAPS LK LED is turning on...
+ PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO);
+ }
+ else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
+ {
+ // If CAPS LK LED is turning off...
+ PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO);
+ }
+ else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
+ {
+ // If NUM LK LED is turning on...
+ PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO);
+ }
+ else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
+ {
+ // If NUM LED is turning off...
+ PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO);
+ }
+ else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
+ {
+ // If SCROLL LK LED is turning on...
+ PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO);
+ }
+ else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
+ {
+ // If SCROLL LED is turning off...
+ PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO);
+ }
+ old_usb_led = usb_led;
+}
+
+
+void play_startup_tone()
+{
+ PLAY_NOTE_ARRAY(tone_my_startup, false, STACCATO);
+}
+
+void play_goodbye_tone()
+{
+ PLAY_NOTE_ARRAY(tone_my_goodbye, false, STACCATO);
+ _delay_ms(2000);
+}
+
+#endif /* AUDIO_ENABLE */
diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk
new file mode 100644
index 0000000000..eefa42855f
--- /dev/null
+++ b/keyboard/atomic/keymaps/pvc/makefile.mk
@@ -0,0 +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 = 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
+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
+
+CONFIG_H = keymaps/$(KEYMAP)/config.h \ No newline at end of file
diff --git a/keyboard/atomic/keymaps/pvc_atomic.c b/keyboard/atomic/keymaps/pvc_atomic.c
deleted file mode 100644
index b18e3a377a..0000000000
--- a/keyboard/atomic/keymaps/pvc_atomic.c
+++ /dev/null
@@ -1,69 +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[] = {
-};
-
-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/planck/Makefile b/keyboard/planck/Makefile
index ae637fc295..01d9e3ce9a 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -41,7 +41,6 @@
# Target file name (without extension).
TARGET = planck
-
# Directory common source filess exist
TOP_DIR = ../..
TMK_DIR = ../../tmk_core
@@ -62,17 +61,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
@@ -94,7 +104,6 @@ MCU = atmega32u4
# software delays.
F_CPU = 16000000
-
#
# LUFA specific
#
@@ -126,31 +135,45 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096
-
# 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 = 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 = 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
-# 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.
+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
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+ifdef KEYMAP
-ifdef BACKLIGHT_ENABLE
- SRC += backlight.c
+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
@@ -160,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
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 <http://www.gnu.org/licenses/>.
*/
/* 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/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;
+};
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/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c
index 30ad877605..aecddec4a1 100644
--- a/keyboard/planck/keymaps/default/keymap.c
+++ b/keyboard/planck/keymaps/default/keymap.c
@@ -2,19 +2,36 @@
// this is the style you want to emulate.
#include "planck.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.
// 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 _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(_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
@@ -33,11 +50,11 @@ 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 },
- {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}
},
/* Colemak
@@ -51,11 +68,11 @@ 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 },
- {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}
},
/* Dvorak
@@ -69,47 +86,75 @@ 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 },
- {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}
+},
+
+/* Lower
+ * ,-----------------------------------------------------------------------------------.
+ * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------|
+ * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | Next | Vol- | Vol+ | Play |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* 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] = {
+[_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_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}
},
-/* Lower
+/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
- * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
+ * | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
- * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
+ * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
- * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
+ * | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | 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_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
+[_ADJUST] = {
+ {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
+ {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
+ {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
+},
+
+/* Music (reserved for process_action_user)
+ *
+ */
+[_MUSIC] = {
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
};
@@ -117,11 +162,106 @@ const uint16_t PROGMEM fn_actions[] = {
};
+#ifdef AUDIO_ENABLE
+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_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,(31)/12.0), 16}
+};
+
+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,(31)/12.0), 12},
+ {0, 4},
+ {440.0*pow(2.0,(35)/12.0), 12}
+};
+
+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,(31)/12.0), 8},
+ {0, 4},
+ {440.0*pow(2.0,(33)/12.0), 8},
+ {0, 4},
+ {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 0:
+ case _QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_QWERTY);
+ }
+ break;
+ case _COLEMAK:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_colemak, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_COLEMAK);
+ }
+ break;
+ case _DVORAK:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_DVORAK);
+ }
+ break;
+ case _LOWER:
+ if (record->event.pressed) {
+ layer_on(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ break;
+ case _RAISE:
+ if (record->event.pressed) {
+ layer_on(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ break;
+ case M_BL:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
@@ -131,6 +271,59 @@ 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) {
+ #ifdef AUDIO_ENABLE
+ audio_off();
+ #endif
+ }
+ break;
+ case 7:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ audio_on();
+ 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;
}
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(tone_startup, false, 0);
+ #endif
+}
diff --git a/keyboard/planck/keymaps/default/makefile.mk b/keyboard/planck/keymaps/default/makefile.mk
new file mode 100644
index 0000000000..8cbec4a1f5
--- /dev/null
+++ b/keyboard/planck/keymaps/default/makefile.mk
@@ -0,0 +1 @@
+AUDIO_ENABLE = yes \ No newline at end of file
diff --git a/keyboard/planck/keymaps/pvc_planck.c b/keyboard/planck/keymaps/pvc_planck.c
index 20bb5d86d7..1de8acb1ea 100644
--- a/keyboard/planck/keymaps/pvc_planck.c
+++ b/keyboard/planck/keymaps/pvc_planck.c
@@ -131,8 +131,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_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, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
}
};
@@ -142,16 +142,6 @@ const uint16_t PROGMEM fn_actions[] = {
};
-int tri_layer = 0;
-void update_tri_layer(int layer) {
- if (tri_layer > 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/preonic/Makefile b/keyboard/preonic/Makefile
index 664aff7321..3504e27201 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 = no # 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 = 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/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 <http://www.gnu.org/licenses/>.
*/
/* 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/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 7846707848..2591af9f02 100644
--- a/keyboard/preonic/keymaps/default/keymap.c
+++ b/keyboard/preonic/keymaps/default/keymap.c
@@ -1,56 +1,177 @@
-// 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"
+#include "eeconfig.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.
// 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 _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(_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
+#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 |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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_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 |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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_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 |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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_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 |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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},
+ {_______, 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 |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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_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|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
+ * |------+------+------+------+------+------|------+------+------+------+------+------|
+ * | | | |Musoff|Mus on| | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | |
+ * `-----------------------------------------------------------------------------------'
+ */
+[_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, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
+ {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
+},
+
+/* Music (reserved for process_action_user)
+ *
+ */
+[_MUSIC] = {
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
+ {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
};
@@ -58,19 +179,105 @@ const uint16_t PROGMEM fn_actions[] = {
};
+#ifdef AUDIO_ENABLE
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,(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,(23)/12.0), 8},
+ {440.0*pow(2.0,(24)/12.0), 8},
+ {0, 4},
+ {440.0*pow(2.0,(31)/12.0), 16}
+};
+
+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,(31)/12.0), 12},
+ {0, 4},
+ {440.0*pow(2.0,(35)/12.0), 12}
+};
+
+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,(31)/12.0), 8},
+ {0, 4},
+ {440.0*pow(2.0,(33)/12.0), 8},
+ {0, 4},
+ {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}
+};
+float ode_to_joy[][2] = SONG(ODE_TO_JOY);
+#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 0:
+ case _QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_QWERTY);
+ }
+ break;
+ case _COLEMAK:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_colemak, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_COLEMAK);
+ }
+ break;
+ case _DVORAK:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_DVORAK);
+ }
+ break;
+ case _LOWER:
+ if (record->event.pressed) {
+ layer_on(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ break;
+ case _RAISE:
+ if (record->event.pressed) {
+ layer_on(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ break;
+ case M_BL:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
@@ -80,13 +287,61 @@ 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) {
+ #ifdef AUDIO_ENABLE
+ audio_off();
+ #endif
+ }
+ break;
+ case 7:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ audio_on();
+ PLAY_NOTE_ARRAY(start_up, 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
+ init_notes();
+ set_tempo(150);
+ PLAY_NOTE_ARRAY(ode_to_joy, false, .25);
+ layer_on(_MUSIC);
+ #endif
+ }
+ break;
}
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
+ #ifdef AUDIO_ENABLE
init_notes();
- play_notes(&start_up, 5, false);
-#endif
+ PLAY_NOTE_ARRAY(start_up, false, 0);
+ #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
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<<USB_LED_CAPS_LOCK)) {
// output low
@@ -62,7 +62,7 @@ void led_set_kb(uint8_t usb_led) {
// Hi-Z
DDRC &= ~(1<<6);
PORTC &= ~(1<<6);
- }
-
- led_set_user(usb_led);
+ }
+
+ led_set_user(usb_led);
}; \ No newline at end of file
diff --git a/quantum/audio.c b/quantum/audio.c
index f29d941d7c..627e3d80a1 100644
--- a/quantum/audio.c
+++ b/quantum/audio.c
@@ -4,12 +4,16 @@
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/io.h>
-
+#include "print.h"
#include "audio.h"
#include "keymap_common.h"
+#include "eeconfig.h"
+
#define PI 3.14159265
+#define CPU_PRESCALER 8
+
// #define PWM_AUDIO
#ifdef PWM_AUDIO
@@ -30,6 +34,8 @@ int voice_place = 0;
double frequency = 0;
int volume = 0;
long position = 0;
+int duty_place = 1;
+int duty_counter = 0;
double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
@@ -51,11 +57,36 @@ bool notes = false;
bool note = false;
float note_frequency = 0;
float note_length = 0;
+float note_tempo = TEMPO_DEFAULT;
+float note_timbre = TIMBRE_DEFAULT;
uint16_t note_position = 0;
float (* notes_pointer)[][2];
-uint8_t notes_length;
+uint8_t notes_count;
bool notes_repeat;
+float notes_rest;
+bool note_resting = false;
+
uint8_t current_note = 0;
+uint8_t rest_counter = 0;
+
+audio_config_t audio_config;
+
+
+void audio_toggle(void) {
+ audio_config.enable ^= 1;
+ eeconfig_write_audio(audio_config.raw);
+}
+
+void audio_on(void) {
+ audio_config.enable = 1;
+ eeconfig_write_audio(audio_config.raw);
+}
+
+void audio_off(void) {
+ audio_config.enable = 0;
+ eeconfig_write_audio(audio_config.raw);
+}
+
void stop_all_notes() {
voices = 0;
@@ -77,58 +108,66 @@ void stop_all_notes() {
}
void stop_note(double freq) {
- #ifdef PWM_AUDIO
- freq = freq / SAMPLE_RATE;
- #endif
- for (int i = 7; i >= 0; i--) {
- if (frequencies[i] == freq) {
- frequencies[i] = 0;
- volumes[i] = 0;
- for (int j = i; (j < 7); j++) {
- frequencies[j] = frequencies[j+1];
- frequencies[j+1] = 0;
- volumes[j] = volumes[j+1];
- volumes[j+1] = 0;
- }
- }
- }
- voices--;
- if (voices < 0)
- voices = 0;
- if (voices == 0) {
+ if (note) {
#ifdef PWM_AUDIO
- TIMSK3 &= ~_BV(OCIE3A);
- #else
- TIMSK3 &= ~_BV(OCIE3A);
- TCCR3A &= ~_BV(COM3A1);
+ freq = freq / SAMPLE_RATE;
#endif
- frequency = 0;
- volume = 0;
- note = false;
- } else {
- double freq = frequencies[voices - 1];
- int vol = volumes[voices - 1];
- double starting_f = frequency;
- if (frequency < freq) {
- sliding = true;
- for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
- frequency = f;
+ for (int i = 7; i >= 0; i--) {
+ if (frequencies[i] == freq) {
+ frequencies[i] = 0;
+ volumes[i] = 0;
+ for (int j = i; (j < 7); j++) {
+ frequencies[j] = frequencies[j+1];
+ frequencies[j+1] = 0;
+ volumes[j] = volumes[j+1];
+ volumes[j+1] = 0;
+ }
}
- sliding = false;
- } else if (frequency > freq) {
- sliding = true;
- for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) {
- frequency = f;
+ }
+ voices--;
+ if (voices < 0)
+ voices = 0;
+ if (voices == 0) {
+ #ifdef PWM_AUDIO
+ TIMSK3 &= ~_BV(OCIE3A);
+ #else
+ TIMSK3 &= ~_BV(OCIE3A);
+ TCCR3A &= ~_BV(COM3A1);
+ #endif
+ frequency = 0;
+ volume = 0;
+ note = false;
+ } else {
+ double freq = frequencies[voices - 1];
+ int vol = volumes[voices - 1];
+ double starting_f = frequency;
+ if (frequency < freq) {
+ sliding = true;
+ for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
+ frequency = f;
+ }
+ sliding = false;
+ } else if (frequency > freq) {
+ sliding = true;
+ for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) {
+ frequency = f;
+ }
+ sliding = false;
}
- sliding = false;
+ frequency = freq;
+ volume = vol;
}
- frequency = freq;
- volume = vol;
}
}
void init_notes() {
+ /* check signature */
+ if (!eeconfig_is_enabled()) {
+ eeconfig_init();
+ }
+ audio_config.raw = eeconfig_read_audio();
+
#ifdef PWM_AUDIO
PLLFRQ = _BV(PDIV2);
PLLCSR = _BV(PLLE);
@@ -144,7 +183,7 @@ void init_notes() {
DDRC |= _BV(PORTC6);
TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs
-
+
TCCR3A = 0x0; // Options not needed
TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC
OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback
@@ -160,20 +199,19 @@ void init_notes() {
ISR(TIMER3_COMPA_vect) {
-
if (note) {
#ifdef PWM_AUDIO
if (voices == 1) {
// SINE
OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2;
-
+
// SQUARE
// if (((int)place) >= 1024){
// OCR4A = 0xFF >> 2;
// } else {
// OCR4A = 0x00;
// }
-
+
// SAWTOOTH
// OCR4A = (int)place / 4;
@@ -213,13 +251,20 @@ ISR(TIMER3_COMPA_vect) {
if (frequency > 0) {
// ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period
// OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period
- if (place > 10) {
+ voice_place %= voices;
+ if (place > (frequencies[voice_place] / 50)) {
voice_place = (voice_place + 1) % voices;
place = 0.0;
}
- ICR3 = (int)(((double)F_CPU) / frequencies[voice_place]); // Set max to the period
- OCR3A = (int)(((double)F_CPU) / frequencies[voice_place]) >> 1; // Set compare to half the period
+ ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period
+ OCR3A = (int)((((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
+ //OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period
place++;
+ // if (duty_counter > (frequencies[voice_place] / 500)) {
+ // duty_place = (duty_place % 3) + 1;
+ // duty_counter = 0;
+ // }
+ // duty_counter++;
}
#endif
}
@@ -245,8 +290,8 @@ ISR(TIMER3_COMPA_vect) {
place -= SINE_LENGTH;
#else
if (note_frequency > 0) {
- ICR3 = (int)(((double)F_CPU) / note_frequency); // Set max to the period
- OCR3A = (int)(((double)F_CPU) / note_frequency) >> 1; // Set compare to half the period
+ ICR3 = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)); // Set max to the period
+ OCR3A = (int)((((double)F_CPU) / (note_frequency * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
} else {
ICR3 = 0;
OCR3A = 0;
@@ -255,9 +300,14 @@ 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 (current_note >= notes_count) {
if (notes_repeat) {
current_note = 0;
} else {
@@ -271,37 +321,54 @@ ISR(TIMER3_COMPA_vect) {
return;
}
}
- #ifdef PWM_AUDIO
- note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
- note_length = (*notes_pointer)[current_note][1];
- #else
- note_frequency = (*notes_pointer)[current_note][0];
- note_length = (*notes_pointer)[current_note][1] / 4;
- #endif
+ if (!note_resting && (notes_rest > 0)) {
+ note_resting = true;
+ note_frequency = 0;
+ note_length = notes_rest;
+ current_note--;
+ } else {
+ note_resting = false;
+ #ifdef PWM_AUDIO
+ note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
+ note_length = (*notes_pointer)[current_note][1] * (note_tempo / 100);
+ #else
+ note_frequency = (*notes_pointer)[current_note][0];
+ note_length = ((*notes_pointer)[current_note][1] / 4) * (note_tempo / 100);
+ #endif
+ }
note_position = 0;
}
}
+ if (!audio_config.enable) {
+ notes = false;
+ note = false;
+ }
}
-void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) {
+void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest) {
+
+if (audio_config.enable) {
+
+ // Cancel note if a note is playing
if (note)
stop_all_notes();
notes = true;
notes_pointer = np;
- notes_length = n_length;
+ notes_count = n_count;
notes_repeat = n_repeat;
+ notes_rest = n_rest;
place = 0;
current_note = 0;
#ifdef PWM_AUDIO
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
- note_length = (*notes_pointer)[current_note][1];
+ note_length = (*notes_pointer)[current_note][1] * (note_tempo / 100);
#else
note_frequency = (*notes_pointer)[current_note][0];
- note_length = (*notes_pointer)[current_note][1] / 4;
+ note_length = ((*notes_pointer)[current_note][1] / 4) * (note_tempo / 100);
#endif
note_position = 0;
@@ -312,9 +379,15 @@ void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) {
TIMSK3 |= _BV(OCIE3A);
TCCR3A |= _BV(COM3A1);
#endif
+
+}
+
}
void play_sample(uint8_t * s, uint16_t l, bool r) {
+
+if (audio_config.enable) {
+
stop_all_notes();
place_int = 0;
sample = s;
@@ -325,9 +398,16 @@ void play_sample(uint8_t * s, uint16_t l, bool r) {
TIMSK3 |= _BV(OCIE3A);
#else
#endif
+
+}
+
}
void play_note(double freq, int vol) {
+
+if (audio_config.enable && voices < 8) {
+
+ // Cancel notes if notes are playing
if (notes)
stop_all_notes();
note = true;
@@ -338,7 +418,7 @@ void play_note(double freq, int vol) {
if (frequency != 0) {
double starting_f = frequency;
if (frequency < freq) {
- for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
+ for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
frequency = f;
}
} else if (frequency > freq) {
@@ -362,4 +442,47 @@ void play_note(double freq, int vol) {
TCCR3A |= _BV(COM3A1);
#endif
-} \ No newline at end of file
+}
+
+}
+
+void set_timbre(float timbre)
+{
+ note_timbre = timbre;
+}
+
+void set_tempo(float tempo)
+{
+ note_tempo = tempo;
+}
+
+void decrease_tempo(uint8_t tempo_change)
+{
+ note_tempo += (float) tempo_change;
+}
+
+void increase_tempo(uint8_t tempo_change)
+{
+ if (note_tempo - (float) tempo_change < 10)
+ {
+ note_tempo = 10;
+ }
+ else
+ {
+ note_tempo -= (float) tempo_change;
+ }
+}
+
+//------------------------------------------------------------------------------
+// Override these functions in your keymap file to play different tunes on
+// startup and bootloader jump
+__attribute__ ((weak))
+void play_startup_tone()
+{
+}
+
+__attribute__ ((weak))
+void play_goodbye_tone()
+{
+}
+//------------------------------------------------------------------------------
diff --git a/quantum/audio.h b/quantum/audio.h
index 99203cea7a..44cafccd68 100644
--- a/quantum/audio.h
+++ b/quantum/audio.h
@@ -2,10 +2,49 @@
#include <stdbool.h>
#include <avr/io.h>
#include <util/delay.h>
+#include "musical_notes.h"
+#include "song_list.h"
+
+#ifndef AUDIO_H
+#define AUDIO_H
+
+typedef union {
+ uint8_t raw;
+ struct {
+ bool enable :1;
+ uint8_t level :7;
+ };
+} audio_config_t;
+
+void audio_toggle(void);
+void audio_on(void);
+void audio_off(void);
void play_sample(uint8_t * s, uint16_t l, bool r);
void play_note(double freq, int vol);
void stop_note(double freq);
-void stop_all_notes();
-void init_notes();
-void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat); \ No newline at end of file
+void stop_all_notes(void);
+void init_notes(void);
+void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest);
+
+void set_timbre(float timbre);
+void set_tempo(float tempo);
+void increase_tempo(uint8_t tempo_change);
+void decrease_tempo(uint8_t tempo_change);
+
+#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), }
+
+// These macros are used to allow play_notes to play an array of indeterminate
+// length. This works around the limitation of C's sizeof operation on pointers.
+// The global float array for the song must be used here.
+#define NOTE_ARRAY_SIZE(x) ((int)(sizeof(x) / (sizeof(x[0]))))
+#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
+
+void play_goodbye_tone(void);
+void play_startup_tone(void);
+
+#endif \ No newline at end of file
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index ae6cddb343..4ee290ad03 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -26,143 +26,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "backlight.h"
#include "keymap_midi.h"
#include "bootloader.h"
+#include "eeconfig.h"
+
+extern keymap_config_t keymap_config;
#include <stdio.h>
#include <inttypes.h>
#ifdef AUDIO_ENABLE
#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},
- };
-#endif
+#endif /* AUDIO_ENABLE */
static action_t keycode_to_action(uint16_t keycode);
/* converts key to action */
action_t action_for_key(uint8_t layer, keypos_t key)
{
- // 16bit keycodes - important
+ // 16bit keycodes - important
uint16_t keycode = keymap_key_to_keycode(layer, key);
- if (keycode >= 0x0100 && keycode < 0x2000) {
- // Has a modifier
- action_t action;
- // Split it up
- action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
- return action;
- } else if (keycode >= 0x2000 && keycode < 0x3000) {
- // Is a shortcut for function layer, pull last 12bits
- // This means we have 4,096 FN macros at our disposal
- return keymap_func_to_action(keycode & 0xFFF);
- } else if (keycode >= 0x3000 && keycode < 0x4000) {
- // When the code starts with 3, it's an action macro.
- action_t action;
- action.code = ACTION_MACRO(keycode & 0xFF);
- return action;
-#ifdef BACKLIGHT_ENABLE
- } else if (keycode >= BL_0 && keycode <= BL_15) {
- action_t action;
- action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
- return action;
- } else if (keycode == BL_DEC) {
- action_t action;
- action.code = ACTION_BACKLIGHT_DECREASE();
- return action;
- } else if (keycode == BL_INC) {
- action_t action;
- action.code = ACTION_BACKLIGHT_INCREASE();
- return action;
- } else if (keycode == BL_TOGG) {
- action_t action;
- action.code = ACTION_BACKLIGHT_TOGGLE();
- return action;
- } else if (keycode == BL_STEP) {
- action_t action;
- action.code = ACTION_BACKLIGHT_STEP();
- return action;
-#endif
- } else if (keycode == RESET) { // RESET is 0x5000, which is why this is here
- action_t action;
- clear_keyboard();
- #ifdef AUDIO_ENABLE
- play_notes(&goodbye, 5, false);
- #endif
- _delay_ms(250);
- #ifdef ATREUS_ASTAR
- *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
- #endif
- bootloader_jump();
- return action;
- } else if (keycode == DEBUG) { // DEBUG is 0x5001
- // TODO: Does this actually work?
- action_t action;
- print("\nDEBUG: enabled.\n");
- debug_enable = true;
- return action;
- } else if (keycode >= 0x5000 && keycode < 0x6000) {
- // Layer movement shortcuts
- // See .h to see constraints/usage
- int type = (keycode >> 0x8) & 0xF;
- if (type == 0x1) {
- // Layer set "GOTO"
- int when = (keycode >> 0x4) & 0x3;
- int layer = keycode & 0xF;
- action_t action;
- action.code = ACTION_LAYER_SET(layer, when);
- return action;
- } else if (type == 0x2) {
- // Momentary layer
- int layer = keycode & 0xFF;
- action_t action;
- action.code = ACTION_LAYER_MOMENTARY(layer);
- return action;
- } else if (type == 0x3) {
- // Set default layer
- int layer = keycode & 0xFF;
- action_t action;
- action.code = ACTION_DEFAULT_LAYER_SET(layer);
- return action;
- } else if (type == 0x4) {
- // Set default layer
- int layer = keycode & 0xFF;
- action_t action;
- action.code = ACTION_LAYER_TOGGLE(layer);
- return action;
- }
-#ifdef MIDI_ENABLE
- } else if (keycode >= 0x6000 && keycode < 0x7000) {
- action_t action;
- action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
- return action;
-#endif
- } else if (keycode >= 0x7000 && keycode < 0x8000) {
- action_t action;
- action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
- return action;
- } else if (keycode >= 0x8000 && keycode < 0x9000) {
- action_t action;
- action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
- return action;
-#ifdef UNICODE_ENABLE
- } else if (keycode >= 0x8000000) {
- action_t action;
- uint16_t unicode = keycode & ~(0x8000);
- action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
- return action;
-#endif
- } else {
-
- }
-
switch (keycode) {
case KC_FN0 ... KC_FN31:
return keymap_fn_to_action(keycode);
-#ifdef BOOTMAGIC_ENABLE
case KC_CAPSLOCK:
case KC_LOCKING_CAPS:
if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) {
@@ -226,7 +110,6 @@ action_t action_for_key(uint8_t layer, keypos_t key)
return keycode_to_action(KC_BSLASH);
}
return keycode_to_action(KC_BSPACE);
-#endif
default:
return keycode_to_action(keycode);
}
@@ -267,6 +150,142 @@ static action_t keycode_to_action(uint16_t keycode)
case KC_TRNS:
action.code = ACTION_TRANSPARENT;
break;
+ case 0x0100 ... 0x1FFF: ;
+ // Has a modifier
+ // Split it up
+ action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
+ break;
+ case 0x2000 ... 0x2FFF:
+ // Is a shortcut for function layer, pull last 12bits
+ // This means we have 4,096 FN macros at our disposal
+ return keymap_func_to_action(keycode & 0xFFF);
+ break;
+ case 0x3000 ... 0x3FFF: ;
+ // When the code starts with 3, it's an action macro.
+ action.code = ACTION_MACRO(keycode & 0xFF);
+ break;
+ #ifdef BACKLIGHT_ENABLE
+ case BL_0 ... BL_15:
+ action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
+ break;
+ case BL_DEC:
+ action.code = ACTION_BACKLIGHT_DECREASE();
+ break;
+ case BL_INC:
+ action.code = ACTION_BACKLIGHT_INCREASE();
+ break;
+ case BL_TOGG:
+ action.code = ACTION_BACKLIGHT_TOGGLE();
+ break;
+ case BL_STEP:
+ action.code = ACTION_BACKLIGHT_STEP();
+ break;
+ #endif
+ case RESET: ; // RESET is 0x5000, which is why this is here
+ clear_keyboard();
+ #ifdef AUDIO_ENABLE
+ play_goodbye_tone();
+ #endif
+ _delay_ms(250);
+ #ifdef ATREUS_ASTAR
+ *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
+ #endif
+ bootloader_jump();
+ break;
+ case DEBUG: ; // DEBUG is 0x5001
+ print("\nDEBUG: enabled.\n");
+ debug_enable = true;
+ break;
+ case 0x5002 ... 0x50FF:
+ // MAGIC actions (BOOTMAGIC without the boot)
+ if (!eeconfig_is_enabled()) {
+ eeconfig_init();
+ }
+ /* keymap config */
+ keymap_config.raw = eeconfig_read_keymap();
+ if (keycode == MAGIC_SWAP_CONTROL_CAPSLOCK) {
+ keymap_config.swap_control_capslock = 1;
+ } else if (keycode == MAGIC_CAPSLOCK_TO_CONTROL) {
+ keymap_config.capslock_to_control = 1;
+ } else if (keycode == MAGIC_SWAP_LALT_LGUI) {
+ keymap_config.swap_lalt_lgui = 1;
+ } else if (keycode == MAGIC_SWAP_RALT_RGUI) {
+ keymap_config.swap_ralt_rgui = 1;
+ } else if (keycode == MAGIC_NO_GUI) {
+ keymap_config.no_gui = 1;
+ } else if (keycode == MAGIC_SWAP_GRAVE_ESC) {
+ keymap_config.swap_grave_esc = 1;
+ } else if (keycode == MAGIC_SWAP_BACKSLASH_BACKSPACE) {
+ keymap_config.swap_backslash_backspace = 1;
+ } else if (keycode == MAGIC_HOST_NKRO) {
+ keymap_config.nkro = 1;
+ } else if (keycode == MAGIC_SWAP_ALT_GUI) {
+ keymap_config.swap_lalt_lgui = 1;
+ keymap_config.swap_ralt_rgui = 1;
+ }
+ /* UNs */
+ else if (keycode == MAGIC_UNSWAP_CONTROL_CAPSLOCK) {
+ keymap_config.swap_control_capslock = 0;
+ } else if (keycode == MAGIC_UNCAPSLOCK_TO_CONTROL) {
+ keymap_config.capslock_to_control = 0;
+ } else if (keycode == MAGIC_UNSWAP_LALT_LGUI) {
+ keymap_config.swap_lalt_lgui = 0;
+ } else if (keycode == MAGIC_UNSWAP_RALT_RGUI) {
+ keymap_config.swap_ralt_rgui = 0;
+ } else if (keycode == MAGIC_UNNO_GUI) {
+ keymap_config.no_gui = 0;
+ } else if (keycode == MAGIC_UNSWAP_GRAVE_ESC) {
+ keymap_config.swap_grave_esc = 0;
+ } else if (keycode == MAGIC_UNSWAP_BACKSLASH_BACKSPACE) {
+ keymap_config.swap_backslash_backspace = 0;
+ } else if (keycode == MAGIC_UNHOST_NKRO) {
+ keymap_config.nkro = 0;
+ } else if (keycode == MAGIC_UNSWAP_ALT_GUI) {
+ keymap_config.swap_lalt_lgui = 0;
+ keymap_config.swap_ralt_rgui = 0;
+ }
+ eeconfig_write_keymap(keymap_config.raw);
+ break;
+ case 0x5100 ... 0x5FFF: ;
+ // Layer movement shortcuts
+ // See .h to see constraints/usage
+ int type = (keycode >> 0x8) & 0xF;
+ if (type == 0x1) {
+ // Layer set "GOTO"
+ int when = (keycode >> 0x4) & 0x3;
+ int layer = keycode & 0xF;
+ action.code = ACTION_LAYER_SET(layer, when);
+ } else if (type == 0x2) {
+ // Momentary layer
+ int layer = keycode & 0xFF;
+ action.code = ACTION_LAYER_MOMENTARY(layer);
+ } else if (type == 0x3) {
+ // Set default layer
+ int layer = keycode & 0xFF;
+ action.code = ACTION_DEFAULT_LAYER_SET(layer);
+ } else if (type == 0x4) {
+ // Set default layer
+ int layer = keycode & 0xFF;
+ action.code = ACTION_LAYER_TOGGLE(layer);
+ }
+ break;
+ #ifdef MIDI_ENABLE
+ case 0x6000 ... 0x6FFF:
+ action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
+ break;
+ #endif
+ case 0x7000 ... 0x7FFF:
+ action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
+ break;
+ case 0x8000 ... 0x8FFF:
+ action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
+ break;
+ #ifdef UNICODE_ENABLE
+ case 0x8000000 ... 0x8FFFFFF:
+ uint16_t unicode = keycode & ~(0x8000);
+ action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
+ break;
+ #endif
default:
action.code = ACTION_NO;
break;
@@ -278,7 +297,7 @@ static action_t keycode_to_action(uint16_t keycode)
/* translates key to keycode */
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
- // Read entire word (16bits)
+ // Read entire word (16bits)
return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
}
@@ -290,6 +309,14 @@ action_t keymap_fn_to_action(uint16_t keycode)
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]) };
}
+
+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 4a877d2a70..ce87e4770e 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #include "print.h"
#include "debug.h"
-#ifdef BOOTMAGIC_ENABLE
/* NOTE: Not portable. Bit field order depends on implementation */
typedef union {
uint16_t raw;
@@ -45,8 +44,6 @@ typedef union {
bool nkro:1;
};
} keymap_config_t;
-keymap_config_t keymap_config;
-#endif
/* translates key to keycode */
@@ -168,6 +165,30 @@ extern const uint16_t fn_actions[];
#define RESET 0x5000
#define DEBUG 0x5001
+// MAGIC keycodes
+#define MAGIC_SWAP_CONTROL_CAPSLOCK 0x5002
+#define MAGIC_UNSWAP_CONTROL_CAPSLOCK 0x5003
+#define MAGIC_CAPSLOCK_TO_CONTROL 0x5004
+#define MAGIC_UNCAPSLOCK_TO_CONTROL 0x5005
+#define MAGIC_SWAP_LALT_LGUI 0x5006
+#define MAGIC_UNSWAP_LALT_LGUI 0x5007
+#define MAGIC_SWAP_RALT_RGUI 0x5008
+#define MAGIC_UNSWAP_RALT_RGUI 0x5009
+#define MAGIC_NO_GUI 0x500a
+#define MAGIC_UNNO_GUI 0x500b
+#define MAGIC_SWAP_GRAVE_ESC 0x500c
+#define MAGIC_UNSWAP_GRAVE_ESC 0x500d
+#define MAGIC_SWAP_BACKSLASH_BACKSPACE 0x500e
+#define MAGIC_UNSWAP_BACKSLASH_BACKSPACE 0x500f
+#define MAGIC_HOST_NKRO 0x5010
+#define MAGIC_UNHOST_NKRO 0x5011
+#define MAGIC_SWAP_ALT_GUI 0x5012
+#define MAGIC_UNSWAP_ALT_GUI 0x5013
+
+#define AG_SWAP MAGIC_SWAP_ALT_GUI
+#define AG_NORM MAGIC_UNSWAP_ALT_GUI
+
+
// GOTO layer - 16 layers max
// when:
// ON_PRESS = 1
@@ -208,5 +229,10 @@ 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
diff --git a/quantum/led.c b/quantum/led.c
index 9cdb8a5c20..208e348f34 100644
--- a/quantum/led.c
+++ b/quantum/led.c
@@ -24,6 +24,7 @@ void led_set_kb(uint8_t usb_led) {
}
+__attribute__ ((weak))
void led_set(uint8_t usb_led)
{
diff --git a/quantum/musical_notes.h b/quantum/musical_notes.h
new file mode 100644
index 0000000000..b08d16a6fa
--- /dev/null
+++ b/quantum/musical_notes.h
@@ -0,0 +1,217 @@
+#ifndef MUSICAL_NOTES_H
+#define MUSICAL_NOTES_H
+
+// Tempo Placeholder
+#define TEMPO_DEFAULT 100
+
+
+#define SONG(notes...) { notes }
+
+
+// Note Types
+#define MUSICAL_NOTE(note, duration) {(NOTE##note), duration}
+#define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64)
+#define HALF_NOTE(note) MUSICAL_NOTE(note, 32)
+#define QUARTER_NOTE(note) MUSICAL_NOTE(note, 16)
+#define EIGHTH_NOTE(note) MUSICAL_NOTE(note, 8)
+#define SIXTEENTH_NOTE(note) MUSICAL_NOTE(note, 4)
+
+#define WHOLE_DOT_NOTE(note) MUSICAL_NOTE(note, 64+32)
+#define HALF_DOT_NOTE(note) MUSICAL_NOTE(note, 32+16)
+#define QUARTER_DOT_NOTE(note) MUSICAL_NOTE(note, 16+8)
+#define EIGHTH_DOT_NOTE(note) MUSICAL_NOTE(note, 8+4)
+#define SIXTEENTH_DOT_NOTE(note) MUSICAL_NOTE(note, 4+2)
+
+// Note Type Shortcuts
+#define M__NOTE(note, duration) MUSICAL_NOTE(note, duration)
+#define W__NOTE(n) WHOLE_NOTE(n)
+#define H__NOTE(n) HALF_NOTE(n)
+#define Q__NOTE(n) QUARTER_NOTE(n)
+#define E__NOTE(n) EIGHTH_NOTE(n)
+#define S__NOTE(n) SIXTEENTH_NOTE(n)
+#define WD_NOTE(n) WHOLE_DOT_NOTE(n)
+#define HD_NOTE(n) HALF_DOT_NOTE(n)
+#define QD_NOTE(n) QUARTER_DOT_NOTE(n)
+#define ED_NOTE(n) EIGHTH_DOT_NOTE(n)
+#define SD_NOTE(n) SIXTEENTH_DOT_NOTE(n)
+
+// Note Styles
+// Staccato makes sure there is a rest between each note. Think: TA TA TA
+// Legato makes notes flow together. Think: TAAA
+#define STACCATO 0.01
+#define LEGATO 0
+
+// Note Timbre
+// Changes how the notes sound
+#define TIMBRE_12 0.125
+#define TIMBRE_25 0.250
+#define TIMBRE_50 0.500
+#define TIMBRE_75 0.750
+#define TIMBRE_DEFAULT TIMBRE_50
+
+
+// Notes - # = Octave
+
+#define NOTE_REST 0.00
+
+/* These notes are currently bugged
+#define NOTE_C0 16.35
+#define NOTE_CS0 17.32
+#define NOTE_D0 18.35
+#define NOTE_DS0 19.45
+#define NOTE_E0 20.60
+#define NOTE_F0 21.83
+#define NOTE_FS0 23.12
+#define NOTE_G0 24.50
+#define NOTE_GS0 25.96
+#define NOTE_A0 27.50
+#define NOTE_AS0 29.14
+#define NOTE_B0 30.87
+#define NOTE_C1 32.70
+#define NOTE_CS1 34.65
+#define NOTE_D1 36.71
+#define NOTE_DS1 38.89
+#define NOTE_E1 41.20
+#define NOTE_F1 43.65
+#define NOTE_FS1 46.25
+#define NOTE_G1 49.00
+#define NOTE_GS1 51.91
+#define NOTE_A1 55.00
+#define NOTE_AS1 58.27
+*/
+
+#define NOTE_B1 61.74
+#define NOTE_C2 65.41
+#define NOTE_CS2 69.30
+#define NOTE_D2 73.42
+#define NOTE_DS2 77.78
+#define NOTE_E2 82.41
+#define NOTE_F2 87.31
+#define NOTE_FS2 92.50
+#define NOTE_G2 98.00
+#define NOTE_GS2 103.83
+#define NOTE_A2 110.00
+#define NOTE_AS2 116.54
+#define NOTE_B2 123.47
+#define NOTE_C3 130.81
+#define NOTE_CS3 138.59
+#define NOTE_D3 146.83
+#define NOTE_DS3 155.56
+#define NOTE_E3 164.81
+#define NOTE_F3 174.61
+#define NOTE_FS3 185.00
+#define NOTE_G3 196.00
+#define NOTE_GS3 207.65
+#define NOTE_A3 220.00
+#define NOTE_AS3 233.08
+#define NOTE_B3 246.94
+#define NOTE_C4 261.63
+#define NOTE_CS4 277.18
+#define NOTE_D4 293.66
+#define NOTE_DS4 311.13
+#define NOTE_E4 329.63
+#define NOTE_F4 349.23
+#define NOTE_FS4 369.99
+#define NOTE_G4 392.00
+#define NOTE_GS4 415.30
+#define NOTE_A4 440.00
+#define NOTE_AS4 466.16
+#define NOTE_B4 493.88
+#define NOTE_C5 523.25
+#define NOTE_CS5 554.37
+#define NOTE_D5 587.33
+#define NOTE_DS5 622.25
+#define NOTE_E5 659.26
+#define NOTE_F5 698.46
+#define NOTE_FS5 739.99
+#define NOTE_G5 783.99
+#define NOTE_GS5 830.61
+#define NOTE_A5 880.00
+#define NOTE_AS5 932.33
+#define NOTE_B5 987.77
+#define NOTE_C6 1046.50
+#define NOTE_CS6 1108.73
+#define NOTE_D6 1174.66
+#define NOTE_DS6 1244.51
+#define NOTE_E6 1318.51
+#define NOTE_F6 1396.91
+#define NOTE_FS6 1479.98
+#define NOTE_G6 1567.98
+#define NOTE_GS6 1661.22
+#define NOTE_A6 1760.00
+#define NOTE_AS6 1864.66
+#define NOTE_B6 1975.53
+#define NOTE_C7 2093.00
+#define NOTE_CS7 2217.46
+#define NOTE_D7 2349.32
+#define NOTE_DS7 2489.02
+#define NOTE_E7 2637.02
+#define NOTE_F7 2793.83
+#define NOTE_FS7 2959.96
+#define NOTE_G7 3135.96
+#define NOTE_GS7 3322.44
+#define NOTE_A7 3520.00
+#define NOTE_AS7 3729.31
+#define NOTE_B7 3951.07
+#define NOTE_C8 4186.01
+#define NOTE_CS8 4434.92
+#define NOTE_D8 4698.64
+#define NOTE_DS8 4978.03
+#define NOTE_E8 5274.04
+#define NOTE_F8 5587.65
+#define NOTE_FS8 5919.91
+#define NOTE_G8 6271.93
+#define NOTE_GS8 6644.88
+#define NOTE_A8 7040.00
+#define NOTE_AS8 7458.62
+#define NOTE_B8 7902.13
+
+// Flat Aliases
+#define NOTE_DF0 NOTE_CS0
+#define NOTE_EF0 NOTE_DS0
+#define NOTE_GF0 NOTE_FS0
+#define NOTE_AF0 NOTE_GS0
+#define NOTE_BF0 NOTE_AS0
+#define NOTE_DF1 NOTE_CS1
+#define NOTE_EF1 NOTE_DS1
+#define NOTE_GF1 NOTE_FS1
+#define NOTE_AF1 NOTE_GS1
+#define NOTE_BF1 NOTE_AS1
+#define NOTE_DF2 NOTE_CS2
+#define NOTE_EF2 NOTE_DS2
+#define NOTE_GF2 NOTE_FS2
+#define NOTE_AF2 NOTE_GS2
+#define NOTE_BF2 NOTE_AS2
+#define NOTE_DF3 NOTE_CS3
+#define NOTE_EF3 NOTE_DS3
+#define NOTE_GF3 NOTE_FS3
+#define NOTE_AF3 NOTE_GS3
+#define NOTE_BF3 NOTE_AS3
+#define NOTE_DF4 NOTE_CS4
+#define NOTE_EF4 NOTE_DS4
+#define NOTE_GF4 NOTE_FS4
+#define NOTE_AF4 NOTE_GS4
+#define NOTE_BF4 NOTE_AS4
+#define NOTE_DF5 NOTE_CS5
+#define NOTE_EF5 NOTE_DS5
+#define NOTE_GF5 NOTE_FS5
+#define NOTE_AF5 NOTE_GS5
+#define NOTE_BF5 NOTE_AS5
+#define NOTE_DF6 NOTE_CS6
+#define NOTE_EF6 NOTE_DS6
+#define NOTE_GF6 NOTE_FS6
+#define NOTE_AF6 NOTE_GS6
+#define NOTE_BF6 NOTE_AS6
+#define NOTE_DF7 NOTE_CS7
+#define NOTE_EF7 NOTE_DS7
+#define NOTE_GF7 NOTE_FS7
+#define NOTE_AF7 NOTE_GS7
+#define NOTE_BF7 NOTE_AS7
+#define NOTE_DF8 NOTE_CS8
+#define NOTE_EF8 NOTE_DS8
+#define NOTE_GF8 NOTE_FS8
+#define NOTE_AF8 NOTE_GS8
+#define NOTE_BF8 NOTE_AS8
+
+
+#endif \ No newline at end of file
diff --git a/quantum/quantum.mk b/quantum/quantum.mk
index de93af7e8c..1fe7390eba 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 ($(strip $(MIDI_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_midi.c
endif
-ifdef AUDIO_ENABLE
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio.c
endif
-ifdef UNICODE_ENABLE
+ifeq ($(strip $(UNICODE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif
-ifdef RGBLIGHT_ENABLE
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c
OPT_DEFS += -DRGBLIGHT_ENABLE
@@ -46,6 +46,7 @@ endif
# Search Path
VPATH += $(TOP_DIR)/$(QUANTUM_DIR)
+VPATH += $(TOP_DIR)/$(QUANTUM_DIR)/keymap_extras
include $(TMK_DIR)/protocol/lufa.mk
diff --git a/quantum/song_list.h b/quantum/song_list.h
new file mode 100644
index 0000000000..e992bd18a2
--- /dev/null
+++ b/quantum/song_list.h
@@ -0,0 +1,101 @@
+#include "musical_notes.h"
+
+#ifndef SONG_LIST_H
+#define SONG_LIST_H
+
+#define ODE_TO_JOY \
+ 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), \
+ QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4),
+
+#define ROCK_A_BYE_BABY \
+ QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), \
+ H__NOTE(_A5), Q__NOTE(_G5), \
+ QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), \
+ H__NOTE(_FS5),
+
+#define CLOSE_ENCOUNTERS_5_NOTE \
+ Q__NOTE(_D5), \
+ Q__NOTE(_E5), \
+ Q__NOTE(_C5), \
+ Q__NOTE(_C4), \
+ Q__NOTE(_G4),
+
+#define DOE_A_DEER \
+ QD_NOTE(_C4), E__NOTE(_D4), \
+ QD_NOTE(_E4), E__NOTE(_C4), \
+ Q__NOTE(_E4), Q__NOTE(_C4), \
+ Q__NOTE(_E4),
+
+#define GOODBYE_SOUND \
+ E__NOTE(_E7), \
+ E__NOTE(_A6), \
+ ED_NOTE(_E6),
+
+#define STARTUP_SOUND \
+ ED_NOTE(_E7 ), \
+ E__NOTE(_CS7), \
+ E__NOTE(_E6 ), \
+ E__NOTE(_A6 ), \
+ M__NOTE(_CS7, 20),
+
+#define QWERTY_SOUND \
+ E__NOTE(_GS6 ), \
+ E__NOTE(_A6 ), \
+ S__NOTE(_REST), \
+ Q__NOTE(_E7 ),
+
+#define COLEMAK_SOUND \
+ E__NOTE(_GS6 ), \
+ E__NOTE(_A6 ), \
+ S__NOTE(_REST), \
+ ED_NOTE(_E7 ), \
+ S__NOTE(_REST), \
+ ED_NOTE(_GS7 ),
+
+#define DVORAK_SOUND \
+ E__NOTE(_GS6 ), \
+ E__NOTE(_A6 ), \
+ S__NOTE(_REST), \
+ E__NOTE(_E7 ), \
+ S__NOTE(_REST), \
+ E__NOTE(_FS7 ), \
+ S__NOTE(_REST), \
+ E__NOTE(_E7 ),
+
+#define MUSIC_SCALE_SOUND \
+ E__NOTE(_A5 ), \
+ E__NOTE(_B5 ), \
+ E__NOTE(_CS6), \
+ E__NOTE(_D6 ), \
+ E__NOTE(_E6 ), \
+ E__NOTE(_FS6), \
+ E__NOTE(_GS6), \
+ E__NOTE(_A6 ),
+
+#define CAPS_LOCK_ON_SOUND \
+ E__NOTE(_A3), \
+ E__NOTE(_B3),
+
+#define CAPS_LOCK_OFF_SOUND \
+ E__NOTE(_B3), \
+ E__NOTE(_A3),
+
+#define SCROLL_LOCK_ON_SOUND \
+ E__NOTE(_D4), \
+ E__NOTE(_E4),
+
+#define SCROLL_LOCK_OFF_SOUND \
+ E__NOTE(_E4), \
+ E__NOTE(_D4),
+
+#define NUM_LOCK_ON_SOUND \
+ E__NOTE(_D5), \
+ E__NOTE(_E5),
+
+#define NUM_LOCK_OFF_SOUND \
+ E__NOTE(_E5), \
+ E__NOTE(_D5),
+
+#endif
diff --git a/quantum/tools/README.md b/quantum/tools/README.md
new file mode 100644
index 0000000000..0702144238
--- /dev/null
+++ b/quantum/tools/README.md
@@ -0,0 +1,6 @@
+`eeprom_reset.hex` is to reset the eeprom on the Atmega32u4, like this:
+
+ dfu-programmer atmega32u4 erase
+ dfu-programmer atmega32u4 flash --eeprom eeprom-reset.bin
+
+ You'll need to reflash afterwards, because DFU requires the flash to be erased before messing with the eeprom. \ No newline at end of file
diff --git a/quantum/tools/eeprom_reset.hex b/quantum/tools/eeprom_reset.hex
new file mode 100644
index 0000000000..a8a75389fe
--- /dev/null
+++ b/quantum/tools/eeprom_reset.hex
@@ -0,0 +1,9 @@
+:10000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
+:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
+:10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
+:10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
+:10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
+:10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
+:10006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0
+:10007000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90
+:00000001FF
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 89c366f554..9cb2eb8ecd 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -17,66 +17,70 @@ SRC += $(COMMON_DIR)/host.c \
# Option modules
-ifdef BOOTMAGIC_ENABLE
+ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes)
SRC += $(COMMON_DIR)/bootmagic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBOOTMAGIC_ENABLE
+else
+ SRC += $(COMMON_DIR)/magic.c
+ SRC += $(COMMON_DIR)/avr/eeconfig.c
endif
-ifdef MOUSEKEY_ENABLE
+ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
SRC += $(COMMON_DIR)/mousekey.c
OPT_DEFS += -DMOUSEKEY_ENABLE
OPT_DEFS += -DMOUSE_ENABLE
endif
-ifdef EXTRAKEY_ENABLE
+ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
OPT_DEFS += -DEXTRAKEY_ENABLE
endif
-ifdef CONSOLE_ENABLE
+ifeq ($(strip $(CONSOLE_ENABLE)), yes)
OPT_DEFS += -DCONSOLE_ENABLE
else
OPT_DEFS += -DNO_PRINT
OPT_DEFS += -DNO_DEBUG
endif
-ifdef COMMAND_ENABLE
+ifeq ($(strip $(COMMAND_ENABLE)), yes)
SRC += $(COMMON_DIR)/command.c
OPT_DEFS += -DCOMMAND_ENABLE
endif
-ifdef NKRO_ENABLE
+ifeq ($(strip $(NKRO_ENABLE)), yes)
OPT_DEFS += -DNKRO_ENABLE
endif
-ifdef MIDI_ENABLE
+ifeq ($(strip $(MIDI_ENABLE)), yes)
OPT_DEFS += -DMIDI_ENABLE
endif
-ifdef AUDIO_ENABLE
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
OPT_DEFS += -DAUDIO_ENABLE
endif
-ifdef USB_6KRO_ENABLE
+ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
OPT_DEFS += -DUSB_6KRO_ENABLE
endif
-ifdef SLEEP_LED_ENABLE
+ifeq ($(strip $(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 ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(COMMON_DIR)/backlight.c
+ SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBACKLIGHT_ENABLE
endif
-ifdef BLUETOOTH_ENABLE
+ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
OPT_DEFS += -DBLUETOOTH_ENABLE
endif
-ifdef KEYMAP_SECTION_ENABLE
+ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes)
OPT_DEFS += -DKEYMAP_SECTION_ENABLE
ifeq ($(strip $(MCU)),atmega32u2)
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index f9e6c17dc3..0162fbd632 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -27,11 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_util.h"
#include "action.h"
-#ifdef DEBUG_ACTION
+//#ifdef DEBUG_ACTION
#include "debug.h"
-#else
-#include "nodebug.h"
-#endif
+//#else
+//#include "nodebug.h"
+//#endif
void action_exec(keyevent_t event)
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c
index e817c0d515..845fbbb210 100644
--- a/tmk_core/common/action_layer.c
+++ b/tmk_core/common/action_layer.c
@@ -4,14 +4,14 @@
#include "util.h"
#include "action_layer.h"
-#ifdef DEBUG_ACTION
+//#ifdef DEBUG_ACTION
#include "debug.h"
-#else
-#include "nodebug.h"
-#endif
+//#else
+//#include "nodebug.h"
+//#endif
-/*
+/*
* Default Layer State
*/
uint32_t default_layer_state = 0;
@@ -52,7 +52,7 @@ void default_layer_xor(uint32_t state)
#ifndef NO_ACTION_LAYER
-/*
+/*
* Keymap Layer State
*/
uint32_t layer_state = 0;
diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h
index 3a4b1e3349..025cf5420f 100644
--- a/tmk_core/common/action_layer.h
+++ b/tmk_core/common/action_layer.h
@@ -68,6 +68,7 @@ void layer_xor(uint32_t state);
#define layer_and(state)
#define layer_xor(state)
#define layer_debug()
+
#endif
/* pressed actions cache */
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c
index 7726b11907..cc78c82327 100644
--- a/tmk_core/common/action_macro.c
+++ b/tmk_core/common/action_macro.c
@@ -19,11 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_macro.h"
#include "wait.h"
-#ifdef DEBUG_ACTION
+//#ifdef DEBUG_ACTION
#include "debug.h"
-#else
-#include "nodebug.h"
-#endif
+//#else
+//#include "nodebug.h"
+//#endif
#ifndef NO_ACTION_MACRO
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c
index 826c233096..6b6fa1dfe2 100644
--- a/tmk_core/common/action_tapping.c
+++ b/tmk_core/common/action_tapping.c
@@ -6,11 +6,11 @@
#include "keycode.h"
#include "timer.h"
-#ifdef DEBUG_ACTION
+//#ifdef DEBUG_ACTION
#include "debug.h"
-#else
-#include "nodebug.h"
-#endif
+//#else
+//#include "nodebug.h"
+//#endif
#ifndef NO_ACTION_TAPPING
@@ -139,7 +139,7 @@ bool process_tapping(keyrecord_t *keyp)
if (event.pressed) {
tapping_key.tap.interrupted = true;
}
- // enqueue
+ // enqueue
return false;
}
}
@@ -324,6 +324,7 @@ bool waiting_buffer_typed(keyevent_t event)
return false;
}
+__attribute__((unused))
bool waiting_buffer_has_anykey_pressed(void)
{
for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) {
diff --git a/tmk_core/common/avr/eeconfig.c b/tmk_core/common/avr/eeconfig.c
index 5bd47dc6ad..25bb9e849c 100644
--- a/tmk_core/common/avr/eeconfig.c
+++ b/tmk_core/common/avr/eeconfig.c
@@ -13,6 +13,9 @@ void eeconfig_init(void)
#ifdef BACKLIGHT_ENABLE
eeprom_write_byte(EECONFIG_BACKLIGHT, 0);
#endif
+#ifdef AUDIO_ENABLE
+ eeprom_write_byte(EECONFIG_AUDIO, 0xFF); // On by default
+#endif
}
void eeconfig_enable(void)
@@ -43,3 +46,8 @@ void eeconfig_write_keymap(uint8_t val) { eeprom_write_byte(EECONFIG_KEYMAP, val
uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); }
#endif
+
+#ifdef AUDIO_ENABLE
+uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); }
+void eeconfig_write_audio(uint8_t val) { eeprom_write_byte(EECONFIG_AUDIO, val); }
+#endif \ No newline at end of file
diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c
index b4cd3ca56b..f06abaf7f0 100644
--- a/tmk_core/common/command.c
+++ b/tmk_core/common/command.c
@@ -49,6 +49,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "usbdrv.h"
#endif
+#ifdef AUDIO_ENABLE
+ #include "audio.h"
+#endif /* AUDIO_ENABLE */
+
static bool command_common(uint8_t code);
static void command_common_help(void);
@@ -122,7 +126,7 @@ static void command_common_help(void)
STR(MAGIC_KEY_VERSION ) ": Version\n"
STR(MAGIC_KEY_STATUS ) ": Status\n"
STR(MAGIC_KEY_CONSOLE ) ": Activate Console Mode\n"
-
+
#if MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
STR(MAGIC_KEY_LAYER0 ) ": Switch to Layer 0\n"
STR(MAGIC_KEY_LAYER1 ) ": Switch to Layer 1\n"
@@ -136,11 +140,11 @@ static void command_common_help(void)
STR(MAGIC_KEY_LAYER9 ) ": Switch to Layer 9\n"
#endif
-#if MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
+#if MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
"F1-F10: Switch to Layer 0-9 (F10 = L0)\n"
#endif
-#if MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
+#if MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
"0-9: Switch to Layer 0-9\n"
#endif
@@ -251,6 +255,7 @@ static void print_status(void)
#ifdef BOOTMAGIC_ENABLE
static void print_eeconfig(void)
{
+#ifndef NO_PRINT
print("default_layer: "); print_dec(eeconfig_read_default_layer()); print("\n");
debug_config_t dc;
@@ -279,9 +284,12 @@ static void print_eeconfig(void)
print("backlight_config.raw: "); print_hex8(bc.raw); print("\n");
print(".enable: "); print_dec(bc.enable); print("\n");
print(".level: "); print_dec(bc.level); print("\n");
-#endif
+#endif /* BACKLIGHT_ENABLE */
+
+#endif /* !NO_PRINT */
+
}
-#endif
+#endif /* BOOTMAGIC_ENABLE */
static bool command_common(uint8_t code)
{
@@ -305,7 +313,7 @@ static bool command_common(uint8_t code)
#ifdef BOOTMAGIC_ENABLE
// print stored eeprom config
- case MAGIC_KC(MAGIC_KEY_EEPROM):
+ case MAGIC_KC(MAGIC_KEY_EEPROM):
print("eeconfig:\n");
print_eeconfig();
break;
@@ -348,6 +356,9 @@ static bool command_common(uint8_t code)
case MAGIC_KC(MAGIC_KEY_BOOTLOADER):
clear_keyboard(); // clear to prevent stuck keys
print("\n\nJumping to bootloader... ");
+ #ifdef AUDIO_ENABLE
+ play_goodbye_tone();
+ #endif
_delay_ms(1000);
bootloader_jump(); // not return
break;
@@ -369,7 +380,7 @@ static bool command_common(uint8_t code)
break;
// debug matrix toggle
- case MAGIC_KC(MAGIC_KEY_DEBUG_MATRIX):
+ case MAGIC_KC(MAGIC_KEY_DEBUG_MATRIX):
debug_matrix = !debug_matrix;
if (debug_matrix) {
print("\nmatrix: on\n");
@@ -380,7 +391,7 @@ static bool command_common(uint8_t code)
break;
// debug keyboard toggle
- case MAGIC_KC(MAGIC_KEY_DEBUG_KBD):
+ case MAGIC_KC(MAGIC_KEY_DEBUG_KBD):
debug_keyboard = !debug_keyboard;
if (debug_keyboard) {
print("\nkeyboard: on\n");
@@ -551,6 +562,7 @@ static uint8_t mousekey_param = 0;
static void mousekey_param_print(void)
{
+#ifndef NO_PRINT
print("\n\t- Values -\n");
print("1: delay(*10ms): "); pdec(mk_delay); print("\n");
print("2: interval(ms): "); pdec(mk_interval); print("\n");
@@ -558,6 +570,8 @@ static void mousekey_param_print(void)
print("4: time_to_max: "); pdec(mk_time_to_max); print("\n");
print("5: wheel_max_speed: "); pdec(mk_wheel_max_speed); print("\n");
print("6: wheel_time_to_max: "); pdec(mk_wheel_time_to_max); print("\n");
+#endif /* !NO_PRINT */
+
}
//#define PRINT_SET_VAL(v) print(#v " = "); print_dec(v); print("\n");
@@ -677,7 +691,7 @@ static void mousekey_console_help(void)
"pgdown: -10\n"
"\n"
"speed = delta * max_speed * (repeat / time_to_max)\n");
- xprintf("where delta: cursor=%d, wheel=%d\n"
+ xprintf("where delta: cursor=%d, wheel=%d\n"
"See http://en.wikipedia.org/wiki/Mouse_keys\n", MOUSEKEY_MOVE_DELTA, MOUSEKEY_WHEEL_DELTA);
}
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h
index 3cd1a174f6..ddefca1347 100644
--- a/tmk_core/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EECONFIG_KEYMAP (uint8_t *)4
#define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5
#define EECONFIG_BACKLIGHT (uint8_t *)6
+#define EECONFIG_AUDIO (uint8_t *)7
/* debug bit */
@@ -72,4 +73,9 @@ uint8_t eeconfig_read_backlight(void);
void eeconfig_write_backlight(uint8_t val);
#endif
+#ifdef AUDIO_ENABLE
+uint8_t eeconfig_read_audio(void);
+void eeconfig_write_audio(uint8_t val);
+#endif
+
#endif
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index 302b3ec87c..1d99818481 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -27,7 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "command.h"
#include "util.h"
#include "sendchar.h"
-#include "bootmagic.h"
+#ifdef BOOTMAGIC_ENABLE
+ #include "bootmagic.h"
+#else
+ #include "magic.h"
+#endif
#include "eeconfig.h"
#include "backlight.h"
#ifdef MOUSEKEY_ENABLE
@@ -86,6 +90,8 @@ void keyboard_init(void)
#ifdef BOOTMAGIC_ENABLE
bootmagic();
+#else
+ magic();
#endif
#ifdef BACKLIGHT_ENABLE
diff --git a/tmk_core/common/keymap.h b/tmk_core/common/keymap.h
index e1a6f992e6..abc9bdb32d 100644
--- a/tmk_core/common/keymap.h
+++ b/tmk_core/common/keymap.h
@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include "action.h"
-
-#ifdef BOOTMAGIC_ENABLE
/* NOTE: Not portable. Bit field order depends on implementation */
typedef union {
uint8_t raw;
@@ -39,7 +37,6 @@ typedef union {
};
} keymap_config_t;
keymap_config_t keymap_config;
-#endif
/* translates key to keycode */
diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c
new file mode 100644
index 0000000000..f21d1346c7
--- /dev/null
+++ b/tmk_core/common/magic.c
@@ -0,0 +1,36 @@
+#include <stdint.h>
+#include <stdbool.h>
+#include <util/delay.h>
+#include "matrix.h"
+#include "bootloader.h"
+#include "debug.h"
+#include "keymap.h"
+#include "host.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+#include "magic.h"
+
+keymap_config_t keymap_config;
+
+void magic(void)
+{
+ /* check signature */
+ if (!eeconfig_is_enabled()) {
+ eeconfig_init();
+ }
+
+ /* debug enable */
+ debug_config.raw = eeconfig_read_debug();
+
+ /* keymap config */
+ keymap_config.raw = eeconfig_read_keymap();
+
+#ifdef NKRO_ENABLE
+ keyboard_nkro = keymap_config.nkro;
+#endif
+
+ uint8_t default_layer = 0;
+ default_layer = eeconfig_read_default_layer();
+ default_layer_set((uint32_t)default_layer);
+
+} \ No newline at end of file
diff --git a/tmk_core/common/magic.h b/tmk_core/common/magic.h
new file mode 100644
index 0000000000..3fa2d8b81c
--- /dev/null
+++ b/tmk_core/common/magic.h
@@ -0,0 +1,6 @@
+#ifndef MAGIC_H
+#define MAGIC_H
+
+void magic(void);
+
+#endif
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h
index c0e9e14309..4f3dde65aa 100644
--- a/tmk_core/common/print.h
+++ b/tmk_core/common/print.h
@@ -2,17 +2,17 @@
/* Very basic print functions, intended to be used with usb_debug_only.c
* http://www.pjrc.com/teensy/
* Copyright (c) 2008 PJRC.COM, LLC
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -91,9 +91,9 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t));
#else /* NO_PRINT */
-#define xprintf
-#define print
-#define println
+#define xprintf(fmt, ...)
+#define print(s)
+#define println(s)
#define print_set_sendchar(func)
#define print_dec(data)
#define print_decs(data)
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index 4905760bb4..9ac6298f11 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 ($(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 @@ ifdef MIDI_ENABLE
$(LUFA_SRC_USBCLASS)
endif
-ifdef BLUETOOTH_ENABLE
+ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c
endif
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 5d40dcf7b2..f03f9a9b92 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2012 Jun Wako <wakojun@gmail.com>
* This file is based on:
* LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse
@@ -152,10 +152,10 @@ static void Console_Task(void)
{
/* Create a temporary buffer to hold the read in report from the host */
uint8_t ConsoleData[CONSOLE_EPSIZE];
-
+
/* Read Console Report Data */
Endpoint_Read_Stream_LE(&ConsoleData, sizeof(ConsoleData), NULL);
-
+
/* Process Console Report Data */
//ProcessConsoleHIDReport(ConsoleData);
}
@@ -183,10 +183,6 @@ static void Console_Task(void)
Endpoint_SelectEndpoint(ep);
}
-#else
-static void Console_Task(void)
-{
-}
#endif
@@ -216,7 +212,7 @@ void EVENT_USB_Device_Disconnect(void)
print("[D]");
/* For battery powered device */
USB_IsInitialized = false;
-/* TODO: This doesn't work. After several plug in/outs can not be enumerated.
+/* TODO: This doesn't work. After several plug in/outs can not be enumerated.
if (USB_IsInitialized) {
USB_Disable(); // Disable all interrupts
USB_Controller_Enable();
@@ -313,7 +309,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
#ifdef MIDI_ENABLE
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
- ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
+ ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
}
@@ -439,7 +435,7 @@ void EVENT_USB_Device_ControlRequest(void)
}
/*******************************************************************************
- * Host driver
+ * Host driver
******************************************************************************/
static uint8_t keyboard_leds(void)
{
@@ -563,7 +559,7 @@ static void send_consumer(uint16_t data)
bluefruit_serial_send(0x00);
bluefruit_serial_send(0x02);
bluefruit_serial_send((bitmap>>8)&0xFF);
- bluefruit_serial_send(bitmap&0xFF);
+ bluefruit_serial_send(bitmap&0xFF);
bluefruit_serial_send(0x00);
bluefruit_serial_send(0x00);
bluefruit_serial_send(0x00);