diff options
| -rw-r--r-- | keyboard/atomic/Makefile | 91 | ||||
| -rw-r--r-- | keyboard/atomic/config.h | 2 | ||||
| -rw-r--r-- | keyboard/atomic/keymaps/pvc/config.h | 157 | ||||
| -rw-r--r-- | keyboard/atomic/keymaps/pvc/keymap.c (renamed from keyboard/atomic/keymaps/pc_atomic.c) | 177 | ||||
| -rw-r--r-- | keyboard/atomic/keymaps/pvc/makefile.mk | 17 | ||||
| -rw-r--r-- | keyboard/planck/Makefile | 2 | ||||
| -rw-r--r-- | keyboard/planck/keymaps/pvc_planck.c (renamed from keyboard/planck/keymaps/pc.c) | 71 | ||||
| -rw-r--r-- | quantum/musical_notes.h | 182 | ||||
| -rw-r--r-- | tmk_core/common/action_layer.h | 1 | 
9 files changed, 645 insertions, 55 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/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 <[email protected]> + +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/pc_atomic.c b/keyboard/atomic/keymaps/pvc/keymap.c index bdf575046b..189da16c47 100644 --- a/keyboard/atomic/keymaps/pc_atomic.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -1,9 +1,23 @@  #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 _FN 3 +#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 @@ -29,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {    { KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_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  }, +  { 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___  }, @@ -52,24 +66,161 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {    { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___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___, _______, _______  }, +  { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______  }, + },  }; -const uint16_t PROGMEM fn_actions[] = { -    [1] = ACTION_LAYER_MOMENTARY(2),  // to RAISE -    [2] = ACTION_LAYER_MOMENTARY(3),  // to LOWER +#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer))) +#define IS_LAYER_OFF(layer) (!IS_LAYER_ON(layer)) + +#ifdef AUDIO_ENABLE + + + + +float tone_lw[][2] = { +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   ) , +}; -    [3] = ACTION_DEFAULT_LAYER_SET(0), -    [4] = ACTION_DEFAULT_LAYER_SET(1), +float tone_rs[][2] = { +  {440.0*pow(2.0,(59)/12.0), 8}, +  {440.0*pow(2.0,(60)/12.0), 8}, +  {0, 4}, +  {440.0*pow(2.0,(67)/12.0), 16}, +  {0, 4}, +  {440.0*pow(2.0,(71)/12.0), 16} +}; +float tone_fn[][2] = { +  {440.0*pow(2.0,(59)/12.0), 8}, +  {440.0*pow(2.0,(60)/12.0), 8}, +  {0, 4}, +  {440.0*pow(2.0,(67)/12.0), 16}, +  {0, 4}, +  {440.0*pow(2.0,(69)/12.0), 16}, +  {0, 4}, +  {440.0*pow(2.0,(67)/12.0), 16}  }; +#endif + + +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) +{ +	if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) +	{ +            #ifdef AUDIO_ENABLE +              println("PlayNotes FN"); +              play_notes(&tone_fn, 8, false); +            #endif +		layer_on(layer3); +	} +	else +	{ +	    layer_off(layer3); +	} +} -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)  +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 ARRAY_SIZE(x) ((sizeof x) / (sizeof *x)) + +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; -    }  +      switch(id) { +        case M_LW: +          if (record->event.pressed) { +            #ifdef AUDIO_ENABLE +              println("PlayNotes LW"); +              print_val_hex32(ARRAY_SIZE(tone_lw)); +              play_notes(&tone_lw, 12, false); +            #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_notes(&tone_rs, 6, false); +            #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] = { +  {440.0*pow(2.0,(67)/12.0), 12}, +  {440.0*pow(2.0,(64)/12.0), 8}, +  {440.0*pow(2.0,(55)/12.0), 8}, +  {440.0*pow(2.0,(60)/12.0), 8}, +  {440.0*pow(2.0,(64)/12.0), 20} +}; +#endif + +void matrix_init_user(void) { +  #ifdef AUDIO_ENABLE +    init_notes(); +    play_notes(&start_up, 5, false); +    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..83b8303b02 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -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/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/quantum/musical_notes.h b/quantum/musical_notes.h new file mode 100644 index 0000000000..79f04fd988 --- /dev/null +++ b/quantum/musical_notes.h @@ -0,0 +1,182 @@ +#ifndef MUSICAL_NOTES_H +#define MUSICAL_NOTES_H + +// Tempo Placeholder +#define TEMPO 120 + + +// Note Types +#define WHOLE_NOTE(note)     {(NOTE##note), 64} +#define HALF_NOTE(note)      {(NOTE##note), 32} +#define QUARTER_NOTE(note)   {(NOTE##note), 16} +#define EIGTH_NOTE(note)     {(NOTE##note), 8} +#define SIXTEENTH_NOTE(note) {(NOTE##note), 4} + +// Note Types Short +#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) EIGTH_NOTE(n) +#define S_NOTE(n) SIXTEENTH_NOTE(n) + + +// Notes - # = Octave +#define NOTE_REST         0.00 +#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/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 */ | 
