]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Merge pull request #724 from sgoodwin/master
authorJack Humbert <jack.humb@gmail.com>
Mon, 5 Sep 2016 17:21:24 +0000 (13:21 -0400)
committerGitHub <noreply@github.com>
Mon, 5 Sep 2016 17:21:24 +0000 (13:21 -0400)
Add my keymap.

14 files changed:
keyboards/jd40/Makefile [new file with mode: 0644]
keyboards/jd40/config.h [new file with mode: 0644]
keyboards/jd40/jd40.c [new file with mode: 0644]
keyboards/jd40/jd40.h [new file with mode: 0644]
keyboards/jd40/keymaps/default/keymap.c [new file with mode: 0644]
keyboards/jd40/readme.md [new file with mode: 0644]
keyboards/jd40/rules.mk [new file with mode: 0644]
keyboards/planck/keymaps/callum/keymap.c
keyboards/planck/keymaps/callum/readme.md
keyboards/planck/keymaps/pvc/config.h
keyboards/planck/keymaps/pvc/keymap.c
quantum/process_keycode/process_tap_dance.c
readme.md
tmk_core/rules.mk

diff --git a/keyboards/jd40/Makefile b/keyboards/jd40/Makefile
new file mode 100644 (file)
index 0000000..2427481
--- /dev/null
@@ -0,0 +1,74 @@
+
+
+# MCU name
+#MCU = at90usb1287
+MCU = atmega32u4
+
+# Processor frequency.
+#     This will define a symbol, F_CPU, in all source code files equal to the
+#     processor frequency in Hz. You can then use this symbol in your source code to
+#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+#     automatically to create a 32-bit value in your source code.
+#
+#     This will be an integer division of F_USB below, as it is sourced by
+#     F_USB after it has run through any CPU prescalers. Note that this value
+#     does not *change* the processor frequency - it should merely be updated to
+#     reflect the processor speed set externally so that the code can use accurate
+#     software delays.
+F_CPU = 16000000
+
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+#     This will define a symbol, F_USB, in all source code files equal to the
+#     input clock frequency (before any prescaling is performed) in Hz. This value may
+#     differ from F_CPU if prescaling is used on the latter, and is required as the
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+#     at the end, this will be done automatically to create a 32-bit value in your
+#     source code.
+#
+#     If no clock division is performed on the input clock inside the AVR (via the
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+#   Teensy halfKay   512
+#   Teensy++ halfKay 1024
+#   Atmel DFU loader 4096
+#   LUFA bootloader  4096
+#   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
+KEYBOARD_LOCK_ENABLE ?= yes    # Allow locking of keyboard via magic key
+# 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
+# UNICODE_ENABLE ?= YES                # Unicode
+# BLUETOOTH_ENABLE ?= yes      # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE ?= yes          # Enable RGB Underglow
+
+ifndef QUANTUM_DIR
+       include ../../Makefile
+endif
+
diff --git a/keyboards/jd40/config.h b/keyboards/jd40/config.h
new file mode 100644 (file)
index 0000000..e2594f4
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+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    geekhack
+#define PRODUCT         jd40v2
+#define DESCRIPTION     t.m.k. keyboard firmware for JD40 MKII
+
+/* key matrix size */
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 12
+
+/*
+ * 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 MATRIX_ROW_PINS { F0, F1, F5, B4 }
+#define MATRIX_COL_PINS { F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2 }
+#define UNUSED_PINS
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCING_DELAY 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
+
+
+/* key combination for magic key command */
+#define IS_COMMAND() ( \
+  keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#define RGB_DI_PIN D3
+#define RGBLIGHT_TIMER
+#define RGBLED_NUM 12         // Number of LEDs
+#define RGBLIGHT_HUE_STEP 8
+#define RGBLIGHT_SAT_STEP 8
+#define RGBLIGHT_VAL_STEP 8
+
+#endif
diff --git a/keyboards/jd40/jd40.c b/keyboards/jd40/jd40.c
new file mode 100644 (file)
index 0000000..fa06356
--- /dev/null
@@ -0,0 +1,26 @@
+#include "jd40.h"
+
+void led_set_kb(uint8_t usb_led) {
+       // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+       
+
+  //  if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+       //      gh60_caps_led_on();
+       //      } else {
+       //      gh60_caps_led_off(); 
+  //  }
+       
+    // if (usb_led & (1<<USB_LED_NUM_LOCK)) {
+               // gh60_esc_led_on();
+               // } else {
+               // gh60_esc_led_off(); 
+    // }
+       
+    // if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
+               // gh60_fn_led_on();
+               // } else {
+               // gh60_fn_led_off();   
+    // }
+
+       led_set_user(usb_led);  
+}
diff --git a/keyboards/jd40/jd40.h b/keyboards/jd40/jd40.h
new file mode 100644 (file)
index 0000000..77a1222
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef JD40_H
+#define JD40_H
+
+#include "quantum.h"
+#include "led.h"
+
+/* GH60 LEDs 
+ *   GPIO pads
+ *   0 F7 WASD LEDs
+ *   1 F6 ESC LED
+ *   2 F5 FN LED
+ *   3 F4 POKER Arrow LEDs
+ *   B2 Capslock LED
+ *   B0 not connected
+ */
+ /*
+inline void gh60_caps_led_on(void)      { DDRB |=  (1<<2); PORTB &= ~(1<<2); }
+inline void gh60_poker_leds_on(void)    { DDRF |=  (1<<4); PORTF &= ~(1<<4); }
+inline void gh60_fn_led_on(void)       { DDRF |=  (1<<5); PORTF &= ~(1<<5); }
+inline void gh60_esc_led_on(void)      { DDRF |=  (1<<6); PORTF &= ~(1<<6); }
+inline void gh60_wasd_leds_on(void)            { DDRF |=  (1<<7); PORTF &= ~(1<<7); }
+
+inline void gh60_caps_led_off(void)     { DDRB &= ~(1<<2); PORTB &= ~(1<<2); }
+inline void gh60_poker_leds_off(void)   { DDRF &= ~(1<<4); PORTF &= ~(1<<4); }
+inline void gh60_fn_led_off(void)      { DDRF &= ~(1<<5); PORTF &= ~(1<<5); }
+inline void gh60_esc_led_off(void)     { DDRF &= ~(1<<6); PORTF &= ~(1<<6); }
+inline void gh60_wasd_leds_off(void)           { DDRF &= ~(1<<7); PORTF &= ~(1<<7); }
+*/
+
+/* JD40 MKII keymap definition macro
+ */
+#define KEYMAP( \
+    K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, \
+       K13, K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, \
+       K24, K25, K26, K27, K28, K29, K30, K31, K32, K33, K34, \
+       K35, K36, K37, K38, K39, K40, K41, K42, K43, K44 \
+) { \
+    { KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K10, KC_##K11, KC_##K12 }, \
+    { KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_NO    }, \
+    { KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO    }, \
+    { KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_NO,    KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_NO    }  \
+}
+
+#endif
diff --git a/keyboards/jd40/keymaps/default/keymap.c b/keyboards/jd40/keymaps/default/keymap.c
new file mode 100644 (file)
index 0000000..79ac146
--- /dev/null
@@ -0,0 +1,164 @@
+#include "jd40.h"
+#include "action_layer.h"
+
+#define _BL 0
+#define _AL 1
+#define _FL 2
+#define _UL 3
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+       [_BL] = KEYMAP(
+  F12,  Q,    W,    E,    R,    T,    Y,    U,    I,    O,    P,   BSPC,
+  TAB,  A,    S,    D,    F,    G,    H,    J,    K,    L,    ENT,
+  LSFT, Z,    X,    C,    V,    B,    N,    M,    COMM, UP, DOT,
+  LCTL, LGUI, LALT, FN0,  SPC,  SPC,  FN0,  LEFT,  DOWN, RIGHT ),
+  
+       [_AL] = KEYMAP(
+  GRV,   F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,  F10,  DEL,
+  CAPS, 1,    2,    3,    4,    5,    6,    7,    8,    9,    0,
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, SCLN, PGUP, QUOT,
+  TRNS, TRNS, TRNS, TRNS, FN3,  FN3,  TRNS, HOME, PGDN, END ),
+
+       [_FL] = KEYMAP(
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
+   
+       [_UL] = KEYMAP(
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
+  TRNS, FN4,  FN5,  FN11, FN10, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
+  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
+};
+
+enum function_id {
+    RGBLED_TOGGLE,
+    RGBLED_STEP_MODE,
+    RGBLED_INCREASE_HUE,
+    RGBLED_DECREASE_HUE,
+    RGBLED_INCREASE_SAT,
+    RGBLED_DECREASE_SAT,
+    RGBLED_INCREASE_VAL,
+    RGBLED_DECREASE_VAL,
+    SHIFT_ESC, 
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+    [0]  = ACTION_LAYER_MOMENTARY(1),  // Momentary Fn overlay
+    [1]  = ACTION_LAYER_TOGGLE(2),     // Toggle Arrow Layer overlay
+    [2]  = ACTION_LAYER_TAP_KEY(2, KC_CAPS), // Tap to toggle caps lock and hold to activate function layer
+    [3]  = ACTION_LAYER_TOGGLE(3),     // Toggle Underglow Layer overlay
+    [4]  = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow
+    [5]  = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode
+    [6]  = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
+    [7]  = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
+    [8]  = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
+    [9]  = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
+    [10] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
+    [11] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
+    [12] = ACTION_FUNCTION(SHIFT_ESC),
+};
+
+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);
+          } else {
+            unregister_code(KC_RSFT);
+          }
+        break;
+      }
+    return MACRO_NONE;
+};
+
+void matrix_scan_user(void) {
+
+// Layer LED indicators
+// ESC led on when in function layer, WASD cluster leds enabled when on arrow cluster
+    uint32_t layer = layer_state;
+    if (layer & (1<<1)) {
+        //gh60_wasd_leds_on();
+    } else {
+        //gh60_wasd_leds_off();
+    }
+
+    if (layer & (1<<2)) {
+        //gh60_esc_led_on();
+    } else {
+        //gh60_esc_led_off();
+    }
+};
+
+#define MODS_CTRL_MASK  (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+
+void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
+  switch (id) {
+    case RGBLED_TOGGLE:
+      //led operations
+      if (record->event.pressed) {
+        rgblight_toggle();
+        }
+        break;
+    case RGBLED_INCREASE_HUE:
+      if (record->event.pressed) {
+        rgblight_increase_hue();
+        }
+        break;
+    case RGBLED_DECREASE_HUE:
+      if (record->event.pressed) {
+        rgblight_decrease_hue();
+        }
+        break;
+    case RGBLED_INCREASE_SAT:
+      if (record->event.pressed) {
+        rgblight_increase_sat();
+        }
+        break;
+    case RGBLED_DECREASE_SAT:
+      if (record->event.pressed) {
+        rgblight_decrease_sat();
+        }
+        break;
+    case RGBLED_INCREASE_VAL:
+        if (record->event.pressed) {
+          rgblight_increase_val();
+        }
+        break;
+    case RGBLED_DECREASE_VAL:
+        if (record->event.pressed) {
+          rgblight_decrease_val();
+        }
+        break;
+    case RGBLED_STEP_MODE:
+        if (record->event.pressed) {
+          rgblight_step();
+        }
+        break;
+    static uint8_t shift_esc_shift_mask;
+    // Shift + ESC = ~
+    case SHIFT_ESC:
+      shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
+      if (record->event.pressed) {
+        if (shift_esc_shift_mask) {
+          add_key(KC_GRV);
+          send_keyboard_report();
+        } else {
+          add_key(KC_ESC);
+          send_keyboard_report();
+        }
+      } else {
+        if (shift_esc_shift_mask) {
+          del_key(KC_GRV);
+          send_keyboard_report();
+        } else {
+          del_key(KC_ESC);
+          send_keyboard_report();
+        }
+      }
+      break;
+    }
+};
diff --git a/keyboards/jd40/readme.md b/keyboards/jd40/readme.md
new file mode 100644 (file)
index 0000000..7daa098
--- /dev/null
@@ -0,0 +1,17 @@
+## jd40 mkii keyboard firmware
+
+    Pins:
+    MATRIX_ROW_PINS { F0, F1, F5, B4 }
+    MATRIX_COL_PINS { F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2 }
+    RGB_DI_PIN D3      
+       
+======================
+
+## Quantum MK Firmware
+
+For the full Quantum feature list, see [the parent readme.md](/readme.md).
+
+## Building
+
+Download or clone the whole firmware and navigate to the keyboards/jd40 folder. 
+Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Amtel Flip to program your .hex file. 
diff --git a/keyboards/jd40/rules.mk b/keyboards/jd40/rules.mk
new file mode 100644 (file)
index 0000000..2f18fdf
--- /dev/null
@@ -0,0 +1,69 @@
+
+
+# MCU name
+#MCU = at90usb1287
+MCU = atmega32u4
+
+# Processor frequency.
+#     This will define a symbol, F_CPU, in all source code files equal to the
+#     processor frequency in Hz. You can then use this symbol in your source code to
+#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+#     automatically to create a 32-bit value in your source code.
+#
+#     This will be an integer division of F_USB below, as it is sourced by
+#     F_USB after it has run through any CPU prescalers. Note that this value
+#     does not *change* the processor frequency - it should merely be updated to
+#     reflect the processor speed set externally so that the code can use accurate
+#     software delays.
+F_CPU = 16000000
+
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+#     This will define a symbol, F_USB, in all source code files equal to the
+#     input clock frequency (before any prescaling is performed) in Hz. This value may
+#     differ from F_CPU if prescaling is used on the latter, and is required as the
+#     raw input clock is fed directly to the PLL sections of the AVR for high speed
+#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+#     at the end, this will be done automatically to create a 32-bit value in your
+#     source code.
+#
+#     If no clock division is performed on the input clock inside the AVR (via the
+#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+#   Teensy halfKay   512
+#   Teensy++ halfKay 1024
+#   Atmel DFU loader 4096
+#   LUFA bootloader  4096
+#   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
+KEYBOARD_LOCK_ENABLE ?= yes    # Allow locking of keyboard via magic key
+# 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
+# UNICODE_ENABLE ?= YES                # Unicode
+# BLUETOOTH_ENABLE ?= yes      # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE ?= yes          # Enable RGB Underglow
\ No newline at end of file
index ed187df1da3a140464a9ab3ca479f0a348764e91..6c34311339695f52e4dd83fa6807069d422f5bf4 100644 (file)
@@ -20,7 +20,8 @@ enum planck_keycodes {
   BASE = SAFE_RANGE,
   MOVE,
   SYMB,
-  FUNC
+  FUNC,
+  LOCK
 };
 
 // Fillers to make layering more clear
