diff options
Diffstat (limited to 'keyboard')
-rw-r--r-- | keyboard/atomic/Makefile | 91 | ||||
-rw-r--r-- | keyboard/atomic/config.h | 2 | ||||
-rw-r--r-- | keyboard/atomic/keymaps/pc_atomic.c | 75 | ||||
-rw-r--r-- | keyboard/atomic/keymaps/pvc/config.h | 157 | ||||
-rw-r--r-- | keyboard/atomic/keymaps/pvc/keymap.c | 309 | ||||
-rw-r--r-- | keyboard/atomic/keymaps/pvc/makefile.mk | 17 | ||||
-rw-r--r-- | keyboard/planck/Makefile | 6 | ||||
-rw-r--r-- | keyboard/planck/keymaps/default/README.md | 32 | ||||
-rw-r--r-- | keyboard/planck/keymaps/default/keymap.c | 183 | ||||
-rw-r--r-- | keyboard/planck/keymaps/pvc_planck.c (renamed from keyboard/planck/keymaps/pc.c) | 71 | ||||
-rw-r--r-- | keyboard/preonic/Makefile | 4 | ||||
-rw-r--r-- | keyboard/preonic/config.h | 4 | ||||
-rw-r--r-- | keyboard/preonic/keymaps/default/keymap.c | 88 |
13 files changed, 776 insertions, 263 deletions
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/config.h b/keyboard/atomic/config.h index f30a9e6cc4..1b34decf9c 100644 --- a/keyboard/atomic/config.h +++ b/keyboard/atomic/config.h @@ -130,7 +130,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //#define MAGIC_KEY_LAYER7 7 //#define MAGIC_KEY_LAYER8 8 //#define MAGIC_KEY_LAYER9 9 -//#define MAGIC_KEY_BOOTLOADER PAUSE +#define MAGIC_KEY_BOOTLOADER B //#define MAGIC_KEY_LOCK CAPS //#define MAGIC_KEY_EEPROM E //#define MAGIC_KEY_NKRO N diff --git a/keyboard/atomic/keymaps/pc_atomic.c b/keyboard/atomic/keymaps/pc_atomic.c deleted file mode 100644 index bdf575046b..0000000000 --- a/keyboard/atomic/keymaps/pc_atomic.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "atomic.h" - -#define _QW 0 -#define _LW 1 -#define _RS 2 -#define _FN 3 - -#define _______ KC_TRNS -#define ___T___ KC_TRNS -#define XXXXXXX KC_NO - -/* - * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. - * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| - * | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| - * | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP | - * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| - * | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN | - * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| - * | LCTRL | LWIN | FN | LALT | RAISED | XXXXXX . SPACE | LOWER | RALT | HOME | END | RCTRL | LEFT | DOWN | RIGHT | - * '--------------------------------------------------------------------------------------------------------------------------------------' - */ - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QW] = { /* QWERTY */ - { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX }, - { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, - { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP }, - { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN }, - { KC_LCTL, KC_LGUI, MO(_FN), KC_LALT, MO(_RS), KC_SPC, XXXXXXX, MO(_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, - }, - [_LW] = { /* LOWERED */ - { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - }, - [_RS] = { /* RAISED */ - { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, - }, - [_FN] = { /* FUNCTION */ - { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, - { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, - { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, - { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, - }, -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // MACRODOWN only works in this function - switch(id) { - case 0: - return MACRODOWN(TYPE(KC_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/atomic/keymaps/pvc/config.h b/keyboard/atomic/keymaps/pvc/config.h new file mode 100644 index 0000000000..8449fa06de --- /dev/null +++ b/keyboard/atomic/keymaps/pvc/config.h @@ -0,0 +1,157 @@ +/* +Copyright 2012 Jun Wako <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..c2081f525e --- /dev/null +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -0,0 +1,309 @@ +#include "atomic.h" +#include "action_layer.h" + +#ifdef AUDIO_ENABLE +#include "audio.h" +#include "musical_notes.h" +#endif + + +#define _QW 0 +#define _LW 1 +#define _RS 2 +#define _AD 3 +#define _FN 4 + +#define M_QW 0 +#define M_LW 1 +#define M_RS 2 +#define M_FN 3 + + +#define _______ KC_TRNS +#define ___T___ KC_TRNS +#define XXXXXXX KC_NO + +/* + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | LCTRL | LWIN | FN | LALT | RAISED | XXXXXX . SPACE | LOWER | RALT | HOME | END | RCTRL | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QW] = { /* QWERTY */ + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX }, + { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, + { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP }, + { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN }, + { KC_LCTL, KC_LGUI, M(M_FN), KC_LALT, M(M_RS), KC_SPC, XXXXXXX, M(M_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, + }, + [_LW] = { /* LOWERED */ + { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + [_RS] = { /* RAISED */ + { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + [_FN] = { /* FUNCTION */ + { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, + { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, + { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, + }, + [_AD] = { /* ADJUST */ + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, +}; + + +#ifdef AUDIO_ENABLE + + + + +float tone_lw[][2] = { +/* +Q_NOTE(_C1 ) , +Q_NOTE(_CS1 ) , +Q_NOTE(_D1 ) , +Q_NOTE(_DS1 ) , +Q_NOTE(_E1 ) , +Q_NOTE(_F1 ) , +Q_NOTE(_FS1 ) , +Q_NOTE(_G1 ) , +Q_NOTE(_GS1 ) , +Q_NOTE(_A1 ) , +Q_NOTE(_AS1 ) , +Q_NOTE(_B1 ) , +*/ + +Q_NOTE(_C4 ) , +Q_NOTE(_CS4 ) , +Q_NOTE(_D4 ) , +Q_NOTE(_DS4 ) , +Q_NOTE(_E4 ) , +Q_NOTE(_F4 ) , +Q_NOTE(_FS4 ) , +Q_NOTE(_G4 ) , +Q_NOTE(_GS4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_AS4 ) , +Q_NOTE(_B1 ) , + + +Q_NOTE(_C2 ) , +Q_NOTE(_CS2 ) , +Q_NOTE(_D2 ) , +Q_NOTE(_DS2 ) , +Q_NOTE(_E2 ) , +Q_NOTE(_F2 ) , +Q_NOTE(_FS2 ) , +Q_NOTE(_G2 ) , +Q_NOTE(_GS2 ) , +Q_NOTE(_A2 ) , +Q_NOTE(_AS2 ) , +Q_NOTE(_B2 ) , +Q_NOTE(_C3 ) , +Q_NOTE(_CS3 ) , +Q_NOTE(_D3 ) , +Q_NOTE(_DS3 ) , +Q_NOTE(_E3 ) , +Q_NOTE(_F3 ) , +Q_NOTE(_FS3 ) , +Q_NOTE(_G3 ) , +Q_NOTE(_GS3 ) , +Q_NOTE(_A3 ) , +Q_NOTE(_AS3 ) , +Q_NOTE(_B3 ) , +Q_NOTE(_C4 ) , +Q_NOTE(_CS4 ) , +Q_NOTE(_D4 ) , +Q_NOTE(_DS4 ) , +Q_NOTE(_E4 ) , +Q_NOTE(_F4 ) , +Q_NOTE(_FS4 ) , +Q_NOTE(_G4 ) , +Q_NOTE(_GS4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_AS4 ) , +Q_NOTE(_B4 ) , +Q_NOTE(_C5 ) , +Q_NOTE(_CS5 ) , +Q_NOTE(_D5 ) , +Q_NOTE(_DS5 ) , +Q_NOTE(_E5 ) , +Q_NOTE(_F5 ) , +Q_NOTE(_FS5 ) , +Q_NOTE(_G5 ) , +Q_NOTE(_GS5 ) , +Q_NOTE(_A5 ) , +Q_NOTE(_AS5 ) , +Q_NOTE(_B5 ) , +Q_NOTE(_C6 ) , +Q_NOTE(_CS6 ) , +Q_NOTE(_D6 ) , +Q_NOTE(_DS6 ) , +Q_NOTE(_E6 ) , +Q_NOTE(_F6 ) , +Q_NOTE(_FS6 ) , +Q_NOTE(_G6 ) , +Q_NOTE(_GS6 ) , +Q_NOTE(_A6 ) , +Q_NOTE(_AS6 ) , +Q_NOTE(_B6 ) , +Q_NOTE(_C7 ) , +Q_NOTE(_CS7 ) , +Q_NOTE(_D7 ) , +Q_NOTE(_DS7 ) , +Q_NOTE(_E7 ) , +Q_NOTE(_F7 ) , +Q_NOTE(_FS7 ) , +Q_NOTE(_G7 ) , +Q_NOTE(_GS7 ) , +Q_NOTE(_A7 ) , +Q_NOTE(_AS7 ) , +Q_NOTE(_B7 ) , +Q_NOTE(_C8 ) , +Q_NOTE(_CS8 ) , +Q_NOTE(_D8 ) , +Q_NOTE(_DS8 ) , +Q_NOTE(_E8 ) , +Q_NOTE(_F8 ) , +Q_NOTE(_FS8 ) , +Q_NOTE(_G8 ) , +Q_NOTE(_GS8 ) , +Q_NOTE(_A8 ) , +Q_NOTE(_AS8 ) , +Q_NOTE(_B8 ) , + +}; + +float tone_rs[][2] = { +Q_NOTE(_A4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_A4 ) , +Q_NOTE(_AS8 ) , +Q_NOTE(_B8 ) , +}; + +#endif + +void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) +{ + if (order) + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer3); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } + else + { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) + { + layer_on(layer4); + } + else + { + layer_off(layer3); + layer_off(layer4); + } + } +} + + +const uint16_t PROGMEM fn_actions[] = { +}; + +//#define MUSIC_ARRAY_SIZE(x) (((int)(sizeof(x) / (sizeof(x[0][0])))) / 2) + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + + // MACRODOWN only works in this function + switch(id) { + case M_LW: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + println("PlayNotes LW"); + PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); + #endif + layer_on(_LW); + update_tri_layer(_LW, _RS, _FN); + } else { + layer_off(_LW); + update_tri_layer(_LW, _RS, _FN); + } + break; + case M_RS: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + println("PlayNotes RS"); + PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); + #endif + layer_on(_RS); + update_tri_layer(_LW, _RS, _FN); + } else { + layer_off(_RS); + update_tri_layer(_LW, _RS, _FN); + } + break; + default: + break; + } + return MACRO_NONE; +}; + +#ifdef AUDIO_ENABLE +float start_up[][2] = { +Q_NOTE(_E4 ) , +Q_NOTE(_E4 ) , +Q_NOTE(_F4 ) , +Q_NOTE(_G4 ) , +Q_NOTE(_G4 ) , +Q_NOTE(_F4 ) , +Q_NOTE(_E4 ) , +Q_NOTE(_D4 ) , +Q_NOTE(_C4 ) , +Q_NOTE(_C4 ) , +Q_NOTE(_D4 ) , +Q_NOTE(_E4 ) , +H_NOTE(_E4 ) , +Q_NOTE(_D4 ) , +H_NOTE(_D4 ) , +}; +#endif + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + init_notes(); + PLAY_NOTE_ARRAY(start_up, false, STACCATO); + println("Matrix Init"); + #endif +} diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk new file mode 100644 index 0000000000..d469966501 --- /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 = yes # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = yes # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +CONFIG_H = keymaps/$(KEYMAP)/config.h
\ No newline at end of file diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index 8d4e7787a6..01d9e3ce9a 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -139,10 +139,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # change to "no" to disable the options, or define them in the makefile.mk in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality @@ -183,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/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 ede08ad7f1..aecddec4a1 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -11,24 +11,27 @@ // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. -#define _QW 0 -#define _CM 1 -#define _DV 2 -#define _LW 3 -#define _RS 4 -#define _AD 5 +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 5 +#define _MUSIC 6 // Macro name shortcuts -#define QWERTY M(_QW) -#define COLEMAK M(_CM) -#define DVORAK M(_DV) -#define LOWER M(_LW) -#define RAISE M(_RS) +#define QWERTY M(_QWERTY) +#define COLEMAK M(_COLEMAK) +#define DVORAK M(_DVORAK) +#define LOWER M(_LOWER) +#define RAISE M(_RAISE) #define M_BL 5 #ifdef AUDIO_ENABLE #define AUD_OFF M(6) #define AUD_ON M(7) #endif +#define MUS_OFF M(8) +#define MUS_ON M(9) // Fillers to make layering more clear #define _______ KC_TRNS @@ -47,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_QW] = { +[_QWERTY] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, @@ -65,7 +68,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_CM] = { +[_COLEMAK] = { {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, @@ -83,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * `-----------------------------------------------------------------------------------' */ -[_DV] = { +[_DVORAK] = { {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, @@ -101,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_LW] = { +[_LOWER] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, @@ -119,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' */ -[_RS] = { +[_RAISE] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______}, @@ -130,16 +133,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | | Reset| | | | | | | | | | Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff| | |Qwerty|Colemk|Dvorak| | | + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * |------+------+------+------+------+------|------+------+------+------+------+------| * | | | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' */ -[_AD] = { +[_ADJUST] = { {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* Music (reserved for process_action_user) + * + */ +[_MUSIC] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } @@ -150,87 +163,102 @@ const uint16_t PROGMEM fn_actions[] = { }; #ifdef AUDIO_ENABLE -float start_up[][2] = { - {440.0*pow(2.0,(67)/12.0), 12}, - {440.0*pow(2.0,(64)/12.0), 8}, - {440.0*pow(2.0,(55)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, - {440.0*pow(2.0,(64)/12.0), 20} +float tone_startup[][2] = { + {440.0*pow(2.0,(31)/12.0), 12}, + {440.0*pow(2.0,(28)/12.0), 8}, + {440.0*pow(2.0,(19)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, + {440.0*pow(2.0,(28)/12.0), 20} }; -float tone_qw[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, +float tone_qwerty[][2] = { + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} + {440.0*pow(2.0,(31)/12.0), 16} }; -float tone_cm[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, +float tone_colemak[][2] = { + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 12}, + {440.0*pow(2.0,(31)/12.0), 12}, {0, 4}, - {440.0*pow(2.0,(71)/12.0), 12} + {440.0*pow(2.0,(35)/12.0), 12} }; -float tone_dv[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, +float tone_dvorak[][2] = { + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8}, + {440.0*pow(2.0,(31)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(69)/12.0), 8}, + {440.0*pow(2.0,(33)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8} + {440.0*pow(2.0,(31)/12.0), 8} +}; + +float tone_music[][2] = { + {440.0*pow(2.0,(12)/12.0), 8}, + {440.0*pow(2.0,(14)/12.0), 8}, + {440.0*pow(2.0,(16)/12.0), 8}, + {440.0*pow(2.0,(17)/12.0), 8}, + {440.0*pow(2.0,(19)/12.0), 8}, + {440.0*pow(2.0,(21)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8} }; #endif +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_write_default_layer(default_layer); + default_layer_set(default_layer); +} + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - // MACRODOWN only works in this function switch(id) { - case _QW: + case _QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qw, 4, false); + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); #endif - default_layer_set(1UL<<_QW); + persistant_default_layer_set(1UL<<_QWERTY); } break; - case _CM: + case _COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_cm, 6, false); + PLAY_NOTE_ARRAY(tone_colemak, false, 0); #endif - default_layer_set(1UL<<_CM); + persistant_default_layer_set(1UL<<_COLEMAK); } break; - case _DV: + case _DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dv, 8, false); + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); #endif - default_layer_set(1UL<<_DV); + persistant_default_layer_set(1UL<<_DVORAK); } break; - case _LW: + case _LOWER: if (record->event.pressed) { - layer_on(_LW); - update_tri_layer(_LW, _RS, _AD); + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { - layer_off(_LW); - update_tri_layer(_LW, _RS, _AD); + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; - case _RS: + case _RAISE: if (record->event.pressed) { - layer_on(_RS); - update_tri_layer(_LW, _RS, _AD); + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } else { - layer_off(_RS); - update_tri_layer(_LW, _RS, _AD); + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; case M_BL: @@ -254,7 +282,23 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 5, false); + PLAY_NOTE_ARRAY(tone_startup, false, 0); + #endif + } + break; + case 8: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + layer_off(_MUSIC); + stop_all_notes(); + #endif + } + break; + case 9: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_music, false, 0); + layer_on(_MUSIC); #endif } break; @@ -262,9 +306,24 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; }; +uint8_t starting_note = 0x0C; +int offset = 7; + +void process_action_user(keyrecord_t *record) { + + if (IS_LAYER_ON(_MUSIC)) { + if (record->event.pressed) { + play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); + } else { + stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); + } + } + +} + void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 5, false); + PLAY_NOTE_ARRAY(tone_startup, false, 0); #endif } diff --git a/keyboard/planck/keymaps/pc.c b/keyboard/planck/keymaps/pvc_planck.c index ed062609f4..20bb5d86d7 100644 --- a/keyboard/planck/keymaps/pc.c +++ b/keyboard/planck/keymaps/pvc_planck.c @@ -2,6 +2,8 @@ // this is the style you want to emulate. #include "planck.h" +#include "print.h" +#include "action_layer.h" #ifdef BACKLIGHT_ENABLE #include "backlight.h" #endif @@ -38,10 +40,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_QW] = { - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {RESET, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} + {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, M(_LW), KC_SPC, KC_SPC, M(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} }, /* Colemak @@ -95,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______}, - {_______, _______, _______, _______, MO(_FN), _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, /* Lower @@ -113,7 +115,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______}, - {_______, _______, _______, _______, _______, _______, _______, MO(_FN), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, /* Function @@ -139,20 +141,53 @@ 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 - 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; + // MACRODOWN only works in this function + switch(id) + { + case _RS: + if (record->event.pressed) { + print("RS_DN"); + layer_on(_RS); + tri_layer++; + update_tri_layer(_FN); + } else { + print("RS_UP"); + layer_off(_RS); + tri_layer--; + update_tri_layer(_FN); + phex(layer_state); + } + break; + + case _LW: + if (record->event.pressed) { + print("LW_DN"); + layer_on(_LW); + tri_layer++; + update_tri_layer(_FN); + } else { + print("LW_UP"); + layer_off(_LW); + tri_layer--; + update_tri_layer(_FN); + } + break; + + default: + break; + } + return MACRO_NONE; }; diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile index eaf9ef927c..3504e27201 100644 --- a/keyboard/preonic/Makefile +++ b/keyboard/preonic/Makefile @@ -130,10 +130,10 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # change to "no" to disable the options, or define them in the makefile.mk in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality diff --git a/keyboard/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/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 6824f68b60..48bc72dab7 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -3,11 +3,6 @@ #include "eeconfig.h" #ifdef AUDIO_ENABLE #include "audio.h" - #define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ - 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ - 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \ - 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \ - 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } #endif // Each layer gets a name for readability, which is then used in the keymap matrix below. @@ -153,9 +148,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | | Reset| | | | | | | | | | Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Audoff|Aud on| | |Qwerty|Colemk|Dvorak| | | + * | | | |Audoff|Aud on|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | + * | | | |Musoff|Mus on| | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | | | | | * `-----------------------------------------------------------------------------------' @@ -163,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = { {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, AUD_ON, AUD_OFF, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} }, @@ -186,51 +181,55 @@ const uint16_t PROGMEM fn_actions[] = { #ifdef AUDIO_ENABLE float start_up[][2] = { - {440.0*pow(2.0,(50)/12.0), 20}, - {440.0*pow(2.0,(62)/12.0), 8}, - {440.0*pow(2.0,(54)/12.0), 20}, - {440.0*pow(2.0,(62)/12.0), 8} + {440.0*pow(2.0,(14)/12.0), 20}, + {440.0*pow(2.0,(26)/12.0), 8}, + {440.0*pow(2.0,(18)/12.0), 20}, + {440.0*pow(2.0,(26)/12.0), 8} }; float tone_qwerty[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 16} + {440.0*pow(2.0,(31)/12.0), 16} }; float tone_colemak[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 12}, + {440.0*pow(2.0,(31)/12.0), 12}, {0, 4}, - {440.0*pow(2.0,(71)/12.0), 12} + {440.0*pow(2.0,(35)/12.0), 12} }; float tone_dvorak[][2] = { - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8}, + {440.0*pow(2.0,(31)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(69)/12.0), 8}, + {440.0*pow(2.0,(33)/12.0), 8}, {0, 4}, - {440.0*pow(2.0,(67)/12.0), 8} + {440.0*pow(2.0,(31)/12.0), 8} }; float tone_music[][2] = { - {440.0*pow(2.0,(48)/12.0), 8}, - {440.0*pow(2.0,(50)/12.0), 8}, - {440.0*pow(2.0,(52)/12.0), 8}, - {440.0*pow(2.0,(53)/12.0), 8}, - {440.0*pow(2.0,(55)/12.0), 8}, - {440.0*pow(2.0,(57)/12.0), 8}, - {440.0*pow(2.0,(59)/12.0), 8}, - {440.0*pow(2.0,(60)/12.0), 8} + {440.0*pow(2.0,(12)/12.0), 8}, + {440.0*pow(2.0,(14)/12.0), 8}, + {440.0*pow(2.0,(16)/12.0), 8}, + {440.0*pow(2.0,(17)/12.0), 8}, + {440.0*pow(2.0,(19)/12.0), 8}, + {440.0*pow(2.0,(21)/12.0), 8}, + {440.0*pow(2.0,(23)/12.0), 8}, + {440.0*pow(2.0,(24)/12.0), 8} }; #endif +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) { @@ -238,28 +237,25 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case _QWERTY: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_qwerty, 4, false); + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); #endif - eeconfig_write_default_layer(1UL<<_QWERTY); - default_layer_set(1UL<<_QWERTY); + persistant_default_layer_set(1UL<<_QWERTY); } break; case _COLEMAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_colemak, 6, false); + PLAY_NOTE_ARRAY(tone_colemak, false, 0); #endif - eeconfig_write_default_layer(1UL<<_COLEMAK); - default_layer_set(1UL<<_COLEMAK); + persistant_default_layer_set(1UL<<_COLEMAK); } break; case _DVORAK: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_dvorak, 8, false); + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); #endif - eeconfig_write_default_layer(1UL<<_DVORAK); - default_layer_set(1UL<<_DVORAK); + persistant_default_layer_set(1UL<<_DVORAK); } break; case _LOWER: @@ -301,7 +297,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { #ifdef AUDIO_ENABLE audio_on(); - play_notes(&start_up, 4, false); + PLAY_NOTE_ARRAY(start_up, false, 0); #endif } break; @@ -316,7 +312,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 9: if (record->event.pressed) { #ifdef AUDIO_ENABLE - play_notes(&tone_music, 8, false); + PLAY_NOTE_ARRAY(tone_music, false, 0); layer_on(_MUSIC); #endif } @@ -332,9 +328,9 @@ void process_action_user(keyrecord_t *record) { if (IS_LAYER_ON(_MUSIC)) { if (record->event.pressed) { - play_note(((double)261.626)*pow(2.0, -2.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); + play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF); } else { - stop_note(((double)261.626)*pow(2.0, -2.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); + stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row))); } } @@ -343,6 +339,6 @@ void process_action_user(keyrecord_t *record) { void matrix_init_user(void) { #ifdef AUDIO_ENABLE init_notes(); - play_notes(&start_up, 4, false); + play_notes(&start_up, false, 0); #endif } |