@@ -37,14 +38,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  * |------+------+------+------+------+------|------+------+------+------+------+------|
  * | Shift|   Z  |   X  |   C  |   V  |   B  |   K  |   M  |   ,  |   .  |   /  |Shift |
  * |------+------+------+------+------+------+------+------+------+------+------+------|
- * | Func | GUI  | Alt  | Ctrl | Symb |Enter |Space | Move | GUI  | Alt  | Ctrl |Caps  |
+ * | Func | Ctrl | Alt  | GUI  | Symb |Enter |Space | Move | GUI  | Alt  | Ctrl |Caps  |
  * `-----------------------------------------------------------------------------------'
  */
 [_BASE] = {
   {KC_TAB,  KC_Q,    KC_W,    KC_F,    KC_P,    KC_G,    KC_J,    KC_L,    KC_U,    KC_Y,    KC_SCLN, KC_MINS},
   {KC_BSPC, 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_RSFT},
-  {FUNC,    KC_LGUI, KC_LALT, KC_LCTL, SYMB,    KC_ENT,  KC_SPC,  MOVE,    KC_RGUI, KC_RALT, KC_RCTL, KC_CAPS}
+  {FUNC,    KC_LCTL, KC_LALT, KC_LGUI, SYMB,    KC_ENT,  KC_SPC,  MOVE,    KC_RGUI, KC_RALT, KC_RCTL, KC_CAPS}
 },
 
 /* MOVE
@@ -87,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  * ,-----------------------------------------------------------------------------------.
  * | F12  |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |  F7  |  F8  |  F9  | F10  | F11  |
  * |-----------------------------------------------------------------------------------.
- * |      | Play | Prev | Next | BL+  |      |      |      |      |      |      |      |
+ * |      | Play | Prev | Next | BL+  |      |      | Lock |      |      |      |      |
  * |------+------+------+------+------+------|------+------+------+------+------+------|
  * |      | Mute | Vol- | Vol+ | BL-  |      |      |      |      |      |      |      |
  * |------+------+------+------+------+------+------+------+------+------+------+------|
@@ -96,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  */
 [_FUNC] = {
   {KC_F12,  KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11 },
-  {_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, _______, _______, _______, _______, _______},
+  {_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, LOCK,    _______, _______, _______, _______},
   {_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_SLCK, _______, _______, _______, _______, _______, _______, _______},
   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET  }
 }
@@ -133,6 +134,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
       }
       return false;
       break;
+    case LOCK:
+      if (record->event.pressed) {
+        register_code(KC_RSFT);
+        register_code(KC_RCTL);
+        register_code(KC_POWER);
+      } else {
+        unregister_code(KC_POWER);
+        unregister_code(KC_RCTL);
+        unregister_code(KC_RSFT);
+      }
+      return false;
+      break;
   }
   return true;
 }
index 030def7f7738381ee616d957389ca796d41e84b1..b70de3f1e20fe14ecf45cd2e285229d827b56941 100644 (file)
@@ -1,25 +1,20 @@
 # callum’s planck layout
 
-This is a layout for the grid planck, built with a few ideals in mind. These ideals are just my opinion mind! The great thing about *qmk* is that we can all afford to have different opinions about what makes a good layout:
+This is a layout for the grid planck, built with a few ideals in mind:
 
-- Minimal response times should be maintained. i.e. keys that react differently depending on whether they are tapped or held, keys that react differently if they are double tapped, etc. should be avoided --- since they inevitably send their keycode later than a normal key, interrupting the immediate feedback from the screen. Therefore we restrict ourselves to chording.
+- Minimal response times should be maintained. i.e. keys that react differently depending on whether they are tapped or held, keys that react differently if they are double tapped, etc. should be avoided  they inevitably send their keycode later than a normal key, interrupting the immediate feedback from the screen. Therefore we restrict ourselves to chording.
 - The hands should never need to leave the home position. The usual culprit for this is the arrow cluster, so the arrow cluster should be as close to home as possible.
-- There should be two of every modifier (one on each side), since otherwise certain long key combinations become hard to make.
-- Backspace should be in the “capslock position” as God intended.
-- The keyboard should be usable without any firmware changes on any operating system. In my case that means it should work on *Windows* and *Linux* without any software modifications, while I can change the behaviour slightly on *macOS* in software since that’s my home OS. The images reflect the intended use on *macOS* **after** minor software tweaks; which will be noted.
+- There should be two of every modifier (one on each side), otherwise certain long key combinations become hard to make.
+- Backspace should be in the “capslock position” in the colemak tradition.
 
 We have four layers. A `BASE` layer, in colemak; a `MOVE` layer, with an arrow cluster etc, a `SYMB` layer, with numbers and symbols; and a `FUNC` layer, with function keys and media keys.
 
 ## The `BASE` layer
-![](http://i.imgur.com/aEXOlWl.png)
+![](http://i.imgur.com/tVNI3SE.png)
 
 This is the default layer; in [colemak](https://colemak.com). `esc` and `del` are conspicuously absent but are especially easy to reach from either of the other main layers (see below). The `backspace` location is standard colemak. The `caps` key is still on the `BASE` layer but only because I  don’t really use the bottom corners so there’s nothing else I would rather put there. Having `enter` on a thumb means I can still have `quote` immediately to the right of `O`, something that would have annoyed me endlessly otherwise. `minus` is in the upper right because I had an extra space and it’s probably my next most used key that didn’t yet have a home.
 
-The `MOVE` and `SYMB` layers are reached by holding down the `move` and `symb` keys respectively. The `FUNC` layer is reached by holding down both the `move` and `symb` keys simultaneosly, *or* by holding down the `fn` key. The intended use is that whenever both hands are on the keyboard, the former method is used, and the latter is only used when, for example, reaching over to the keyboard with one hand to access the media controls. 
-
-The `ctrl`, `alt`, `cmd` cluster is asymmetric around the centre so that at least one of each of the modifiers can be reached with the thumbs. The intended use is to always hit the left `cmd` and the right `ctrl`, unless an awkward key combination dictates otherwise.
-
-In firmware `ctrl` and `cmd`/`GUI` are swapped with respect to the image above --- I swap them to the illustrated location when using *macOS* and leave them be for *Windows* and *Linux*. (so that `cmd-z,x,c,v,...` becomes `ctrl-z,x,c,v,...` saving me some confusion)
+The `MOVE` and `SYMB` layers are reached by holding down the `move` and `symb` keys respectively. The `FUNC` layer is reached by holding down both the `move` and `symb` keys simultaneously, *or* by holding down the `fn` key. The intended use is that whenever both hands are on the keyboard, the former method is used, and the latter is only used when, for example, reaching over to the keyboard with one hand to access the media controls.
 
 ## The `MOVE` layer
 ![](http://i.imgur.com/KXRSuHT.png)
@@ -40,9 +35,9 @@ The symbol layer has all the numbers and their usual corresponding symbols in th
 Again none of the modifiers are overwritten so that shortcuts involving numbers or symbols work as expected.
 
 ## The `FUNC` layer
-![](http://i.imgur.com/skxRZiH.png)
+![](http://i.imgur.com/1VKFBBU.png)
 
-The only thing of note here is that `bl+` and `bl-` are short for *backlight up* and *backlight down* respectively, and in firmware are actually `KC_PAUS` and `KC_SLCK` respectively, since *macOS* interprets these as the backlight keys.
+The only things of note here are that `bl+` and `bl-` are short for *backlight up* and *backlight down*, and in firmware are actually `KC_PAUS` and `KC_SLCK` respectively, since *macOS* interprets these as the backlight keys. And that `lock` is currently a macro hard coded to turn off the screen on *macOS*. (By activating the shortcut `shift-ctrl-power`.)
 
 ## Other changes from the default
-I have LEDs and sound disabled, simply because I have no need of them.
\ No newline at end of file
+I have LEDs and sound disabled, simply because I have no need of them.
index c857a3e89dbea44c7b4ed80fd26becd75da09ac6..1113372b0aee5f3a29f67605c02fb80a12b56ba1 100644 (file)
@@ -59,13 +59,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
     keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
 )
 
-/* ws2812 RGB LED */
-#define RGB_DI_PIN D1
-#define RGBLIGHT_TIMER
-#define RGBLED_NUM 28     // Number of LEDs
-#define RGBLIGHT_HUE_STEP 10
-#define RGBLIGHT_SAT_STEP 17
-#define RGBLIGHT_VAL_STEP 17
+#define BACKLIGHT_PIN B7
+#define BACKLIGHT_BREATHING
 
 /*
  * Feature disable options
index 0bb7f0def2386044acf32f60cf2a041d13fe66ce..8ff40f377cbb2a93022cbd10f1c98dfe05ae17bb 100644 (file)
@@ -2,48 +2,50 @@
 #include "action_layer.h"
 #include "eeconfig.h"
 #include "led.h"
+#include "mousekey.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_UPPER                      3
-#define LAYER_LOWER                      4
-#define LAYER_FUNCTION                   5
-#define LAYER_MOUSE                      6
-#define LAYER_ADJUST                     7
-
-#define MACRO_QWERTY                     0
-#define MACRO_COLEMAK                    1
-#define MACRO_DVORAK                     2
-#define MACRO_UPPER                      3
-#define MACRO_LOWER                      4
-#define MACRO_FUNCTION                   5
-#define MACRO_MOUSE                      6
-#define MACRO_TIMBRE_1                   7
-#define MACRO_TIMBRE_2                   8
-#define MACRO_TIMBRE_3                   9
-#define MACRO_TIMBRE_4                  10
-#define MACRO_TEMPO_U                   11
-#define MACRO_TEMPO_D                   12
-#define MACRO_TONE_DEFAULT              13
-#define MACRO_MUSIC_TOGGLE              14
-#define MACRO_AUDIO_TOGGLE              16
-#define MACRO_INC_VOICE                 18
-#define MACRO_DEC_VOICE                 19
-#define MACRO_BACKLIGHT                 20
-#define MACRO_BREATH_TOGGLE             21
-#define MACRO_BREATH_SPEED_INC          23
-#define MACRO_BREATH_SPEED_DEC          24
-#define MACRO_BREATH_DEFAULT            25
+enum keyboard_layers {
+  LAYER_QWERTY = 0,
+  LAYER_UPPER,
+  LAYER_LOWER,
+  LAYER_FUNCTION,
+  LAYER_MOUSE,
+  LAYER_ADJUST,
+};
+enum keyboard_macros {
+  MACRO_QWERTY = 0,
+  MACRO_UPPER,
+  MACRO_LOWER,
+  MACRO_FUNCTION,
+  MACRO_MOUSE,
+  MACRO_TIMBRE_1,
+  MACRO_TIMBRE_2,
+  MACRO_TIMBRE_3,
+  MACRO_TIMBRE_4,
+  MACRO_TEMPO_U,
+  MACRO_TEMPO_D,
+  MACRO_TONE_DEFAULT,
+  MACRO_MUSIC_TOGGLE,
+  MACRO_AUDIO_TOGGLE,
+  MACRO_INC_VOICE,
+  MACRO_DEC_VOICE,
+  MACRO_BACKLIGHT,
+  MACRO_BREATH_TOGGLE,
+  MACRO_BREATH_SPEED_INC,
+  MACRO_BREATH_SPEED_DEC,
+  MACRO_BREATH_DEFAULT,
+  MACRO_MOUSE_MOVE_UL,
+  MACRO_MOUSE_MOVE_UR,
+  MACRO_MOUSE_MOVE_DL,
+  MACRO_MOUSE_MOVE_DR,
+};
 
 #define M_QWRTY             M(MACRO_QWERTY)
-#define M_COLMK             M(MACRO_COLEMAK)
-#define M_DVORK             M(MACRO_DVORAK)
 #define M_UPPER             M(MACRO_UPPER)
 #define M_LOWER             M(MACRO_LOWER)
 #define M_FUNCT             M(MACRO_FUNCTION)
 #define M_BSPDU             M(MACRO_BREATH_SPEED_INC)
 #define M_BSPDD             M(MACRO_BREATH_SPEED_DEC)
 #define M_BDFLT             M(MACRO_BREATH_DEFAULT)
+#define M_MS_UL             M(MACRO_MOUSE_MOVE_UL)
+#define M_MS_UR             M(MACRO_MOUSE_MOVE_UR)
+#define M_MS_DL             M(MACRO_MOUSE_MOVE_DL)
+#define M_MS_DR             M(MACRO_MOUSE_MOVE_DR)
 
 
 #define VC_UP               M(MACRO_INC_VOICE)
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
-/* QWERTY
- * .-----------------------------------------------------------------------------------------------------------.
- * | TAB    | Q      | W      | E      | R      | T      | Y      | U      | I      | O      | P      | BACKSP |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | ESC    | A      | S      | D      | F      | G      | H      | J      | K      | L      | ;      | '      |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LSHIFT | Z      | X      | C      | V      | B      | N      | M      | ,      | .      | UP     | ENTER  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LCTRL  | LWIN   | FN     | LALT   | UPPER  | SPACE  | SPACE  | LOWER  | SHIFT  | LEFT   | DOWN   | RIGHT  |
- * '-----------------------------------------------------------------------------------------------------------'
- */
-
- [LAYER_QWERTY]       = {  // 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_UP,   KC_ENT   },
-  { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC,  KC_SPC,  M_LOWER, OS_SHFT, KC_LEFT, KC_DOWN, KC_RGHT  },
- },
-
-/* COLEMAK
- * .-----------------------------------------------------------------------------------------------------------.
- * | TAB    | Q      | W      | F      | P      | G      | J      | L      | U      | Y      | ;      | ESC    |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | BACKSP | A      | R      | S      | T      | D      | H      | N      | E      | I      | O      | '      |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LSHIFT | Z      | X      | C      | V      | B      | K      | M      | ,      | .      | UP     | ENTER  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LCTRL  | LWIN   | FN     | LALT   | UPPER  | SPACE  | SPACE  | LOWER  | SHIFT  | LEFT   | DOWN   | RIGHT  |
- * '-----------------------------------------------------------------------------------------------------------'
- */
-
- [LAYER_COLEMAK]      = { // COLEMAK
-  { KC_TAB,  KC_Q,    KC_W,    KC_F,    KC_P,    KC_G,    KC_J,    KC_L,    KC_U,    KC_Y,    KC_SCLN, KC_ESC   },
-  { KC_BSPC, 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_UP,   KC_ENT   },
-  { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC,  KC_SPC,  M_LOWER, OS_SHFT, KC_LEFT, KC_DOWN, KC_RGHT  },
- },
-
-/* DVORAK
- * .-----------------------------------------------------------------------------------------------------------.
- * | TAB    | '      | ,      | .      | P      | Y      | F      | G      | C      | R      | L      | BACKSP |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | ESC    | A      | O      | E      | U      | I      | D      | H      | T      | N      | S      | /      |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LSHIFT | ;      | Q      | J      | K      | X      | B      | M      | W      | V      | Z      | ENTER  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LCTRL  | LWIN   | FN     | LALT   | UPPER  | SPACE  | SPACE  | LOWER  | UP     | DOWN   | LEFT   | RIGHT  |
- * '-----------------------------------------------------------------------------------------------------------'
- */
-
- [LAYER_DVORAK]       = { // 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   },
-  { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC,  KC_SPC,  M_LOWER, KC_UP,   KC_DOWN, KC_LEFT, KC_RGHT  },
- },
-
-/* UPPER
- * .-----------------------------------------------------------------------------------------------------------.
- * | PRINT  | F1     | F2     | F3     | F4     | NUM LK | /      | 7      | 8      | 9      | -      | DEL    |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | CAP LK | F5     | F6     | F7     | F8     | SCR LK | *      | 4      | 5      | 6      | +      | INS    |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * |        | F9     | F10    | F11    | F12    | PAUSE  |        | 1      | 2      | 3      | ENTER  | HOME   |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
- * |        |        |        |        |        | 0      | 0      |        | RALT   | .      | ENTER  | END    |
- * '-----------------------------------------------------------------------------------------------------------'
- */
-
- [LAYER_UPPER]        = { // UPPER
-  { KC_PSCR, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_NLCK, KC_PSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, KC_DEL   },
-  { KC_CAPS, KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_SLCK, KC_PAST, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, KC_INS   },
-  { _______, KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_PAUS, XXXXXXX, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, KC_HOME  },
-  { _______, _______, _______, _______, _______, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, KC_END   },
- },
-
-/* LOWER
- * .-----------------------------------------------------------------------------------------------------------.
- * |        | $      | {      | [      | (      | %      | #      | )      | ]      | }      | @      | PG UP  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * |        | ^      | *      | +      | -      | /      | \      | _      | '      | "      | `      | PG DN  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * |        | |      | &      | !      | ~      | ;      | :      | =      | <      | >      | ?      | HOME   |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
- * |        |        |        |        |        |        |        |        |        |        |        | END    |
- * '-----------------------------------------------------------------------------------------------------------'
- */
-
- [LAYER_LOWER]        = { // LOWER
-  { _______, KC_DLR,  KC_LCBR, KC_LBRC, KC_LPRN, KC_PERC, KC_HASH, KC_RPRN, KC_RBRC, KC_RCBR, KC_AT,   KC_PGUP  },
-  { _______, KC_CIRC, KC_ASTR, KC_PPLS, KC_PMNS, KC_SLSH, KC_BSLS, KC_UNDS, KC_QUOT, KC_DQT,  KC_GRV,  KC_PGDN  },
-  { _______, KC_PIPE, KC_AMPR, KC_EXLM, KC_TILD, KC_SCLN, KC_COLN, KC_EQL,  KC_LT,   KC_GT,   KC_QUES, KC_HOME  },
-  { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END   },
- },
-
-
-/* FUNCTION
- * .-----------------------------------------------------------------------------------------------------------.
- * | NUM LK | F13    | F14    | F15    | F16    | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | PAUSE  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | CAP LK | F17    | F18    | F19    | F20    | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | PRINT  |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | SCR LK | F21    | F22    | F23    | F24    | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MUTE   |
- * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
- * | LCTRL  | LWIN   | FN     | LALT   | UPPER  | PLAY   | PLAY   | LOWER  | VOL UP | VOL DN | NEXT   | PREV   |
- * '-----------------------------------------------------------------------------------------------------------'
- */
- [LAYER_FUNCTION]     = { // FUNCTION
-  { KC_NLCK, KC_F13,  KC_F14,  KC_F15,  KC_F16,  XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAUS  },
-  { KC_CAPS, KC_F17,  KC_F18,  KC_F19,  KC_F20,  XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR  },
-  { KC_SLCK, KC_F21,  KC_F22,  KC_F23,  KC_F24,  XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MUTE  },
-  { _______, _______, _______, _______, _______, KC_MPLY, KC_MPLY, _______, KC_VOLU, KC_VOLD, KC_MPRV, KC_MNXT  },
- },
+/* LAYER = LAYER_QWERTY
+  .-----------------------------------------------------------------------------------------------------------.
+  | TAB    | Q      | W      | E      | R      | T      | Y      | U      | I      | O      | P      | BACKSP |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ESC    | A      | S      | D      | F      | G      | H      | J      | K      | L      | ;      | '      |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | LSHIFT | Z      | X      | C      | V      | B      | N      | M      | ,      | .      | UP     | ENTER  |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | LCTRL  | LWIN   | FN     | LALT   | UPPER  | SPACE  | SPACE  | LOWER  | OSHIFT | LEFT   | DOWN   | RIGHT  |
+  '-----------------------------------------------------------------------------------------------------------'
+*/
+
+[LAYER_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_UP  , KC_ENT  },
+  { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC , KC_SPC , M_LOWER, OS_SHFT, KC_LEFT, KC_DOWN, KC_RGHT }
+},
+
+/* LAYER = LAYER_UPPER
+  .-----------------------------------------------------------------------------------------------------------.
+  | PRINT  | F1     | F2     | F3     | F4     | NUM LK | KP /   | KP 7   | KP 8   | KP 9   | KP -   | DEL    |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | PAUSE  | F5     | F6     | F7     | F8     | SCR LK | KP *   | KP 4   | KP 5   | KP 6   | KP +   | INS    |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | F9     | F10    | F11    | F12    | PAUSE  | KP 0   | KP 1   | KP 2   | KP 3   | KP ENT | HOME   |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | ______ | ______ | ______ | UPPER  | KP 0   | KP 0   | ______ | RALT   | KP .   | KP ENT | END    |
+  '-----------------------------------------------------------------------------------------------------------'
+*/
+
+[LAYER_UPPER] = {
+  { KC_PSCR, KC_F1  , KC_F2  , KC_F3  , KC_F4  , KC_NLCK, KC_PSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, KC_DEL  },
+  { KC_PAUS, KC_F5  , KC_F6  , KC_F7  , KC_F8  , KC_SLCK, KC_PAST, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, KC_INS  },
+  { _______, KC_F9  , KC_F10 , KC_F11 , KC_F12 , KC_PAUS, KC_KP_0, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, KC_HOME },
+  { _______, _______, _______, _______, M_UPPER, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, KC_END  }
+},
+
+/* LAYER = LAYER_LOWER
+  .-----------------------------------------------------------------------------------------------------------.
+  | ______ | $      | {      | [      | (      | %      | #      | )      | ]      | }      | @      | PG UP  |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | ^      | *      | +      | -      | /      | \      | _      | '      | "      | `      | PG DN  |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | |      | &      | !      | ~      | ;      | :      | =      | <      | >      | ?      | HOME   |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | ______ | ______ | ______ | ______ | ______ | ______ | LOWER  | ______ | ______ | ______ | END    |
+  '-----------------------------------------------------------------------------------------------------------'
+*/
+
+[LAYER_LOWER] = {
+  { _______, KC_DLR , KC_LCBR, KC_LBRC, KC_LPRN, KC_PERC, KC_HASH, KC_RPRN, KC_RBRC, KC_RCBR, KC_AT  , KC_PGUP },
+  { _______, KC_CIRC, KC_ASTR, KC_PLUS, KC_MINS, KC_SLSH, KC_BSLS, KC_UNDS, KC_QUOT, KC_DQT , KC_GRV , KC_PGDN },
+  { _______, KC_PIPE, KC_AMPR, KC_EXLM, KC_TILD, KC_SCLN, KC_COLN, KC_EQL , KC_LT  , KC_GT  , KC_QUES, KC_HOME },
+  { _______, _______, _______, _______, _______, _______, _______, M_LOWER, _______, _______, _______, KC_END  }
+},
+
+/* LAYER = LAYER_FUNCTION
+  .-----------------------------------------------------------------------------------------------------------.
+  | XXXXXX | F13    | F14    | F15    | F16    | NUM LK | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | XXXXXX | F17    | F18    | F19    | F20    | SCR LK | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | F21    | F22    | F23    | F24    | CAP LK | XXXXXX | XXXXXX | XXXXXX | XXXXXX | VOL UP | MUTE   |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | ______ | FN     | ______ | ______ | PLAY   | PLAY   | ______ | ______ | PREV   | VOL DN | NEXT   |
+  '-----------------------------------------------------------------------------------------------------------'
+*/
+
+[LAYER_FUNCTION] = {
+  { XXXXXXX, KC_F13 , KC_F14 , KC_F15 , KC_F16 , KC_NLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
+  { XXXXXXX, KC_F17 , KC_F18 , KC_F19 , KC_F20 , KC_SLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
+  { _______, KC_F21 , KC_F22 , KC_F23 , KC_F24 , KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, KC_MUTE },
+  { _______, _______, M_FUNCT, _______, _______, KC_MPLY, KC_MPLY, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT }
+},
 
 #ifdef MOUSEKEY_ENABLE
 
- [LAYER_MOUSE]        = { // MOUSE
-  { KC_ESC,  KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC   },
-  { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX  },
-  { _______, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_U, KC_WH_D  },
-  { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, KC_MS_U, KC_MS_D, KC_MS_L, KC_MS_R  },
- },
+/* LAYER = LAYER_MOUSE
+  .-----------------------------------------------------------------------------------------------------------.
+  | ESC    | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MS UL  | MS U   | MS UR  | MS WHL | MS WHR |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | XXXXXX | MS BT5 | MS BT4 | MS BT3 | MS BT2 | XXXXXX | XXXXXX | MS L   | XXXXXX | MS R   | XXXXXX | MS WHU |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MS DL  | MS D   | MS DR  | MS U   | MS WHD |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | ______ | ______ | ______ | ______ | ______ | MS BT1 | MS BT1 | ______ | ______ | MS L   | MS D   | MS R   |
+  '-----------------------------------------------------------------------------------------------------------'
+*/
+
+[LAYER_MOUSE] = {
+  { KC_ESC , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_MS_UL, KC_MS_U, M_MS_UR, KC_WH_L, KC_WH_R },
+  { XXXXXXX, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, KC_MS_L, XXXXXXX, KC_MS_R, XXXXXXX, KC_WH_U },
+  { _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_MS_DL, KC_MS_D, M_MS_DR, KC_MS_U, KC_WH_D },
+  { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }
+},
 
 #endif
 
- [LAYER_ADJUST]       = { // ADJUST
-  { _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, _______, MU_TOG,  AU_TOG   },
-  { _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______  },
-  { _______, _______, _______, _______, M_BACKL, RESET,   _______, M_MOUSE, _______, _______, MUV_IN,  _______  },
-  { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, MUV_DE,  _______  },
- },
-
-/*
- [LAYER_EMPTY]        = {
-  { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,  },
-  { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,  },
-  { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,  },
-  { _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______,  },
- },
+/* LAYER = LAYER_ADJUST
+  .-----------------------------------------------------------------------------------------------------------.
+  | XXXXXX | BRTOG  | BRSPD+ | BRSPD- | BRDFLT | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MUSIC  | AUDIO  |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | XXXXXX | QWERTY | XXXXXX | XXXXXX | BACKLT | RESET  | XXXXXX | MOUSE  | XXXXXX | XXXXXX | VOICE+ | XXXXXX |
+  |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
+  | XXXXXX | XXXXXX | XXXXXX | XXXXXX | UPPER  | XXXXXX | XXXXXX | LOWER  | XXXXXX | TEMPO- | VOICE- | TEMPO+ |
+  '-----------------------------------------------------------------------------------------------------------'
 */
 
+[LAYER_ADJUST] = {
+  { XXXXXXX, M_BRTOG, M_BSPDU, M_BSPDD, M_BDFLT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MU_TOG , AU_TOG  },
+  { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
+  { XXXXXXX, M_QWRTY, XXXXXXX, XXXXXXX, M_BACKL, RESET  , XXXXXXX, M_MOUSE, XXXXXXX, XXXXXXX, MUV_IN , XXXXXXX },
+  { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_UPPER, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, TMPO_DN, MUV_DE , TMPO_UP }
+},
+
 };
 
 #ifdef AUDIO_ENABLE
@@ -234,10 +217,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 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(DVORAK_SOUND);
-float tone_colemak[][2]    = SONG(COLEMAK_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);
@@ -267,46 +246,38 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
     switch(id)
     {
 
-        case MACRO_QWERTY:
+        case MACRO_BREATH_TOGGLE:
             if (record->event.pressed)
             {
-                persistant_default_layer_set(1UL<<LAYER_QWERTY);
-                               #ifdef AUDIO_ENABLE
-                       PLAY_NOTE_ARRAY(tone_qwerty, false, STACCATO);
-                               #endif /* AUDIO_ENABLE */
+                breathing_toggle();
             }
             break;
 
-        case MACRO_COLEMAK:
+        case MACRO_BREATH_SPEED_INC:
             if (record->event.pressed)
             {
-                persistant_default_layer_set(1UL<<LAYER_COLEMAK);
-                               #ifdef AUDIO_ENABLE
-                       PLAY_NOTE_ARRAY(tone_colemak, false, STACCATO);
-                               #endif /* AUDIO_ENABLE */
+                breathing_speed_inc(1);
             }
             break;
 
-        case MACRO_DVORAK:
+        case MACRO_BREATH_SPEED_DEC:
             if (record->event.pressed)
             {
-                persistant_default_layer_set(1UL<<LAYER_DVORAK);
-                               #ifdef AUDIO_ENABLE
-                   PLAY_NOTE_ARRAY(tone_dvorak, false, STACCATO);
-                               #endif /* AUDIO_ENABLE */
+                breathing_speed_dec(1);
             }
             break;
 
-        case MACRO_LOWER:
+        case MACRO_BREATH_DEFAULT:
             if (record->event.pressed)
             {
-                layer_on(LAYER_LOWER);
-                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
+                breathing_defaults();
             }
-            else
+            break;
+
+        case MACRO_QWERTY:
+            if (record->event.pressed)
             {
-                layer_off(LAYER_LOWER);
-                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
+                persistant_default_layer_set(1UL<<LAYER_QWERTY);
             }
             break;
 
@@ -314,6 +285,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
             if (record->event.pressed)
             {
                 layer_on(LAYER_UPPER);
+                breathing_speed_set(2);
+                breathing_pulse();
                 update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
             }
             else
@@ -323,13 +296,32 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
             }
             break;
 
+        case MACRO_LOWER:
+            if (record->event.pressed)
+            {
+                layer_on(LAYER_LOWER);
+                breathing_speed_set(2);
+                breathing_pulse();
+                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
+            }
+            else
+            {
+                layer_off(LAYER_LOWER);
+                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
+            }
+            break;
+
         case MACRO_FUNCTION:
             if (record->event.pressed)
             {
+                breathing_speed_set(3);
+                breathing_enable();
                 layer_on(LAYER_FUNCTION);
             }
             else
             {
+                breathing_speed_set(1);
+                breathing_self_disable();
                 layer_off(LAYER_FUNCTION);
             }
             break;
@@ -352,6 +344,58 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
             }
             break;
 
+        case MACRO_MOUSE_MOVE_UL:
+            if (record->event.pressed)
+            {
+              mousekey_on(KC_MS_UP);
+              mousekey_on(KC_MS_LEFT);
+            }
+            else
+            {
+              mousekey_off(KC_MS_UP);
+              mousekey_off(KC_MS_LEFT);
+            }
+            break;
+
+        case MACRO_MOUSE_MOVE_UR:
+            if (record->event.pressed)
+            {
+              mousekey_on(KC_MS_UP);
+              mousekey_on(KC_MS_RIGHT);
+            }
+            else
+            {
+              mousekey_off(KC_MS_UP);
+              mousekey_off(KC_MS_RIGHT);
+            }
+            break;
+
+        case MACRO_MOUSE_MOVE_DL:
+            if (record->event.pressed)
+            {
+              mousekey_on(KC_MS_DOWN);
+              mousekey_on(KC_MS_LEFT);
+            }
+            else
+            {
+              mousekey_off(KC_MS_DOWN);
+              mousekey_off(KC_MS_LEFT);
+            }
+            break;
+
+        case MACRO_MOUSE_MOVE_DR:
+            if (record->event.pressed)
+            {
+              mousekey_on(KC_MS_DOWN);
+              mousekey_on(KC_MS_RIGHT);
+            }
+            else
+            {
+              mousekey_off(KC_MS_DOWN);
+              mousekey_off(KC_MS_RIGHT);
+            }
+            break;
+
 #endif /* MOUSEKEY_ENABLE */
 
 #ifdef AUDIO_ENABLE
index 07de3ecb8fa4b4f0666ed5bfd08fd664ddca2685..79ade4d0004f5691f7c77575e9e0d33ea0854f7c 100644 (file)
@@ -65,9 +65,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
       highest_td = idx;
     action = &tap_dance_actions[idx];
 
-    action->state.keycode = keycode;
     action->state.pressed = record->event.pressed;
     if (record->event.pressed) {
+      action->state.keycode = keycode;
       action->state.count++;
       action->state.timer = timer_read();
 
@@ -77,8 +77,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
         process_tap_dance_action_on_dance_finished (paction);
         reset_tap_dance (&paction->state);
       }
+
+      last_td = keycode;
     }
-    last_td = keycode;
 
     break;
 
index 70725bf81ab949d2cc0270018f0d6dbee9f8e499..7ee3b28d43e6e564f6861e5d8bf270eba06e1d05 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -58,7 +58,7 @@ Here are the steps
    3. Followed by `git reset --hard`
 3. Start the "Bash On Ubuntu On Windows" from the start menu
 4. With the bash open, navigate to your Git checkout. The harddisk can be accessed from `/mnt` for example `/mnt/c` for the `c:\` drive.
-5. Run `sudo util/install_dependencies.sh`. 
+5. Run `sudo util/install_dependencies.sh`.
 6. After a while the installation will finish, and you are good to go
 
 **Note** From time to time, the dependencies might change, so just run `install_dependencies.sh` again if things are not working.
@@ -92,12 +92,12 @@ You can also try these instructions:
 3. Install [DFU-Programmer][dfu-prog].
 
 If you are going to flash Infinity based keyboards you will also need dfu-util
-    
+
     brew install dfu-util
 
 ### Linux
 
-To ensure you are always up to date, you can just run `sudo utils/install_dependencies.sh`. That should always install all the dependencies needed. 
+To ensure you are always up to date, you can just run `sudo utils/install_dependencies.sh`. That should always install all the dependencies needed.
 
 You can also install things manually, but this documentation might not be always up to date with all requirements.
 
@@ -158,7 +158,7 @@ In every keymap folder, the following files are recommended:
 * `config.h` - the options to configure your keymap
 * `keymap.c` - all of your keymap code, required
 * `Makefile` - the features of QMK that are enabled, required to run `make` in your keymap folder
-* `readme.md` - a description of your keymap, how others might use it, and explanations of features 
+* `readme.md` - a description of your keymap, how others might use it, and explanations of features
 
 ## The `make` command
 
@@ -179,7 +179,7 @@ The following instruction refers to these folders.
 
 If the `keymap` folder contains a file name `Makefile`
 
-1. Change the directory to the `keymap` folder 
+1. Change the directory to the `keymap` folder
 2. Run `make <subproject>-<programmer>`
 
 Otherwise, if there's no `Makefile` in the `keymap` folder
@@ -433,7 +433,7 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac
 
 Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds.
 
-To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift. 
+To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift.
 
 It's defaulted to work on US keyboards, but if your layout uses different keys for parenthesis, you can define those in your `config.h` like this:
 
@@ -530,11 +530,11 @@ For the sake of flexibility, tap-dance actions can be either a pair of keycodes,
 
 ### Examples
 
-Here's a simple example for a single definition: 
+Here's a simple example for a single definition:
 
 1. In your `makefile`, add `TAP_DANCE_ENABLE = yes`
 2. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200`
-3. In your `keymap.c` file, define the variables and definitions, then add to your keymap: 
+3. In your `keymap.c` file, define the variables and definitions, then add to your keymap:
 
 ```c
 //Tap Dance Declarations
@@ -550,10 +550,10 @@ qk_tap_dance_action_t tap_dance_actions[] = {
 };
 
 //In Layer declaration, add tap dance item in place of a key code
-TD(TD_ESC_CAPS) 
+TD(TD_ESC_CAPS)
 ```
 
-Here's a more complex example involving custom actions: 
+Here's a more complex example involving custom actions:
 
 ```c
 enum {
@@ -828,11 +828,11 @@ To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMI
 Afterwards create a new layer called `_DYN`:
 
     #define _DYN 6    /* almost any other free number should be ok */
-    
+
 Below these two modifications include the `dynamic_macro.h` header:
 
     #include "dynamic_macro.h"`
-    
+
 Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_MACRO_PLAY1`,`DYN_REC_START2` and `DYN_MACRO_PLAY2`. It may also contain other keys, it doesn't matter apart from the fact that you won't be able to record these keys in the dynamic macros.
 
     [_DYN]= {
@@ -841,7 +841,7 @@ Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_MAC
         {_______,  _______,        _______,         _______, _______, _______, _______, _______, _______, _______, _______, _______},
         {_______,  _______,        _______,         _______, _______, _______, _______, _______, _______, _______, _______, _______}
     },
-    
+
 Add the following code to the very beginning of your `process_record_user()` function:
 
     if (!process_record_dynamic_macro(keycode, record)) {
@@ -877,6 +877,66 @@ In `quantum/keymap_extras/`, you'll see various language files - these work the
 
 You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile.
 
+## Backlight Breathing
+
+In order to enable backlight breathing, the following line must be added to your config.h file.
+
+    #define BACKLIGHT_BREATHING
+
+The following function calls are used to control the breathing effect.
+
+* ```breathing_enable()``` - Enable the free-running breathing effect.
+* ```breathing_disable()``` - Disable the free-running breathing effect immediately.
+* ```breathing_self_disable()``` - Disable the free-running breathing effect after the current effect ends.
+* ```breathing_toggle()``` - Toggle the free-running breathing effect.
+* ```breathing_defaults()``` - Reset the speed and brightness settings of the breathing effect.
+
+The following function calls are used to control the maximum brightness of the breathing effect.
+
+* ```breathing_intensity_set(value)``` - Set the brightness of the breathing effect when it is at its max value.
+* ```breathing_intensity_default()``` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity.
+
+The following function calls are used to control the cycling speed of the breathing effect.
+
+* ```breathing_speed_set(value)``` - Set the speed of the breathing effect - how fast it cycles.
+* ```breathing_speed_inc(value)``` - Increase the speed of the breathing effect by a fixed value.
+* ```breathing_speed_dec(value)``` - Decrease the speed of the breathing effect by a fixed value.
+* ```breathing_speed_default()``` - Reset the speed of the breathing effect to the default value.
+
+The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed:
+
+    case MACRO_FUNCTION:
+        if (record->event.pressed)
+        {
+            breathing_speed_set(3);
+            breathing_enable();
+            layer_on(LAYER_FUNCTION);
+        }
+        else
+        {
+            breathing_speed_set(1);
+            breathing_self_disable();
+            layer_off(LAYER_FUNCTION);
+        }
+        break;
+
+The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed:
+
+    case MACRO_RAISED:
+      if (record->event.pressed)
+      {
+        layer_on(LAYER_RAISED);
+        breathing_speed_set(2);
+        breathing_pulse();
+        update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
+      }
+      else
+      {
+        layer_off(LAYER_RAISED);
+        update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
+      }
+      break;
+
 ## Other firmware shortcut keycodes
 
 * `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`)
@@ -1043,7 +1103,7 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring
 In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile).
 
 Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default:
-    
+
     #define RGB_DI_PIN F4     // The pin your RGB strip is wired to
     #define RGBLIGHT_TIMER    // Require for fancier stuff (not compatible with audio)
     #define RGBLED_NUM 14     // Number of LEDs
@@ -1090,15 +1150,15 @@ If your keyboard is running an Atmega chip (atmega32u4 and others), it's pretty
 
 The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.
 
-Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward. 
+Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward.
 
 The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly.
 
 For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.
 
-`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported. 
+`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported.
 
-`BACKLIGHT_BREATHING` is a fancier backlight feature, and uses one of the timers.
+`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
 
 `BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
 
@@ -1145,14 +1205,14 @@ Each of the `kxx` variables needs to be unique, and usually follows the format `
 
 # Unit Testing
 
-If you are new to unit testing, then you can find many good resources on internet. However most of it is scattered around in small pieces here and there, and there's also many different opinions, so I won't give any recommendations. 
+If you are new to unit testing, then you can find many good resources on internet. However most of it is scattered around in small pieces here and there, and there's also many different opinions, so I won't give any recommendations.
 
 Instead I recommend these two books, explaining two different styles of Unit Testing in detail.
 
 * "Test Driven Development: By Example: Kent Beck"
 * "Growing Object-Oriented Software, Guided By Tests: Steve Freeman, Nat Pryce"
 
-If you prefer videos there are Uncle Bob's [Clean Coders Videos](https://cleancoders.com/), which unfortunately cost quite a bit, especially if you want to watch many of them. But James Shore has a free [Let's Play](http://www.jamesshore.com/Blog/Lets-Play) video series. 
+If you prefer videos there are Uncle Bob's [Clean Coders Videos](https://cleancoders.com/), which unfortunately cost quite a bit, especially if you want to watch many of them. But James Shore has a free [Let's Play](http://www.jamesshore.com/Blog/Lets-Play) video series.
 
 ## Google Test and Google Mock
 It's possible to Unit Test your code using [Google Test](https://github.com/google/googletest). The Google Test framework also includes another component for writing testing mocks and stubs, called "Google Mock". For information how to write the actual tests, please refer to the documentation on that site.
@@ -1161,7 +1221,7 @@ It's possible to Unit Test your code using [Google Test](https://github.com/goog
 
 Note that Google Test and therefore any test has to be written in C++, even if the rest of the QMK codebases is written in C. This should hopefully not be a problem even if you don't know any C++, since there's quite clear documentation and examples of the required C++ features, and you can write the rest of the test code almost as you would write normal C. Note that some compiler errors which you might get can look quite scary, but just read carefully what it says, and you should be ok.
 
-One thing to remember, is that you have to append `extern "C"` around all of your C file includes. 
+One thing to remember, is that you have to append `extern "C"` around all of your C file includes.
 
 ## Adding tests for new or existing features
 
@@ -1189,7 +1249,6 @@ If there are problems with the tests, you can find the executable in the `./buil
 
 ## Full Integration tests
 
-It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing. 
+It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing.
 
 In that model you would emulate the input, and expect a certain output from the emulated keyboard.
-
index 79fc7119a68584ccf694893295e9fad71ae8ce5b..e4c8aecb2cfa5a89213c324d44d1476f6503c3fe 100644 (file)
@@ -332,11 +332,13 @@ $1/compiler.txt: $1/force
        $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
 endef
 
+.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
 $(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
-       echo '$(OBJ)' | cmp -s - $$@ || echo '$(OBJ)' > $$@
+       echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
 
+.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
 $(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
-       echo '$(LDFLAGS)' | cmp -s - $$@ || echo '$(LDFLAGS)' > $$@
+       echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
 
 
 # We have to use static rules for the .d files for some reason