From 5ac0e6e6aee64c9b8fade79aaf22bc839e2c6b47 Mon Sep 17 00:00:00 2001 From: milestogo Date: Thu, 9 Feb 2017 23:23:39 -0800 Subject: dumber sculpt build --- .../handwired/MS-sculpt-mobile/MS-sculpt-mobile.c | 1 + .../handwired/MS-sculpt-mobile/MS-sculpt-mobile.h | 48 ++++++++ keyboards/handwired/MS-sculpt-mobile/Makefile | 3 + keyboards/handwired/MS-sculpt-mobile/config.h | 99 ++++++++++++++++ .../MS-sculpt-mobile/keymaps/default/Makefile | 21 ++++ .../MS-sculpt-mobile/keymaps/default/config.h | 8 ++ .../MS-sculpt-mobile/keymaps/default/keymap.c | 64 ++++++++++ .../MS-sculpt-mobile/keymaps/default/readme.md | 1 + .../MS-sculpt-mobile/keymaps/milestogo/Makefile | 21 ++++ .../MS-sculpt-mobile/keymaps/milestogo/config.h | 8 ++ .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 132 +++++++++++++++++++++ .../MS-sculpt-mobile/keymaps/milestogo/readme.md | 1 + keyboards/handwired/MS-sculpt-mobile/readme.md | 58 +++++++++ keyboards/handwired/MS-sculpt-mobile/rules.mk | 43 +++++++ 14 files changed, 508 insertions(+) create mode 100644 keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.c create mode 100644 keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.h create mode 100644 keyboards/handwired/MS-sculpt-mobile/Makefile create mode 100644 keyboards/handwired/MS-sculpt-mobile/config.h create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/default/config.h create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/default/keymap.c create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/default/readme.md create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c create mode 100644 keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/readme.md create mode 100644 keyboards/handwired/MS-sculpt-mobile/readme.md create mode 100644 keyboards/handwired/MS-sculpt-mobile/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.c b/keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.c new file mode 100644 index 0000000000..4c735a6c29 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.c @@ -0,0 +1 @@ +#include "MS-sculpt-mobile.h" diff --git a/keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.h b/keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.h new file mode 100644 index 0000000000..1583dea6e8 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/MS-sculpt-mobile.h @@ -0,0 +1,48 @@ +#ifndef MICROSOFT_SCULPT_MOBILE_H +#define MICROSOFT_SCULPT_MOBILE_H + +#include "quantum.h" + + +#define KEYMAP( \ + k7Q, k6O, k6P, k6Q, k5O, k5P, k5Q, k7A, k7B, k7C, k7D, k7E, k7F, k1O, k1K, k1L, \ + k5A, k5K, k5L, k5M, k5N, k5H, k5I, k2A, k2B, k2C, k2D, k5B, k5C, k5J, k2E, \ + k6R, k6D, k6E, k6F, k7I, k7J, k4A, k4B, k4C, k4D, k3A, k3B, k3C, k3D, \ + k0J, k6A, k6B, k6C, k7H, k1A, k1B, k5D, k5E, k5F, k5G, k1C, k7P, k2G, \ + k2P, k7K, k7L, k7M, k7O, k0A, k0B, k0C, k0D, k0E, k0F, k2L, k6G, k1P,\ + k1Q, k4N, k3O,k6N, k3K, k0R, k1M, k6H, k6I, k6J \ +) \ +{ \ + {k0A, k0B, k0C, k0D, k0E, k0F, KC_NO, KC_NO, KC_NO, k0J, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,KC_NO, KC_NO, k0R},\ + {k1A, k1B, k1C, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k1K, k1L, k1M, KC_NO, k1O, k1P, k1Q, KC_NO},\ + {k2A, k2B, k2C, k2D, k2E, KC_NO, k2G, KC_NO, KC_NO, KC_NO, KC_NO, k2L, KC_NO, KC_NO, KC_NO, k2P, KC_NO, KC_NO},\ + {k3A, k3B, k3C, k3D, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k3K, KC_NO, KC_NO, KC_NO, k3O, KC_NO, KC_NO, KC_NO},\ + {k4A, k4B, k4C, k4D, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k4N, KC_NO,KC_NO, KC_NO, KC_NO},\ + {k5A, k5B, k5C, k5D, k5E, k5F, k5G, k5H, k5I, k5J, k5K, k5L, k5M, k5N, k5O, k5P, k5Q, KC_NO },\ + {k6A, k6B, k6C, k6D, k6E, k6F, k6G, k6H, k6I, k6J, KC_NO, KC_NO, KC_NO, k6N, k6O, k6P, k6Q, k6R},\ + {k7A, k7B, k7C, k7D, k7E, k7F, KC_NO, k7H, k7I, k7J, k7K, k7L, k7M, KC_NO, k7O, k7P, k7Q, KC_NO},\ +} + + +#define MATRIX_TESTING_KEYMAP( \ + k0A, k0B, k0C, k0D, k0E, k0F, k0G, k0H, k0I, k0, k0J, k0K, k0L, k0M, k0N, k0O, k0P, k0Q,\ + k1A, k1B, k1C, k1D, k1E, k1F, k1G, k1H, k1I, k1, k1J, k1K, k1L, k1M, k1N, k1O, k1P, k1Q,\ + k2A, k2B, k2C, k2D, k2E, k2F, k2G, k2H, k2I, k2, k2J, k2K, k2L, k2M, k2N, k2O, k2P, k2Q,\ + k3A, k3B, k3C, k3D, k3E, k3F, k3G, k3H, k3I, k3, k3J, k3K, k3L, k3M, k3N, k3O, k3P, k3Q,\ + k4A, k4B, k4C, k4D, k4E, k4F, k4G, k4H, k4I, k4, k4J, k4K, k4L, k4M, k4N, k4O, k4P, k4Q,\ + k5A, k5B, k5C, k5D, k5E, k5F, k5G, k5H, k5I, k5, k5J, k5K, k5L, k5M, k5N, k5O, k5P, k5Q,\ + k6A, k6B, k6C, k6D, k6E, k6F, k6G, k6H, k6I, k6, k6J, k6K, k6L, k6M, k6N, k6O, k6P, k6Q,\ + k7A, k7B, k7C, k7D, k7E, k7F, k7G, k7H, k7I, k7, k7J, k7K, k7L, k7M, k7N, k7O, k7P, k7Q\ +) \ +{ \ + {k0A, k0B, k0C, k0D, k0E, k0F, k0G, k0H, k0I, k0, k0J, k0K, k0L, k0M, k0N, k0O, k0P, k0Q},\ + {k1A, k1B, k1C, k1D, k1E, k1F, k1G, k1H, k1I, k1, k1J, k1K, k1L, k1M, k1N, k1O, k1P, k1Q},\ + {k2A, k2B, k2C, k2D, k2E, k2F, k2G, k2H, k2I, k2, k2J, k2K, k2L, k2M, k2N, k2O, k2P, k2Q},\ + {k3A, k3B, k3C, k3D, k3E, k3F, k3G, k3H, k3I, k3, k3J, k3K, k3L, k3M, k3N, k3O, k3P, k3Q},\ + {k4A, k4B, k4C, k4D, k4E, k4F, k4G, k4H, k4I, k4, k4J, k4K, k4L, k4M, k4N, k4O, k4P, k4Q},\ + {k5A, k5B, k5C, k5D, k5E, k5F, k5G, k5H, k5I, k5, k5J, k5K, k5L, k5M, k5N, k5O, k5P, k5Q},\ + {k6A, k6B, k6C, k6D, k6E, k6F, k6G, k6H, k6I, k6, k6J, k6K, k6L, k6M, k6N, k6O, k6P, k6Q},\ + {k7A, k7B, k7C, k7D, k7E, k7F, k7G, k7H, k7I, k7, k7J, k7K, k7L, k7M, k7N, k7O, k7P, k7Q},\ +} + +#endif diff --git a/keyboards/handwired/MS-sculpt-mobile/Makefile b/keyboards/handwired/MS-sculpt-mobile/Makefile new file mode 100644 index 0000000000..bd09e5885d --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif diff --git a/keyboards/handwired/MS-sculpt-mobile/config.h b/keyboards/handwired/MS-sculpt-mobile/config.h new file mode 100644 index 0000000000..1ac40f9964 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/config.h @@ -0,0 +1,99 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#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 Microsoft+abit +#define PRODUCT sculpt mobile +#define DESCRIPTION 6000 + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 18 + +#ifdef ASTAR + + /*0 1 2 3 4 5 6 7 8 */ +#define MATRIX_ROW_PINS {D7, C6, D4, D0, D1, D3, D2, E2} +/* A B C D E F G H I J K L M N O P Q R */ +#define MATRIX_COL_PINS {B4, B5, E6, B7, B6, D6, C7, F7, F6, F4,F5, F1,F0, D5, B0, B1, B2, B3} + +#else + +/* 0 1 2 3 4 5 6 7 */ +#define MATRIX_ROW_PINS { F7,F6,F4,F5,F3,F2,F1,F0} +/* A B C D E F G H I J K L M N O P Q R */ +#define MATRIX_COL_PINS { B7, D0, D1, D2, D3, D4, D5, D6, D7, E0,E1,C1, C0, C3, C2, C5, C4,C6} +#define UNUSED_PINS { B6,B5,B4,B3,B2,B1,B0 } + + +#endif + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +/* 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 + + +/* + * 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)) \ +) + + +/* + * 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/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile new file mode 100644 index 0000000000..9d3df5964f --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = 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 = 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. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/default/config.h b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/config.h new file mode 100644 index 0000000000..8893d122e0 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/default/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/keymap.c new file mode 100644 index 0000000000..ab09dcdd1c --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/keymap.c @@ -0,0 +1,64 @@ +#include "MS-sculpt-mobile.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* +* +* |ESC | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10| F11| F12|Vol-|Vol+|Mute| +* -------------------------------------------------------------------------------' +* | ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del | +* -------------------------------------------------------------------------- +* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | | +* -------------------------------------------------------------------------------' +* | caps | a | s | d | f | g | h | j | k | l | ; | ' | enter |PgUp| +* -------------------------------------------------------------------------------- +* |Lsft | z | x | c | v | b | n | m | , | . | / | Rsft| Up| PgDn| +* --------------------------------------------------------------------------------- +* |Lctl |Lgui |Lalt | Space |Ralt | FN | Rctl |Left|Down|Rght| +* --------------------------------------------------------------------------------- +*/ + +[0] = KEYMAP( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_VOLU, KC_MUTE,\ + KC_GRAVE, KC_1, KC_2, KC_3 ,KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQL, KC_BSPC, KC_DEL,\ + 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_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, 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, KC_UP, KC_PGDN,\ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, RSFT(KC_1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT +) + +}; +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/default/readme.md b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/readme.md new file mode 100644 index 0000000000..e67ddc6fec --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for microsoft-sculpt-mobile diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile new file mode 100644 index 0000000000..9d3df5964f --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = 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 = 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. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h new file mode 100644 index 0000000000..8893d122e0 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c new file mode 100644 index 0000000000..a80d5beaad --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -0,0 +1,132 @@ +#include "MS-sculpt-mobile.h" + +#define _QWR 0 +#define _CDH 1 +#define _SYM 2 +#define _MOV 3 +#define _NUM 4 +#define _TRAN 9 + +// Shorter spacing +#define XXXX KC_NO +#define ____ KC_TRNS + +// Custom macros + +/* Fn Keys */ +#define TT_SYM MO(_SYM) +#define TO_CDH TG(_CDH) +#define TO_MOV MO(_MOV) +#define TT_NUM MO(_NUM) +#define SSFT ACTION_MODS_ONESHOT(MOD_LSFT) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* QWERTY +* +* |ESC | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10| F11| F12|Vol-|Vol+|Mute| +* -------------------------------------------------------------------------------' +* | ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del | +* -------------------------------------------------------------------------- +* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | | +* -------------------------------------------------------------------------------' +* | caps | a | s | d | f | g | h | j | k | l | ; | ' | enter |PgUp| +* -------------------------------------------------------------------------------- +* |Lsft | z | x | c | v | b | n | m | , | . | / | Rsft| Up| PgDn| +* --------------------------------------------------------------------------------- +* |Lctl |Lgui |Lalt | Space |Ralt | FN | Rctl |Left|Down|Rght| +* --------------------------------------------------------------------------------- +*/ + +[_QWR] = KEYMAP( \ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_VOLU, TO_CDH,\ + KC_ESC, KC_1, KC_2, KC_3 ,KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQL, KC_BSPC, KC_DEL,\ + 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,\ + TT_SYM, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, 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, KC_UP, KC_PGDN,\ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RGUI,TT_SYM,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT +), + +[_CDH] = KEYMAP (\ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + KC_ESC, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, ____, ____, ____,\ + TO_MOV, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, ____,\ + KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, ____,\ + ____, ____, ____ , TT_SYM, ____, ____, ____, ____, ____, ____ + +), + +[_SYM] = KEYMAP (\ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\ + ____, KC_EXLM, KC_HASH, KC_0, KC_EQL, ____, KC_ASTR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\ + ____, ____, ____, ____, KC_TILDE, KC_PIPE, KC_DLR, ____, ____, ____, ____, ____, ____, ____,\ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ +), + +[_MOV] = KEYMAP (\ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, ____, KC_LEFT,KC_DOWN, KC_UP, KC_RIGHT, ____,____,____,\ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ +), + +[_TRAN] = KEYMAP (\ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ +) +}; + + +const uint16_t PROGMEM fn_actions[] = { +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + + + case KC_N: + if(keyboard_report->mods & MOD_BIT(KC_LGUI) ) { + clear_keyboard_but_mods(); + register_code(KC_V); + } + break; + + + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/readme.md b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/readme.md new file mode 100644 index 0000000000..96ee0e77a5 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/readme.md @@ -0,0 +1 @@ +# A more programmer oriented keymap for microsoft-sculpt-mobile diff --git a/keyboards/handwired/MS-sculpt-mobile/readme.md b/keyboards/handwired/MS-sculpt-mobile/readme.md new file mode 100644 index 0000000000..58029b50db --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/readme.md @@ -0,0 +1,58 @@ + +This is a way to take a Microsoft ergonomic bluetooth keyboard, and make it +into a hard-wired keyboard running QMK. + +The keyboard is known under several different names: +Mobile Bluetooth 5000, Mobile 6000, Sculpt mobile, and Asus rebranded + +I had a stack of them,since they're cheap on ebay, travel well, and are just ergo enough. + +The ribbon cable is 1mm pitch, which is hard to hand solder. I bought a cheap set of +"pitch adapter" boards https://www.amazon.com/Double-Sided-0-4mm-1-0-Adapter-60mmx38mm/dp/B00OK42118 + +Cut the original ribbon cable sockets off the bluetooth board using a razor, they're hard to desolder. +They're also allow the cable to be inserted on top or bottom. + +If I was going to do it again, I'd make the MCU connection come out the top of the keyboard +and avoid the wires dangling out the bottom. + +As I was debugging the matrix, I started to get random failures. In desparation I tried a second MCU, +but had the same problems. It turns out that the ribbon cable connections can get worn. Shave a +half millimeter off the end of the ribbon cable & the errors go away. + +My method for discovering the matrix was to set up a KEYMAP macro that included all pins. +See MATRIX_TESTING_KEYMAP if you need it. Then set up a keymap that has all printable symbols +in the first 4 rows. test each key & record output. Then switch the printable symbols to the +bottom 4 rows & repeat. This was enough to show the matrix. + + +The full original keymap for the sculpt is + A B C D E F G H ---> +0 b n m , . / +1 g h " +2 7 8 9 0 Del PgUp +3 p [ ] \ +4 y u i o +5 ~ - += j k l ; 5 +6 a s d q w e, Up left +7 F7 F8 F9 F10 F11 F12 f + +-----> I J K L M N O P Q R +0 Caps FN +1 Vol+ mute Rctl vol- pgdn LCTL +2 Rshift LShift +3 Ralt LAlt +4 LGUI +5 6 bakspc 1 2 3 4 F4 F5 F6 +6 Down right spc F1 F2 F3 tab +7 r t z x c v enter Esc + +This works with 18 cols + 8 rows on a Teensy++, or Arm based Teensy. + +The Astar mini has all pins exposed , so you can do 18x8 +If you want a speaker, LEDs &etc, you'll need to free up a pin. I recommend joining columns +R and L to the same pin. + +Building - edit rules.mk to set ASTAR=1 or comment it out for teensy2++ + + diff --git a/keyboards/handwired/MS-sculpt-mobile/rules.mk b/keyboards/handwired/MS-sculpt-mobile/rules.mk new file mode 100644 index 0000000000..cb9d5813cf --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/rules.mk @@ -0,0 +1,43 @@ +#CFLAGS=-D ASTAR + +ifdef ASTAR + OPT_DEFS += -DBOOTLOADER_SIZE=4096 + MCU = atmega32u4 + OPT_DEFS += -DCATERINA_BOOTLOADER + SCULPT_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done ; \ + avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) + +else + MCU = at90usb1286 + OPT_DEFS += -DBOOTLOADER_SIZE=2048 + SCULPT_UPLOAD_COMMAND = teensy_loader_cli -w -mmcu=$(MCU) $(TARGET).hex +endif + +F_CPU = 16000000 +ARCH = AVR8 +F_USB = $(F_CPU) +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # 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 +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 + + +USB ?= /dev/cu.usbmodem1421 + + +upload: build + $(SCULPT_UPLOAD_COMMAND) -- cgit v1.2.3 From 274b1c53fbc8c0838305e7837c4594d67431f2b6 Mon Sep 17 00:00:00 2001 From: milestogo Date: Sat, 11 Feb 2017 22:10:44 -0800 Subject: keymap update --- .../MS-sculpt-mobile/keymaps/milestogo/Makefile | 2 +- .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 34 +++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile index 9d3df5964f..a82d80deee 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile @@ -17,5 +17,5 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend ifndef QUANTUM_DIR - include ../../../../Makefile + include ../../../../../Makefile endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c index a80d5beaad..0551fbde72 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -16,7 +16,7 @@ /* Fn Keys */ #define TT_SYM MO(_SYM) #define TO_CDH TG(_CDH) -#define TO_MOV MO(_MOV) +#define TT_MOV KC_FN2 #define TT_NUM MO(_NUM) #define SSFT ACTION_MODS_ONESHOT(MOD_LSFT) @@ -42,18 +42,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_VOLU, TO_CDH,\ KC_ESC, KC_1, KC_2, KC_3 ,KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQL, KC_BSPC, KC_DEL,\ 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,\ - TT_SYM, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,\ + TT_MOV, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, 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, KC_UP, KC_PGDN,\ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RGUI,TT_SYM,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT + KC_LCTL, KC_LGUI, KC_LALT, KC_FN1, KC_RGUI,TT_SYM,KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT ), [_CDH] = KEYMAP (\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ KC_ESC, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, ____, ____, ____,\ - TO_MOV, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, ____,\ - KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, ____,\ - ____, ____, ____ , TT_SYM, ____, ____, ____, ____, ____, ____ + TT_MOV, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, ____,\ + KC_LSFT, KC_Z, KC_X, KC_C, M(1), KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, ____,\ + ____, ____, ____ , KC_FN1, ____, ____, ____, ____, ____, ____ ), @@ -70,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, ____, KC_LEFT,KC_DOWN, KC_UP, KC_RIGHT, ____,____,____,\ + ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, KC_LEFT,KC_DOWN, KC_UP, KC_RIGHT, ____, ____,____,____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), @@ -87,6 +87,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM fn_actions[] = { +[1] = ACTION_LAYER_TAP_KEY(_SYM,KC_SPACE), +[2] = ACTION_LAYER_TAP_KEY(_MOV,KC_BSPC), }; const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) @@ -102,11 +104,21 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; - case KC_N: + case 1 : if(keyboard_report->mods & MOD_BIT(KC_LGUI) ) { - clear_keyboard_but_mods(); - register_code(KC_V); - } + if (record->event.pressed) { + clear_keyboard_but_mods(); + register_code(KC_V); + } else { + unregister_code(KC_V); + } + }else { + if (record->event.pressed) { + register_code(KC_D); + } else { + unregister_code(KC_D); + } + } break; -- cgit v1.2.3 From 748401e5c180e91181bc10a80491d7d5568c008a Mon Sep 17 00:00:00 2001 From: milestogo Date: Tue, 28 Feb 2017 21:53:42 -0800 Subject: keymap and C6 audio testing --- .../MS-sculpt-mobile/keymaps/milestogo/Makefile | 2 +- .../MS-sculpt-mobile/keymaps/milestogo/config.h | 1 - .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 150 +++++++++++++++++---- 3 files changed, 125 insertions(+), 28 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile index a82d80deee..1209ad7814 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/Makefile @@ -10,7 +10,7 @@ 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 = no # Audio output on port C6 +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. diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h index 8893d122e0..aaf0077b14 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h @@ -4,5 +4,4 @@ #include "../../config.h" // place overrides here - #endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c index 0551fbde72..244d52dc56 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -1,11 +1,26 @@ #include "MS-sculpt-mobile.h" +#include "action_layer.h" + +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif #define _QWR 0 -#define _CDH 1 -#define _SYM 2 -#define _MOV 3 -#define _NUM 4 -#define _TRAN 9 +#define _CDH 2 +#define _SYM 3 +#define _MOV 4 +#define _TRAN 5 + + +enum layer_keycodes { +QWR, +CDH, +SYM, +MOV, +NUM, +TRAN +}; + // Shorter spacing #define XXXX KC_NO @@ -15,31 +30,36 @@ /* Fn Keys */ #define TT_SYM MO(_SYM) -#define TO_CDH TG(_CDH) #define TT_MOV KC_FN2 #define TT_NUM MO(_NUM) #define SSFT ACTION_MODS_ONESHOT(MOD_LSFT) +enum macro_keycodes { +DHPASTE=1, +VIBRK, +TO_CDH, +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* QWERTY * -* |ESC | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10| F11| F12|Vol-|Vol+|Mute| +* |ESC | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10| F11| F12|Vol-|Vol+|_CDH| * -------------------------------------------------------------------------------' -* | ~ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del | -* -------------------------------------------------------------------------- -* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | | +* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del| +* --------------------------------------------------------------------------- +* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | | * -------------------------------------------------------------------------------' -* | caps | a | s | d | f | g | h | j | k | l | ; | ' | enter |PgUp| +* |Bak/Mov| a | s | d | f | g | h | j | k | l | ; | ' | enter |PgUp| * -------------------------------------------------------------------------------- * |Lsft | z | x | c | v | b | n | m | , | . | / | Rsft| Up| PgDn| * --------------------------------------------------------------------------------- -* |Lctl |Lgui |Lalt | Space |Ralt | FN | Rctl |Left|Down|Rght| +* |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght| * --------------------------------------------------------------------------------- */ [_QWR] = KEYMAP( \ - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_VOLU, TO_CDH,\ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_VOLU, CDH,\ KC_ESC, KC_1, KC_2, KC_3 ,KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQL, KC_BSPC, KC_DEL,\ 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,\ TT_MOV, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,\ @@ -48,29 +68,46 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_CDH] = KEYMAP (\ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, QWR, \ KC_ESC, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, ____, ____, ____,\ TT_MOV, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, ____,\ - KC_LSFT, KC_Z, KC_X, KC_C, M(1), KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, ____,\ + KC_LSFT, KC_Z, KC_X, KC_C, M(DHPASTE), KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, ____,\ ____, ____, ____ , KC_FN1, ____, ____, ____, ____, ____, ____ ), + +/* SYM +* +* |ESC | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10| F11| F12|Vol-|Vol+|_CDH| +* -------------------------------------------------------------------------------' +* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace|Del | +* -------------------------------------------------------------------------- +* | ESC: | ^ | { | } | @ | % | | [ | ( | ) | _ | [ | ] | \ | | +* -------------------------------------------------------------------------------' +* |Bak/Mov| ! | # | 0 | = | | * | - | 1 | + | ] | ` | enter |PgUp| +* -------------------------------------------------------------------------------- +* |Lsft | ; | ~ | : | ~ | "|"| $ | ~ | | | / | Rsft| Up| PgDn| +* --------------------------------------------------------------------------------- +* |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght| +* --------------------------------------------------------------------------------- +*/ + [_SYM] = KEYMAP (\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\ - ____, KC_EXLM, KC_HASH, KC_0, KC_EQL, ____, KC_ASTR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\ - ____, ____, ____, ____, KC_TILDE, KC_PIPE, KC_DLR, ____, ____, ____, ____, ____, ____, ____,\ + M(VIBRK), KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\ + ____, KC_EXLM, KC_HASH, KC_0, KC_EQL, ____, KC_ASTR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\ + ____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_TILDE,____, ____, KC_SLSH, ____, ____, ____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), [_MOV] = KEYMAP (\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, KC_LEFT,KC_DOWN, KC_UP, KC_RIGHT, ____, ____,____,____,\ + ____, ____,RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, ____, KC_UP, ____, ____, ____, ____, ____, \ + ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, ____, KC_LEFT,KC_DOWN, KC_RIGHT, ____, ____,____,____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), @@ -88,9 +125,54 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_TAP_KEY(_SYM,KC_SPACE), -[2] = ACTION_LAYER_TAP_KEY(_MOV,KC_BSPC), +[2] = ACTION_LAYER_TAP_KEY(_MOV,KC_BSPC) }; +#ifdef AUDIO_ENABLE + +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWR: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + layer_off(_CDH); + } + return false; + break; + + case CDH: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + layer_on(_CDH); + } + return false; + break; + + case SYM: + if (record->event.pressed) { + layer_on(_SYM); + } else { + layer_off(_SYM); + } + return false; + break; + + } + return true; + +} + + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function @@ -104,7 +186,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; - case 1 : + case DHPASTE: if(keyboard_report->mods & MOD_BIT(KC_LGUI) ) { if (record->event.pressed) { clear_keyboard_but_mods(); @@ -121,12 +203,29 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; - + case VIBRK: // vi esc: + if (record->event.pressed) { + return MACRO( T(E),D(LSFT),T(SCLN),U(LSFT), END ); + } + break; } + + return MACRO_NONE; }; +#ifdef AUDIO_ENABLE + + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} +#endif + + void matrix_init_user(void) { } @@ -135,10 +234,9 @@ void matrix_scan_user(void) { } -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} void led_set_user(uint8_t usb_led) { } + + -- cgit v1.2.3 From 0834c520c0c4adf0d4f59f4b149116b95726aec6 Mon Sep 17 00:00:00 2001 From: milestogo Date: Tue, 28 Feb 2017 21:54:35 -0800 Subject: missed config.h stuck modifiers change --- keyboards/handwired/MS-sculpt-mobile/config.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/config.h b/keyboards/handwired/MS-sculpt-mobile/config.h index 1ac40f9964..d85c5c6233 100644 --- a/keyboards/handwired/MS-sculpt-mobile/config.h +++ b/keyboards/handwired/MS-sculpt-mobile/config.h @@ -24,7 +24,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 -#define MANUFACTURER Microsoft+abit +#define MANUFACTURER Microsoftplus #define PRODUCT sculpt mobile #define DESCRIPTION 6000 @@ -44,7 +44,7 @@ along with this program. If not, see . /* 0 1 2 3 4 5 6 7 */ #define MATRIX_ROW_PINS { F7,F6,F4,F5,F3,F2,F1,F0} /* A B C D E F G H I J K L M N O P Q R */ -#define MATRIX_COL_PINS { B7, D0, D1, D2, D3, D4, D5, D6, D7, E0,E1,C1, C0, C3, C2, C5, C4,C6} +#define MATRIX_COL_PINS { B7, D0, D1, D2, D3, D4, D5, D6, D7, E0,E1,C1, C0, C3, C2, C5, C4,C7} #define UNUSED_PINS { B6,B5,B4,B3,B2,B1,B0 } @@ -96,4 +96,6 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION +#define PREVENT_STUCK_MODIFIERS + #endif -- cgit v1.2.3 From b80c97b712de41871be1a25a30d6ec838ea9eda3 Mon Sep 17 00:00:00 2001 From: milestogo Date: Tue, 28 Feb 2017 23:27:49 -0800 Subject: clean up babblepaste --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 468 ++++++++++++++++++++ keyboards/handwired/MS-sculpt-mobile/babblePaste.h | 72 +++ .../handwired/MS-sculpt-mobile/babblePaste.txt | 489 +++++++++++++++++++++ 3 files changed, 1029 insertions(+) create mode 100644 keyboards/handwired/MS-sculpt-mobile/babblePaste.c create mode 100644 keyboards/handwired/MS-sculpt-mobile/babblePaste.h create mode 100644 keyboards/handwired/MS-sculpt-mobile/babblePaste.txt (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c new file mode 100644 index 0000000000..00e8416f41 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -0,0 +1,468 @@ +/* A library to output the right key shortcut in any common app. +Given a global variable babble_mode to show the environment and a +key that calls the paste macro, do the right type of paste. +Setting the context is done by another macro, or TBD interaction with the host. + +Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts +and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c +*/ + +#include "babblePaste.h" +#include "action_layer.h" + +// GLOBAL variable. Sets startup default if no eeppom +char babble_mode = MAC_MODE ; + + +const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { + + switch(babble_mode) { + +#ifdef MS_MODE + case MS_MODE: + switch(shortcut) { + + case BABL_DEL_RIGHT_1C: + return (static macro_t *) MACRO( D(DEL), END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); + case BABL_GO_START_LINE: + return MACRO( T(HOME), END ); + case BABL_GO_START_DOC: + return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); + case BABL_GO_END_LINE: + return MACRO( T(END), END ); + case BABL_GO_END_DOC: + return MACRO( D(LCTRL),T(END), U(LCTRL),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); +#ifndef BABL_MOVEMENTONLY + case BABL_UNDO: + return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); + case BABL_REDO: + return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); + case BABL_CUT: + return MACRO( D(LCTRL), T(X), U(LCTRL), END ); + case BABL_COPY: + return MACRO( D(LCTRL), T(C), U(LCTRL), END ); + case BABL_PASTE: + return MACRO( D(LCTRL), T(V), U(LCTRL), END ); + case BABL_SELECT_ALL: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_UNDO: + return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); + case BABL_REDO: + return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); + case BABL_CUT: + return MACRO( D(LCTRL), T(X), U(LCTRL), END ); + case BABL_COPY: + return MACRO( D(LCTRL), T(C), U(LCTRL), END ); + case BABL_PASTE: + return MACRO( D(LCTRL), T(V), U(LCTRL), END ); + case BABL_SELECT_ALL: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_FIND: + return MACRO( D(LCTRL),T(F), U(LCTRL),END ); + case BABL_FIND_NEXT: + return MACRO( T(F3),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LCTRL),T(H), U(LCTRL),END ); + case BABL_RUNAPP: + return MACRO( D(LGUI),T(R), U(LGUI),END ); + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LALT),T(TAB), U(LALT),END ); + case BABL_SWITCH_APP_LAST: + return MACRO( D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); + case BABL_CLOSE_APP: + return MACRO( D(LALT),T(F4), U(LALT),END ); + case BABL_HELP: + return MACRO( T(F1),END ); +#endif + break; + + return MACRO_NONE; + } + +#endif +#ifdef LINUX_MODE + case LINUX_MODE: + switch(shortcut) { + + case BABL_DEL_RIGHT_1C: + return MACRO( D(DEL), END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); + case BABL_GO_START_LINE: + return MACRO( T(HOME), END ); + case BABL_GO_START_DOC: + return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); + case BABL_GO_END_LINE: + return MACRO( T(END), END ); + case BABL_GO_END_DOC: + return MACRO( D(LCTRL),T(END), U(LCTRL),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); +#ifndef BABL_MOVEMENTONLY + case BABL_UNDO: + return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); + case BABL_REDO: + return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); + case BABL_CUT: + return MACRO( D(LCTRL), T(X), U(LCTRL), END ); + case BABL_COPY: + return MACRO( D(LCTRL), T(C), U(LCTRL), END ); + case BABL_PASTE: + return MACRO( D(LCTRL), T(V), U(LCTRL), END ); + case BABL_SELECT_ALL: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + + case BABL_FIND: + return MACRO( D(LCTRL),T(F), U(LCTRL),END ); + case BABL_FIND_NEXT: + /* return MACRO( T(F3),END ); KDE */ + return MACRO( D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ + case BABL_FIND_REPLACE: + /* return MACRO( D(LCTRL),T(R), U(LCTRL),END ); KDE */ + return MACRO( D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ + case BABL_RUNAPP: + return MACRO( D(LALT),T(F2), U(LALT),END ); + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LCTL),T(TAB), U(LCTL),END ); + case BABL_SWITCH_APP_LAST: + return MACRO( D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); + case BABL_CLOSE_APP: + return MACRO( D(LALT),T(F4), U(LALT),END ); + case BABL_HELP: + return MACRO_NONE; +#endif + break; + + return MACRO_NONE; + } + +#endif + +#ifdef MAC_MODE + case MAC_MODE: + switch(shortcut) { + + + case BABL_DEL_RIGHT_1C: + return MACRO( D(DEL), END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LALT), T(BSPACE), U(LALT), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LALT), T(DEL), U(LALT), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LALT), T(LEFT), U(LALT), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LALT), T(RIGHT), U(LALT), END ); + case BABL_GO_START_LINE: + return MACRO( D(LGUI), T(LEFT), U(LGUI), END ); + case BABL_GO_START_DOC: + return MACRO( D(LGUI),T(UP), U(LGUI),END ); + case BABL_GO_END_LINE: + return MACRO( D(LGUI), T(RIGHT), U(LGUI), END ); + case BABL_GO_END_DOC: + return MACRO( D(LGUI),T(DOWN), U(LGUI),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( D(LALT), T(DOWN), U(LALT), END ); + case BABL_PGUP: + return MACRO( D(LALT), T(UP), U(LALT), END ); +#ifndef BABL_MOVEMENTONLY + case BABL_UNDO: + return MACRO( D(LGUI), T(Z), U(LGUI), END ); + case BABL_REDO: + return MACRO( D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); + case BABL_CUT: + return MACRO( D(LGUI), T(X), U(LGUI), END ); + case BABL_COPY: + return MACRO( D(LGUI), T(C), U(LGUI), END ); + case BABL_PASTE: + return MACRO( D(LGUI), T(V), U(LGUI), END ); + case BABL_SELECT_ALL: + return MACRO( D(LGUI), T(A), U(LGUI), END ); + case BABL_FIND: + return MACRO( D(LGUI),T(F), U(LGUI),END ); + case BABL_FIND_NEXT: + return MACRO( D(LGUI),T(G), U(LGUI),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LGUI),T(F), U(LGUI),END ); + case BABL_RUNAPP: + return MACRO( D(LGUI),T(R), U(LGUI),END ); + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LGUI),T(TAB), U(LGUI),END ); + case BABL_SWITCH_APP_LAST: + return MACRO( D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); + case BABL_CLOSE_APP: + return MACRO( D(LGUI),T(Q), U(LGUI),END ); + case BABL_HELP: + return MACRO( D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); +#endif + break; + + return MACRO_NONE; + } + +#endif + +#ifdef EMACS_MODE + case EMACS_MODE: + switch(shortcut) { +//probably should allow meta to not be ALT + + case BABL_DEL_RIGHT_1C: + return MACRO( D(LCTL), T(D), U(LCTL),END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTL), T(BSPACE), U(LCTL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LALT), T(D), U(LALT), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LALT), T(B), U(LALT), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LALT), T(F), U(LALT), END ); + case BABL_GO_START_LINE: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_GO_START_DOC: + return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + case BABL_GO_END_LINE: + return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + case BABL_GO_END_DOC: + return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); + case BABL_GO_NEXT_LINE: + return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + case BABL_GO_PREV_LINE: + return MACRO( D(LCTRL), T(P), U(LCTRL), END ); + case BABL_PGDN: + return MACRO(D(LCTRL), T(V), U(LCTRL), END ); + case BABL_PGUP: + return MACRO( D(LALT), T(V), U(LALT), END ); +#ifndef BABL_MOVEMENTONLY + case BABL_UNDO: + return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); + case BABL_REDO: + return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + case BABL_CUT: + return MACRO( D(LCTL), T(W), U(LCTL), END ); + case BABL_COPY: + return MACRO( D(LALT), T(W), U(LALT), END ); //really? + case BABL_PASTE: + return MACRO( D(LCTL), T(Y), U(LCTL), END ); + case BABL_SELECT_ALL: + return MACRO(D(LCTL), T(X), U(LCTL),T(H), END ); + case BABL_FIND: + return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + case BABL_FIND_NEXT: + return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + case BABL_RUNAPP: + return MACRO( D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably + case BABL_SWITCH_APP_LAST: + return MACRO( D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably + case BABL_CLOSE_APP: + return MACRO(D(LCTL), T(X), U(LCTL),T(C),END ); + case BABL_HELP: + return MACRO( D(LCTL),T(H), U(LCTL),T(A),END); // start search in help +#endif + break; + + return MACRO_NONE; + } + +#endif +#ifdef VI_MODE + case VI_MODE: + switch(shortcut) { +//assume esc is already called + + case BABL_DEL_RIGHT_1C: + return MACRO( T(X),END ); + case BABL_DEL_LEFT_WORD: + return MACRO( T(D),T(G),T(E),END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( T(D),T(W),END ); + case BABL_GO_LEFT_1C: + return MACRO( T(H), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(L), END ); + case BABL_GO_LEFT_WORD: + return MACRO( T(B),END ); + case BABL_GO_RIGHT_WORD: + return MACRO( T(W), END ); + case BABL_GO_START_LINE: + return MACRO( D(LSFT), T(6),U(LSFT), END ); //^ + case BABL_GO_START_DOC: + return MACRO( T(G),T(G) ,END ); + case BABL_GO_END_LINE: + return MACRO( D(LSFT), T(4),U(LSFT) , END ); //$ + case BABL_GO_END_DOC: + return MACRO( D(LSFT), T(G),U(LSFT),END ); + case BABL_GO_NEXT_LINE: + return MACRO( T(J), END ); + case BABL_GO_PREV_LINE: + return MACRO( T(K), END ); + case BABL_PGDN: + return MACRO(D(LCTRL), T(F), U(LCTRL), END ); + case BABL_PGUP: + return MACRO( D(LCTRL), T(B), U(LCTRL), END ); +#ifndef BABL_MOVEMENTONLY + case BABL_UNDO: + return MACRO( T(U), END ); + case BABL_REDO: + return MACRO( D(LCTL), T(R), U(LCTL), END ); + case BABL_CUT: + return MACRO( T(X), END ); + case BABL_COPY: + return MACRO( T(Y),END ); + case BABL_PASTE: + return MACRO( T(P), END ); + case BABL_SELECT_ALL: + return MACRO( D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful? + case BABL_FIND: + return MACRO( T(SLASH),END ); + case BABL_FIND_NEXT: + return MACRO( T(N),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + case BABL_RUNAPP: + return MACRO_NONE; + case BABL_SWITCH_APP_NEXT: + return MACRO_NONE; + case BABL_SWITCH_APP_LAST: + return MACRO_NONE; + case BABL_CLOSE_APP: + return MACRO(D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); + case BABL_HELP: + return MACRO(D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help + break; +#endif + return MACRO_NONE; + } + +#endif +#ifdef READMUX_MODE +// Readline command line editing + tmux windowing +// I havent decided how much to do readline and how much tmux + case READMUX_MODE: + switch(shortcut) { + + case BABL_DEL_RIGHT_1C: + return MACRO( D(LCTL), T(D), U(LCTL),END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTL), T(W), U(LCTL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LALT), T(D), U(LALT), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LALT), T(B), U(LALT), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LALT), T(F), U(LALT), END ); + case BABL_GO_START_LINE: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_GO_START_DOC: + return MACRO_NONE; // tmux? + case BABL_GO_END_LINE: + return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + case BABL_GO_END_DOC: + return MACRO_NONE; // tmux? + case BABL_GO_NEXT_LINE: + return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + case BABL_GO_PREV_LINE: + return MACRO( D(LCTRL), T(P), U(LCTRL), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); +#ifndef BABL_MOVEMENTONLY + case BABL_UNDO: + return MACRO( D(LALT), T(R), U(LALT) , END ); + case BABL_REDO: + return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + case BABL_CUT: + return MACRO( D(LCTL), T(K), U(LCTL), END ); // wrong half the time + case BABL_COPY: + return MACRO_NONE; + case BABL_PASTE: + return MACRO( D(LCTL), T(Y), U(LCTL), END ); + case BABL_SELECT_ALL: + return MACRO(D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); + case BABL_FIND: + return MACRO( D(LCTRL), T(R), U(LCTRL), END ); // search history + case BABL_FIND_NEXT: + eturn MACRO( D(LCTRL), T(S), U(LCTRL), END ); + case BABL_FIND_REPLACE: + return MACRO_NONE; // tmux? + case BABL_RUNAPP: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux + case BABL_SWITCH_APP_LAST: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux + case BABL_CLOSE_APP: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want + break; + case BABL_HELP: + return MACRO_NONE; +#endif + break; + + return MACRO_NONE; + } + +#endif + return MACRO_NONE; + } + + +} + diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h new file mode 100644 index 0000000000..63b79a2055 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h @@ -0,0 +1,72 @@ +/* A library to output the right key shortcut in any common app. +Given a global variable babble_mode to show the environment and a +key that calls the paste macro, do the right type of paste. + +Setting the bable_mode is done by another macro, or TBD interaction with the host. + +Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts +and jeebak & algernon's keymap +*/ +#ifndef _babblePaste_h_included__ +#define _babblePaste_h_included__ + + +/* Add this to your config.h +// Uncomment any modes you want. +// Windows. +//#define MS_MODE 0 +//#define MAC_MODE 1 +//aka gnome+KDE +//#define LINUX_MODE 2 +//#define EMACS_MODE 3 +//#define VI_MODE 4 +//#define WORDSTAR_MODE 5 +// Readline and tmux +//#define READMUX 6 +*/ + +/* Macros handled by babblepaste. Most should be available for all platforms. */ +enum { + + // Movement + BABL_DEL_RIGHT_1C=200, + BABL_DEL_LEFT_WORD, + BABL_DEL_RIGHT_WORD, + BABL_GO_LEFT_1C, + BABL_GO_RIGHT_1C, + BABL_GO_LEFT_WORD, + BABL_GO_RIGHT_WORD, + BABL_GO_START_LINE, + BABL_GO_END_LINE, + BABL_GO_START_DOC, + BABL_GO_END_DOC, + BABL_GO_NEXT_LINE, + BABL_GO_PREV_LINE, + BABL_PGDN, + BABL_PGUP, +#ifndef BABL_MOVEMENTONLY + // Cut & Paste + BABL_UNDO, + BABL_REDO, + BABL_CUT, + BABL_COPY, + BABL_PASTE, + BABL_SELECT_ALL, + // GUI or app + BABL_FIND, + BABL_FIND_NEXT, + BABL_FIND_REPLACE, + BABL_RUNAPP, + BABL_SWITCH_APP_NEXT, + BABL_SWITCH_APP_LAST, // previous + BABL_CLOSE_APP, + BABL_HELP +#endif +}; + + + + +//static macro_t *babblePaste(keyrecord_t *record, uint16_t shortcut) + + #endif \ No newline at end of file diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt b/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt new file mode 100644 index 0000000000..6170ec7af5 --- /dev/null +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt @@ -0,0 +1,489 @@ +/* A library to output the right key shortcut in any common app. +Given a global variable babble_mode to show the environment and a +key that calls the paste macro, do the right type of paste. +Setting the context is done by another macro, or TBD interaction with the host. + +Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts +and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c +*/ + +#include "eeconfig.h" + + +// Comment out anything you will never use. +// Windows. +#define MS_MODE 0 +#define MAC_MODE 1 +//aka gnome+KDE +#define LINUX_MODE 2 +#define EMACS_MODE 3 +#define VI_MODE 4 +//#define WORDSTAR_MODE 5 +// Readline and tmux +#define READMUX 6 + +// GLOBAL variable. Sets startup default if no eeppom +char babble_mode = MAC_MODE ; + + +/* minimum set required for babble: + // Cut & Paste + BABL_UNDO + BABL_REDO + BABL_CUT + BABL_COPY + BABL_PASTE + BABL_SELECT_ALL + + // Movement + BABL_DEL_RIGHT_1C + BABL_DEL_RIGHT_1C + BABL_DEL_LEFT_WORD + BABL_DEL_RIGHT_WORD + BABL_GO_LEFT_1C + BABL_GO_LEFT_WORD + BABL_GO_RIGHT_WORD + BABL_GOTO_START_LINE + BABL_GOTO_START_DOC + BABL_GOTO_END_LINE + BABL_GOTO_END_DOC + BABL_GOTO_NEXT_LINE // down arrow will do. + BABL_GOTO_PREV_LINE // up arrow will do. + BABL_PGDN + BABL_PGUP + + // GUI + BABL_FIND + BABL_FIND_NEXT + BABL_FIND_REPLACE + BABL_RUNAPP + BABL_SWITCH_NEXT + BABL_SWITCH_LAST // previous + BABL_CLOSE_APP + BABL_HELP +*/ + + + + +static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { + + switch(babble_mode) { + +#ifdef MS_MODE + case MS_MODE: + switch(shortcut) { + + case BABL_UNDO: + return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); + case BABL_REDO: + return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); + case BABL_CUT: + return MACRO( D(LCTRL), T(X), U(LCTRL), END ); + case BABL_COPY: + return MACRO( D(LCTRL), T(C), U(LCTRL), END ); + case BABL_PASTE: + return MACRO( D(LCTRL), T(V), U(LCTRL), END ); + case BABL_SELECT_ALL: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_DEL_RIGHT_1C: + return MACRO( D(DEL), END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); + case BABL_GOTO_START_LINE: + return MACRO( T(HOME), END ); + case BABL_GOTO_START_DOC: + return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); + case BABL_GOTO_END_LINE: + return MACRO( T(END), END ); + case BABL_GOTO_END_DOC: + return MACRO( D(LCTRL),T(END), U(LCTRL),END ); + case BABL_GOTO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GOTO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); + case BABL_FIND: + return MACRO( D(LCTRL),T(F), U(LCTRL),END ); + case BABL_FIND_NEXT: + return MACRO( T(F3),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LCTRL),T(H), U(LCTRL),END ); + case BABL_RUNAPP: + return MACRO( D(LGUI),T(R), U(LGUI),END ); + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LALT),T(TAB), U(LALT),END ); + case BABL_SWITCH_APP_LAST: + return MACRO( D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); + case BABL_CLOSE_APP: + return MACRO( D(LALT),T(F4), U(LALT),END ); + case BABL_HELP: + return MACRO( T(F1),END ); + break; + + return MACRO_NONE; + } + +#endif +#ifdef LINUX_MODE + case LINUX_MODE: + switch(shortcut) { + + case BABL_UNDO: + return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); + case BABL_REDO: + return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); + case BABL_CUT: + return MACRO( D(LCTRL), T(X), U(LCTRL), END ); + case BABL_COPY: + return MACRO( D(LCTRL), T(C), U(LCTRL), END ); + case BABL_PASTE: + return MACRO( D(LCTRL), T(V), U(LCTRL), END ); + case BABL_SELECT_ALL: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_DEL_RIGHT_1C: + return MACRO( D(DEL), END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); + case BABL_GOTO_START_LINE: + return MACRO( T(HOME), END ); + case BABL_GOTO_START_DOC: + return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); + case BABL_GOTO_END_LINE: + return MACRO( T(END), END ); + case BABL_GOTO_END_DOC: + return MACRO( D(LCTRL),T(END), U(LCTRL),END ); + case BABL_GOTO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GOTO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); + case BABL_FIND: + return MACRO( D(LCTRL),T(F), U(LCTRL),END ); + case BABL_FIND_NEXT: + /* return MACRO( T(F3),END ); KDE */ + return MACRO( D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ + case BABL_FIND_REPLACE: + /* return MACRO( D(LCTRL),T(R), U(LCTRL),END ); KDE */ + return MACRO( D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ + case BABL_RUNAPP: + return MACRO( D(LALT),T(F2), U(LALT),END ); + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LCTL),T(TAB), U(LCTL),END ); + case BABL_SWITCH_APP_LAST: + return MACRO( D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); + case BABL_CLOSE_APP: + return MACRO( D(LALT),T(F4), U(LALT),END ); + case BABL_HELP: + return MACRO_NONE; + break; + + return MACRO_NONE; + } + +#endif + + + +#ifdef MAC_MODE + case MAC_MODE: + switch(shortcut) { + + case BABL_UNDO: + return MACRO( D(LGUI), T(Z), U(LGUI), END ); + case BABL_REDO: + return MACRO( D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); + case BABL_CUT: + return MACRO( D(LGUI), T(X), U(LGUI), END ); + case BABL_COPY: + return MACRO( D(LGUI), T(C), U(LGUI), END ); + case BABL_PASTE: + return MACRO( D(LGUI), T(V), U(LGUI), END ); + case BABL_SELECT_ALL: + return MACRO( D(LGUI), T(A), U(LGUI), END ); + case BABL_DEL_RIGHT_1C: + return MACRO( D(DEL), END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LALT), T(BSPACE), U(LALT), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LALT), T(DEL), U(LALT), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LALT), T(LEFT), U(LALT), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LALT), T(RIGHT), U(LALT), END ); + case BABL_GOTO_START_LINE: + return MACRO( D(LGUI), T(LEFT), U(LGUI), END ); + case BABL_GOTO_START_DOC: + return MACRO( D(LGUI),T(UP), U(LGUI),END ); + case BABL_GOTO_END_LINE: + return MACRO( D(LGUI), T(RIGHT), U(LGUI), END ); + case BABL_GOTO_END_DOC: + return MACRO( D(LGUI),T(DOWN), U(LGUI),END ); + case BABL_GOTO_NEXT_LINE: + return MACRO( T(DOWN), END ); + case BABL_GOTO_PREV_LINE: + return MACRO( T(UP), END ); + case BABL_PGDN: + return MACRO( D(LALT), T(DOWN), U(LALT), END ); + case BABL_PGUP: + return MACRO( D(LALT), T(UP), U(LALT), END ); + case BABL_FIND: + return MACRO( D(LGUI),T(F), U(LGUI),END ); + case BABL_FIND_NEXT: + return MACRO( D(LGUI),T(G), U(LGUI),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LGUI),T(F), U(LGUI),END ); + case BABL_RUNAPP: + return MACRO( D(LGUI),T(R), U(LGUI),END ); + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LGUI),T(TAB), U(LGUI),END ); + case BABL_SWITCH_APP_LAST: + return MACRO( D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); + case BABL_CLOSE_APP: + return MACRO( D(LGUI),T(Q), U(LGUI),END ); + case BABL_HELP: + return MACRO( D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); + break; + + return MACRO_NONE; + } + +#endif + +#ifdef EMACS_MODE + case EMACS_MODE: + switch(shortcut) { +//probably should allow meta to not be ALT + case BABL_UNDO: + return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); + case BABL_REDO: + return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + case BABL_CUT: + return MACRO( D(LCTL), T(W), U(LCTL), END ); + case BABL_COPY: + return MACRO( D(LALT), T(W), U(LALT), END ); + case BABL_PASTE: + return MACRO( D(LCTL), T(Y), U(LCTL), END ); + case BABL_SELECT_ALL: + return MACRO(D(LCTL), T(X), U(LCTL),T(H), END ); + case BABL_DEL_RIGHT_1C: + return MACRO( D(LCTL), T(D), U(LCTL),END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTL), T(BSPACE), U(LCTL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LALT), T(D), U(LALT), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LALT), T(B), U(LALT), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LALT), T(F), U(LALT), END ); + case BABL_GOTO_START_LINE: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_GOTO_START_DOC: + return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + case BABL_GOTO_END_LINE: + return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + case BABL_GOTO_END_DOC: + return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); + case BABL_GOTO_NEXT_LINE: + return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + case BABL_GOTO_PREV_LINE: + rreturn MACRO( D(LCTRL), T(P), U(LCTRL), END ); + case BABL_PGDN: + return MACRO(D(LCTRL), T(V), U(LCTRL), END ); + case BABL_PGUP: + return MACRO( D(LALT), T(V), U(LALT), END ); + case BABL_FIND: + return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + case BABL_FIND_NEXT: + return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + case BABL_RUNAPP: + return MACRO( D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably + case BABL_SWITCH_APP_LAST: + return MACRO( D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably + case BABL_CLOSE_APP: + return MACRO(D(LCTL), T(X), U(LCTL),T(C),END ); + case BABL_HELP: + return MACRO( D(LCTL),T(H), U(LCTL),T(A),END); // start search in help + break; + + return MACRO_NONE; + } + +#endif +#ifdef VI_MODE + case VI_MODE: + switch(shortcut) { +//assume esc is already called + case BABL_UNDO: + return MACRO( T(U), END ); + case BABL_REDO: + return MACRO( D(LCTL), T(R), U(LCTL), END ); + case BABL_CUT: + return MACRO( T(X), END ); + case BABL_COPY: + return MACRO( T(Y),END ); + case BABL_PASTE: + return MACRO( T(P), END ); + case BABL_SELECT_ALL: + return MACRO( T(COLN),T(PERC),T(Y), END ); // wrong but helpful? + case BABL_DEL_RIGHT_1C: + return MACRO( T(X),END ); + case BABL_DEL_LEFT_WORD: + return MACRO( T(D),T(G),T(E),END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( T(D),T(W),END ); + case BABL_GO_LEFT_1C: + return MACRO( T(H), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(L), END ); + case BABL_GO_LEFT_WORD: + return MACRO( T(B),END ); + case BABL_GO_RIGHT_WORD: + return MACRO( T(W), END ); + case BABL_GOTO_START_LINE: + return MACRO( T(CIRC), END ); + case BABL_GOTO_START_DOC: + return MACRO( T(G),T(G) ,END ); + case BABL_GOTO_END_LINE: + return MACRO( T(DLR), END ); + case BABL_GOTO_END_DOC: + return MACRO( D(LSFT), T(G),U(LSFT), ,END ); + case BABL_GOTO_NEXT_LINE: + return MACRO( T(J), END ); + case BABL_GOTO_PREV_LINE: + rreturn MACRO( T(K), END ); + case BABL_PGDN: + return MACRO(D(LCTRL), T(F), U(LCTRL), END ); + case BABL_PGUP: + return MACRO( D(LCTRL), T(B), U(LCTRL), END ); + case BABL_FIND: + return MACRO( T(SLASH),END ); + case BABL_FIND_NEXT: + return MACRO( T(N),END ); + case BABL_FIND_REPLACE: + return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + case BABL_RUNAPP: + return MACRO_NONE; + case BABL_SWITCH_APP_NEXT: + return MACRO_NONE; + case BABL_SWITCH_APP_LAST: + return MACRO_NONE; + case BABL_CLOSE_APP: + return MACRO(T(COLN), T(Q), T(EXLM),END ); + case BABL_HELP: + return MACRO(T(COLN),T(H),END); // start search in help + break; + + return MACRO_NONE; + } + +#endif +#ifdef READMUX_MODE +// I havent decided how much to do bash and how much tmux + case READMUX_MODE: + switch(shortcut) { + case BABL_UNDO: + return MACRO( D(LALT), T(R), U(LALT) , END ); + case BABL_REDO: + return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + case BABL_CUT: + return MACRO( D(LCTL), T(K), U(LCTL), END ); // wrong half the time + case BABL_COPY: + return MACRO_NONE; + case BABL_PASTE: + return MACRO( D(LCTL), T(Y), U(LCTL), END ); + case BABL_SELECT_ALL: + return MACRO(D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); // should this be tmux all? + case BABL_DEL_RIGHT_1C: + return MACRO( D(LCTL), T(D), U(LCTL),END ); + case BABL_DEL_LEFT_WORD: + return MACRO( D(LCTL), T(W), U(LCTL), END ); + case BABL_DEL_RIGHT_WORD: + return MACRO( D(LALT), T(D), U(LALT), END ); + case BABL_GO_LEFT_1C: + return MACRO( T(LEFT), END ); + case BABL_GO_RIGHT_1C: + return MACRO( T(RIGHT), END ); + case BABL_GO_LEFT_WORD: + return MACRO( D(LALT), T(B), U(LALT), END ); + case BABL_GO_RIGHT_WORD: + return MACRO( D(LALT), T(F), U(LALT), END ); + case BABL_GOTO_START_LINE: + return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + case BABL_GOTO_START_DOC: + return MACRO_NONE; // tmux? + case BABL_GOTO_END_LINE: + return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + case BABL_GOTO_END_DOC: + return MACRO_NONE; // tmux? + case BABL_GOTO_NEXT_LINE: + return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + case BABL_GOTO_PREV_LINE: + return MACRO( D(LCTRL), T(P), U(LCTRL), END ); + case BABL_PGDN: + return MACRO( T(PGDN), END ); + case BABL_PGUP: + return MACRO( T(PGUP), END ); + case BABL_FIND: + return MACRO( D(LCTRL), T(R), U(LCTRL), END ); // search history + case BABL_FIND_NEXT: + eturn MACRO( D(LCTRL), T(S), U(LCTRL), END ); + case BABL_FIND_REPLACE: + return MACRO_NONE; // tmux? + case BABL_RUNAPP: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux + case BABL_SWITCH_APP_NEXT: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux + case BABL_SWITCH_APP_LAST: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux + case BABL_CLOSE_APP: + return MACRO( D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want + break; + case BABL_HELP: + return MACRO_NONE; + break; + + return MACRO_NONE; + } + +#endif + return MACRO_NONE; +} \ No newline at end of file -- cgit v1.2.3 From 2f677c24a8fcf936e92a0a5acfbbf95b5f47fdb7 Mon Sep 17 00:00:00 2001 From: milestogo Date: Mon, 6 Mar 2017 00:16:44 -0800 Subject: working with preprocessor macros for babblepaste --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 609 ++++++++------------- keyboards/handwired/MS-sculpt-mobile/babblePaste.h | 57 +- .../MS-sculpt-mobile/keymaps/milestogo/config.h | 20 + .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 136 +++-- keyboards/handwired/MS-sculpt-mobile/rules.mk | 4 + 5 files changed, 395 insertions(+), 431 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c index 00e8416f41..93ff486e0d 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -8,242 +8,159 @@ and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jee */ #include "babblePaste.h" -#include "action_layer.h" +#include "action_macro.h" -// GLOBAL variable. Sets startup default if no eeppom -char babble_mode = MAC_MODE ; +#ifdef USE_BABLPASTE +// GLOBAL variable to determine mode. Sets startup default if no eeppom +uint8_t babble_mode =0 ; -const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { + +// Today I learned that the preprocessor can not create a switch statement label from an argument +// And else statements have problems, see https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html#SEC15 +#define BABLM(ent, macro...) \ + if ( ent == shortcut ) \ + { action_macro_play( MACRO(macro)); return MACRO_NONE; } - switch(babble_mode) { - + +const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { +/* this function runs the appropriate babblepaste macro, given +the global babble_mode, and a shortcut from the ENUM in babblePaste.h +TODO, the pointers in this function should be stored in a PROGMEM array, not ram. +But that requires even more clever preprocessor foo. +*/ + + if ( shortcut < BABL_START_NUM || \ + shortcut >= (BABL_START_NUM + BABL_NUM_MACROS ) ) { + return MACRO_NONE; + } + + + switch(babble_mode) { + #ifdef MS_MODE - case MS_MODE: - switch(shortcut) { - - case BABL_DEL_RIGHT_1C: - return (static macro_t *) MACRO( D(DEL), END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); - case BABL_GO_START_LINE: - return MACRO( T(HOME), END ); - case BABL_GO_START_DOC: - return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); - case BABL_GO_END_LINE: - return MACRO( T(END), END ); - case BABL_GO_END_DOC: - return MACRO( D(LCTRL),T(END), U(LCTRL),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); + + case MS_MODE: + BABLM( BABL_DEL_RIGHT_1C, T(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD, D(LCTRL), T(BSPACE), U(LCTRL), END ); + BABLM( BABL_DEL_RIGHT_WORD,D(LCTRL), T(DEL), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD, D(LCTRL), T(LEFT), U(LCTRL), END ); + BABLM( BABL_GO_RIGHT_WORD, D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_START_LINE, T(HOME), END ); + BABLM( BABL_GO_START_DOC, D(LCTRL),T(HOME), U(LCTRL),END ); + BABLM( BABL_GO_END_LINE, T(END), END ); + BABLM( BABL_GO_END_DOC, D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_NEXT_LINE, T(DOWN), END ); + BABLM( BABL_GO_PREV_LINE, T(UP), END ); + BABLM( BABL_PGDN, T(PGDN), END ); + BABLM( BABL_PGUP, T(PGUP), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); - case BABL_REDO: - return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); - case BABL_CUT: - return MACRO( D(LCTRL), T(X), U(LCTRL), END ); - case BABL_COPY: - return MACRO( D(LCTRL), T(C), U(LCTRL), END ); - case BABL_PASTE: - return MACRO( D(LCTRL), T(V), U(LCTRL), END ); - case BABL_SELECT_ALL: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_UNDO: - return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); - case BABL_REDO: - return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); - case BABL_CUT: - return MACRO( D(LCTRL), T(X), U(LCTRL), END ); - case BABL_COPY: - return MACRO( D(LCTRL), T(C), U(LCTRL), END ); - case BABL_PASTE: - return MACRO( D(LCTRL), T(V), U(LCTRL), END ); - case BABL_SELECT_ALL: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_FIND: - return MACRO( D(LCTRL),T(F), U(LCTRL),END ); - case BABL_FIND_NEXT: - return MACRO( T(F3),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LCTRL),T(H), U(LCTRL),END ); - case BABL_RUNAPP: - return MACRO( D(LGUI),T(R), U(LGUI),END ); - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LALT),T(TAB), U(LALT),END ); - case BABL_SWITCH_APP_LAST: - return MACRO( D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); - case BABL_CLOSE_APP: - return MACRO( D(LALT),T(F4), U(LALT),END ); - case BABL_HELP: - return MACRO( T(F1),END ); + BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); + BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); + BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); + BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); + BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); + BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); + BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); + BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); + BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); + BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); + BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + BABLM( BABL_FIND_NEXT, T(F3),END ); + BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); + BABLM( BABL_RUNAPP, D(LGUI),T(R), U(LGUI),END ); + BABLM( BABL_SWITCH_APP_NEXT, D(LALT),T(TAB), U(LALT),END ); + BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); + BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); + BABLM( BABL_HELP, T(F1),END ); #endif - break; - - return MACRO_NONE; - } - -#endif + + + return MACRO_NONE; + + +#endif /* MS_MODE*/ + + #ifdef LINUX_MODE case LINUX_MODE: - switch(shortcut) { - - case BABL_DEL_RIGHT_1C: - return MACRO( D(DEL), END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); - case BABL_GO_START_LINE: - return MACRO( T(HOME), END ); - case BABL_GO_START_DOC: - return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); - case BABL_GO_END_LINE: - return MACRO( T(END), END ); - case BABL_GO_END_DOC: - return MACRO( D(LCTRL),T(END), U(LCTRL),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); + + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTRL), T(BSPACE), U(LCTRL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LCTRL), T(DEL), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LCTRL), T(LEFT), U(LCTRL), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_START_LINE , T(HOME), END ); + BABLM( BABL_GO_START_DOC , D(LCTRL),T(HOME), U(LCTRL),END ); + BABLM( BABL_GO_END_LINE , T(END), END ); + BABLM( BABL_GO_END_DOC , D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); + BABLM( BABL_GO_PREV_LINE , T(UP), END ); + BABLM( BABL_PGDN , T(PGDN), END ); + BABLM( BABL_PGUP , T(PGUP), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); - case BABL_REDO: - return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); - case BABL_CUT: - return MACRO( D(LCTRL), T(X), U(LCTRL), END ); - case BABL_COPY: - return MACRO( D(LCTRL), T(C), U(LCTRL), END ); - case BABL_PASTE: - return MACRO( D(LCTRL), T(V), U(LCTRL), END ); - case BABL_SELECT_ALL: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - - case BABL_FIND: - return MACRO( D(LCTRL),T(F), U(LCTRL),END ); - case BABL_FIND_NEXT: - /* return MACRO( T(F3),END ); KDE */ - return MACRO( D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ - case BABL_FIND_REPLACE: - /* return MACRO( D(LCTRL),T(R), U(LCTRL),END ); KDE */ - return MACRO( D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ - case BABL_RUNAPP: - return MACRO( D(LALT),T(F2), U(LALT),END ); - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LCTL),T(TAB), U(LCTL),END ); - case BABL_SWITCH_APP_LAST: - return MACRO( D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); - case BABL_CLOSE_APP: - return MACRO( D(LALT),T(F4), U(LALT),END ); - case BABL_HELP: - return MACRO_NONE; + BABLM( BABL_UNDO , D(LCTRL), T(Z), U(LCTRL), END ); + BABLM( BABL_REDO , D(LCTRL), T(Y), U(LCTRL), END ); + BABLM( BABL_CUT , D(LCTRL), T(X), U(LCTRL), END ); + BABLM( BABL_COPY , D(LCTRL), T(C), U(LCTRL), END ); + BABLM( BABL_PASTE , D(LCTRL), T(V), U(LCTRL), END ); + BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + /* BABLM(BABL_FIND_NEXT , T(F3),END ); KDE */ + BABLM( BABL_FIND_NEXT, D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ + /* BABLM( , D(LCTRL),T(R), U(LCTRL),END ); KDE */ + BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ + BABLM( BABL_RUNAPP, D(LALT),T(F2), U(LALT),END ); + BABLM( BABL_SWITCH_APP_NEXT, D(LCTL),T(TAB), U(LCTL),END ); + BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); + BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); + BABLM( BABL_HELP, END ); #endif - break; - return MACRO_NONE; - } #endif #ifdef MAC_MODE case MAC_MODE: - switch(shortcut) { - - - case BABL_DEL_RIGHT_1C: - return MACRO( D(DEL), END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LALT), T(BSPACE), U(LALT), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(DEL), U(LALT), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(LEFT), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(RIGHT), U(LALT), END ); - case BABL_GO_START_LINE: - return MACRO( D(LGUI), T(LEFT), U(LGUI), END ); - case BABL_GO_START_DOC: - return MACRO( D(LGUI),T(UP), U(LGUI),END ); - case BABL_GO_END_LINE: - return MACRO( D(LGUI), T(RIGHT), U(LGUI), END ); - case BABL_GO_END_DOC: - return MACRO( D(LGUI),T(DOWN), U(LGUI),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( D(LALT), T(DOWN), U(LALT), END ); - case BABL_PGUP: - return MACRO( D(LALT), T(UP), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END ); + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LALT), T(LEFT), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(RIGHT), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LGUI), T(LEFT), U(LGUI), END ); + BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END ); + BABLM( BABL_GO_END_LINE , D(LGUI), T(RIGHT), U(LGUI), END ); + BABLM( BABL_GO_END_DOC , D(LGUI),T(DOWN), U(LGUI),END ); + BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); + BABLM( BABL_GO_PREV_LINE , T(UP), END ); + BABLM( BABL_PGDN , D(LALT),T(DOWN), U(LALT), END ); + BABLM( BABL_PGUP , D(LALT),T(UP), U(LALT), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - return MACRO( D(LGUI), T(Z), U(LGUI), END ); - case BABL_REDO: - return MACRO( D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); - case BABL_CUT: - return MACRO( D(LGUI), T(X), U(LGUI), END ); - case BABL_COPY: - return MACRO( D(LGUI), T(C), U(LGUI), END ); - case BABL_PASTE: - return MACRO( D(LGUI), T(V), U(LGUI), END ); - case BABL_SELECT_ALL: - return MACRO( D(LGUI), T(A), U(LGUI), END ); - case BABL_FIND: - return MACRO( D(LGUI),T(F), U(LGUI),END ); - case BABL_FIND_NEXT: - return MACRO( D(LGUI),T(G), U(LGUI),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LGUI),T(F), U(LGUI),END ); - case BABL_RUNAPP: - return MACRO( D(LGUI),T(R), U(LGUI),END ); - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LGUI),T(TAB), U(LGUI),END ); - case BABL_SWITCH_APP_LAST: - return MACRO( D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); - case BABL_CLOSE_APP: - return MACRO( D(LGUI),T(Q), U(LGUI),END ); - case BABL_HELP: - return MACRO( D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); + BABLM( BABL_UNDO , D(1), D(LGUI), T(Z), U(LGUI), END ); + BABLM( BABL_REDO , D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); + BABLM( BABL_CUT , D(LGUI), T(X), U(LGUI), END ); + BABLM( BABL_COPY , D(LGUI), T(C), U(LGUI), END ); + BABLM( BABL_PASTE , D(LGUI), T(V), U(LGUI), END ); + BABLM( BABL_SELECT_ALL , D(LGUI), T(A), U(LGUI), END ); + BABLM( BABL_FIND , D(LGUI),T(F), U(LGUI),END ); + BABLM( BABL_FIND_NEXT, D(LGUI),T(G), U(LGUI),END ); + BABLM( BABL_FIND_REPLACE, D(LGUI),T(F), U(LGUI),END ); + BABLM( BABL_RUNAPP , D(LGUI),T(R), U(LGUI),END ); + BABLM( BABL_SWITCH_APP_NEXT , D(LGUI),T(TAB), U(LGUI),END ); + BABLM( BABL_SWITCH_APP_LAST , D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); + BABLM( BABL_CLOSE_APP , D(LGUI),T(Q), U(LGUI),END ); + BABLM( BABL_HELP , D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); #endif - break; - + return MACRO_NONE; - } - #endif #ifdef EMACS_MODE @@ -252,64 +169,64 @@ const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { //probably should allow meta to not be ALT case BABL_DEL_RIGHT_1C: - return MACRO( D(LCTL), T(D), U(LCTL),END ); + BABLM( , D(LCTL), T(D), U(LCTL),END ); case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( , D(LCTL), T(BSPACE), U(LCTL), END ); case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(D), U(LALT), END ); + BABLM( , D(LALT), T(D), U(LALT), END ); case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); + BABLM( , T(LEFT), END ); case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); + BABLM( , T(RIGHT), END ); case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(B), U(LALT), END ); + BABLM( , D(LALT), T(B), U(LALT), END ); case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(F), U(LALT), END ); + BABLM( , D(LALT), T(F), U(LALT), END ); case BABL_GO_START_LINE: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); + BABLM( , D(LCTRL), T(A), U(LCTRL), END ); case BABL_GO_START_DOC: - return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + BABLM( , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); case BABL_GO_END_LINE: - return MACRO( D(LCTRL), T(E), U(LCTRL), END ); + BABLM( , D(LCTRL), T(E), U(LCTRL), END ); case BABL_GO_END_DOC: - return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); + BABLM( , D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); case BABL_GO_NEXT_LINE: - return MACRO( D(LCTRL), T(N), U(LCTRL), END ); + BABLM( , D(LCTRL), T(N), U(LCTRL), END ); case BABL_GO_PREV_LINE: - return MACRO( D(LCTRL), T(P), U(LCTRL), END ); + BABLM( , D(LCTRL), T(P), U(LCTRL), END ); case BABL_PGDN: - return MACRO(D(LCTRL), T(V), U(LCTRL), END ); + BABLM( ,D(LCTRL), T(V), U(LCTRL), END ); case BABL_PGUP: - return MACRO( D(LALT), T(V), U(LALT), END ); + BABLM( , D(LALT), T(V), U(LALT), END ); #ifndef BABL_MOVEMENTONLY case BABL_UNDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); + BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); case BABL_REDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably case BABL_CUT: - return MACRO( D(LCTL), T(W), U(LCTL), END ); + BABLM( , D(LCTL), T(W), U(LCTL), END ); case BABL_COPY: - return MACRO( D(LALT), T(W), U(LALT), END ); //really? + BABLM( , D(LALT), T(W), U(LALT), END ); //really? case BABL_PASTE: - return MACRO( D(LCTL), T(Y), U(LCTL), END ); + BABLM( , D(LCTL), T(Y), U(LCTL), END ); case BABL_SELECT_ALL: - return MACRO(D(LCTL), T(X), U(LCTL),T(H), END ); + BABLM( ,D(LCTL), T(X), U(LCTL),T(H), END ); case BABL_FIND: - return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + BABLM( , D(LCTRL), T(S), U(LCTRL),END ); case BABL_FIND_NEXT: - return MACRO( D(LCTRL), T(S), U(LCTRL),END ); + BABLM( , D(LCTRL), T(S), U(LCTRL),END ); case BABL_FIND_REPLACE: - return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + BABLM( , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); case BABL_RUNAPP: - return MACRO( D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably + BABLM( , D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably case BABL_SWITCH_APP_NEXT: - return MACRO( D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably + BABLM( , D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably case BABL_SWITCH_APP_LAST: - return MACRO( D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably + BABLM( , D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably case BABL_CLOSE_APP: - return MACRO(D(LCTL), T(X), U(LCTL),T(C),END ); + BABLM( ,D(LCTL), T(X), U(LCTL),T(C),END ); case BABL_HELP: - return MACRO( D(LCTL),T(H), U(LCTL),T(A),END); // start search in help + BABLM( , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help #endif break; @@ -319,150 +236,90 @@ const static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { #endif #ifdef VI_MODE case VI_MODE: - switch(shortcut) { //assume esc is already called - case BABL_DEL_RIGHT_1C: - return MACRO( T(X),END ); - case BABL_DEL_LEFT_WORD: - return MACRO( T(D),T(G),T(E),END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( T(D),T(W),END ); - case BABL_GO_LEFT_1C: - return MACRO( T(H), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(L), END ); - case BABL_GO_LEFT_WORD: - return MACRO( T(B),END ); - case BABL_GO_RIGHT_WORD: - return MACRO( T(W), END ); - case BABL_GO_START_LINE: - return MACRO( D(LSFT), T(6),U(LSFT), END ); //^ - case BABL_GO_START_DOC: - return MACRO( T(G),T(G) ,END ); - case BABL_GO_END_LINE: - return MACRO( D(LSFT), T(4),U(LSFT) , END ); //$ - case BABL_GO_END_DOC: - return MACRO( D(LSFT), T(G),U(LSFT),END ); - case BABL_GO_NEXT_LINE: - return MACRO( T(J), END ); - case BABL_GO_PREV_LINE: - return MACRO( T(K), END ); - case BABL_PGDN: - return MACRO(D(LCTRL), T(F), U(LCTRL), END ); - case BABL_PGUP: - return MACRO( D(LCTRL), T(B), U(LCTRL), END ); + BABLM( BABL_DEL_RIGHT_1C , T(X),END ); + BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END ); + BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END ); + BABLM( BABL_GO_LEFT_1C , T(H), END ); + BABLM( BABL_GO_RIGHT_1C , T(L), END ); + BABLM( BABL_GO_LEFT_WORD , T(B),END ); + BABLM( BABL_GO_RIGHT_WORD , T(W), END ); + BABLM( BABL_GO_START_LINE , D(LSFT), T(6),U(LSFT), END ); //^ + BABLM( BABL_GO_START_DOC , T(G),T(G) ,END ); + BABLM( BABL_GO_END_LINE , D(LSFT), T(4),U(LSFT) , END ); //$ + BABLM( BABL_GO_END_DOC , D(LSFT), T(G),U(LSFT),END ); + BABLM( BABL_GO_NEXT_LINE , T(J), END ); + BABLM( BABL_GO_PREV_LINE, T(K), END ); + BABLM( BABL_PGDN ,D(LCTRL), T(F), U(LCTRL), END ); + BABLM( BABL_PGUP , D(LCTRL), T(B), U(LCTRL), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - return MACRO( T(U), END ); - case BABL_REDO: - return MACRO( D(LCTL), T(R), U(LCTL), END ); - case BABL_CUT: - return MACRO( T(X), END ); - case BABL_COPY: - return MACRO( T(Y),END ); - case BABL_PASTE: - return MACRO( T(P), END ); - case BABL_SELECT_ALL: - return MACRO( D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful? - case BABL_FIND: - return MACRO( T(SLASH),END ); - case BABL_FIND_NEXT: - return MACRO( T(N),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); - case BABL_RUNAPP: - return MACRO_NONE; - case BABL_SWITCH_APP_NEXT: - return MACRO_NONE; - case BABL_SWITCH_APP_LAST: - return MACRO_NONE; - case BABL_CLOSE_APP: - return MACRO(D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); - case BABL_HELP: - return MACRO(D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help - break; + BABLM( BABL_UNDO , T(U), END ); + BABLM( BABL_REDO , D(LCTL), T(R), U(LCTL), END ); + BABLM( BABL_CUT , T(X), END ); + BABLM( BABL_COPY , T(Y),END ); + BABLM( BABL_PASTE , T(P), END ); + BABLM( BABL_SELECT_ALL , D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful? + BABLM( BABL_FIND , T(SLASH),END ); + BABLM( BABL_FIND_NEXT , T(N),END ); + BABLM( BABL_FIND_REPLACE , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + BABLM( BABL_RUNAPP,END ); + BABLM( BABL_SWITCH_APP_NEXT ,END ); + BABLM( BABL_SWITCH_APP_LAST ,END ); + BABLM(BABL_CLOSE_APP, D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); + BABLM(BABL_HELP, D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help #endif - return MACRO_NONE; - } - + return MACRO_NONE; #endif + + + + #ifdef READMUX_MODE // Readline command line editing + tmux windowing // I havent decided how much to do readline and how much tmux - case READMUX_MODE: - switch(shortcut) { - - case BABL_DEL_RIGHT_1C: - return MACRO( D(LCTL), T(D), U(LCTL),END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTL), T(W), U(LCTL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(D), U(LALT), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(B), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(F), U(LALT), END ); - case BABL_GO_START_LINE: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_GO_START_DOC: - return MACRO_NONE; // tmux? - case BABL_GO_END_LINE: - return MACRO( D(LCTRL), T(E), U(LCTRL), END ); - case BABL_GO_END_DOC: - return MACRO_NONE; // tmux? - case BABL_GO_NEXT_LINE: - return MACRO( D(LCTRL), T(N), U(LCTRL), END ); - case BABL_GO_PREV_LINE: - return MACRO( D(LCTRL), T(P), U(LCTRL), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); + case READMUX_MODE: + BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(W), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LCTRL), T(A), U(LCTRL), END ); + BABLM( BABL_GO_START_DOC ,END );// tmux? + BABLM( BABL_GO_END_LINE , D(LCTRL), T(E), U(LCTRL), END ); + BABLM( BABL_GO_END_DOC ,END ); // tmux? + BABLM( BABL_GO_NEXT_LINE , D(LCTRL), T(N), U(LCTRL), END ); + BABLM( BABL_GO_PREV_LINE , D(LCTRL), T(P), U(LCTRL), END ); + BABLM( BABL_PGDN , T(PGDN), END ); + BABLM( BABL_PGUP , T(PGUP), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - return MACRO( D(LALT), T(R), U(LALT) , END ); - case BABL_REDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - case BABL_CUT: - return MACRO( D(LCTL), T(K), U(LCTL), END ); // wrong half the time - case BABL_COPY: - return MACRO_NONE; - case BABL_PASTE: - return MACRO( D(LCTL), T(Y), U(LCTL), END ); - case BABL_SELECT_ALL: - return MACRO(D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); - case BABL_FIND: - return MACRO( D(LCTRL), T(R), U(LCTRL), END ); // search history - case BABL_FIND_NEXT: - eturn MACRO( D(LCTRL), T(S), U(LCTRL), END ); - case BABL_FIND_REPLACE: - return MACRO_NONE; // tmux? - case BABL_RUNAPP: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux - case BABL_SWITCH_APP_LAST: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux - case BABL_CLOSE_APP: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want - break; - case BABL_HELP: - return MACRO_NONE; + BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END ); + BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time + BABLM( BABL_COPY ,END ); + BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_SELECT_ALL ,D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); + BABLM( BABL_FIND , D(LCTRL), T(R), U(LCTRL), END ); // search history + BABLM(BABL_FIND_NEXT, D(LCTRL), T(S), U(LCTRL), END ); + BABLM( BABL_FIND_REPLACE ,END ); + BABLM( BABL_RUNAPP , D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux + BABLM( BABL_SWITCH_APP_NEXT , D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux + BABLM( BABL_SWITCH_APP_LAST , D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux + BABLM( BABL_CLOSE_APP , D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want + BABLM( BABL_HELP ,END ); #endif - break; - - return MACRO_NONE; - } + + return MACRO_NONE; #endif - return MACRO_NONE; - } + default: + return MACRO_NONE; + } } + +#endif \ No newline at end of file diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h index 63b79a2055..313fa80ec4 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h @@ -9,27 +9,39 @@ and jeebak & algernon's keymap */ #ifndef _babblePaste_h_included__ #define _babblePaste_h_included__ +#include "action_layer.h" +#ifdef USE_BABLPASTE -/* Add this to your config.h -// Uncomment any modes you want. -// Windows. -//#define MS_MODE 0 +/* *************************** + +// Uncomment any modes you want. Whatever mode = 0 will be the default on boot + +//#define MS_MODE 0 // Windows. //#define MAC_MODE 1 -//aka gnome+KDE -//#define LINUX_MODE 2 +//#define LINUX_MODE 2 //aka gnome+KDE //#define EMACS_MODE 3 //#define VI_MODE 4 //#define WORDSTAR_MODE 5 -// Readline and tmux -//#define READMUX 6 -*/ +//#define READMUX 6 // Readline and tmux +****************************/ + + +// Uncomment if you need more free flash space +// It removes everything but cursor movement +//#define BABL_MOVEMENTONLY -/* Macros handled by babblepaste. Most should be available for all platforms. */ + +// Define starting number for BABL macros in the macro range. +// Probably can start the default even lower +#define BABL_START_NUM 50 + +/* Macros handled by babblepaste. Most should be available for all platforms. +Whatever isn't defined will NOP */ enum { // Movement - BABL_DEL_RIGHT_1C=200, + BABL_DEL_RIGHT_1C= BABL_START_NUM, BABL_DEL_LEFT_WORD, BABL_DEL_RIGHT_WORD, BABL_GO_LEFT_1C, @@ -64,9 +76,26 @@ enum { #endif }; +// How many macros/ how many array elements? +#define BABL_NUM_MACROS 28 +/* from action_macro.h +typedef uint8_t macro_t; + +#define MACRO_NONE (macro_t*)0 +#define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; }) +#define MACRO_GET(p) pgm_read_byte(p) + +#define BABL_MSTART (entry, os, macro...) ( const macro_t bablDict[entry][os] PROGMEM = { macro... }; ) + +*/ + +const macro_t *babblePaste(keyrecord_t *record, uint8_t shortcut); + +macro_t* switch_babble_mode( uint8_t id); + + +#endif +#endif -//static macro_t *babblePaste(keyrecord_t *record, uint16_t shortcut) - - #endif \ No newline at end of file diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h index aaf0077b14..7ad1b0f0f5 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h @@ -3,5 +3,25 @@ #include "../../config.h" +#define USE_BABLPASTE + +#ifdef USE_BABLPASTE +//define BabblePaste maps +// Windows. +//#define MS_MODE 1 +#define MAC_MODE 0 +//aka gnome+KDE +//#define LINUX_MODE 2 +//#define EMACS_MODE 3 +//#define VI_MODE 4 +//#define WORDSTAR_MODE 5 +// Readline and tmux +#define READMUX_MODE 6 +#endif + +// Uncomment if you need more free flash space +// It removes everything but cursor movement +//#define BABL_MOVEMENTONLY + // place overrides here #endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c index 244d52dc56..3a162db864 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -1,5 +1,7 @@ #include "MS-sculpt-mobile.h" #include "action_layer.h" +#include "action_util.h" +#include "babblePaste.h" #ifdef AUDIO_ENABLE #include "audio.h" @@ -12,6 +14,13 @@ #define _TRAN 5 + + +// adjust babblemode default +extern uint8_t babble_mode; + + + enum layer_keycodes { QWR, CDH, @@ -37,7 +46,11 @@ TRAN enum macro_keycodes { DHPASTE=1, VIBRK, -TO_CDH, +B_LNX, +B_WIN, +B_MAC, +B_VI, +B_READ , }; @@ -71,8 +84,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, QWR, \ KC_ESC, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, ____, ____, ____,\ - TT_MOV, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, ____,\ - KC_LSFT, KC_Z, KC_X, KC_C, M(DHPASTE), KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, ____,\ + TT_MOV, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_2,\ + KC_LSFT, KC_Z, KC_X, KC_C, M(DHPASTE), KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, ____, KC_1,\ ____, ____, ____ , KC_FN1, ____, ____, ____, ____, ____, ____ ), @@ -86,9 +99,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * -------------------------------------------------------------------------- * | ESC: | ^ | { | } | @ | % | | [ | ( | ) | _ | [ | ] | \ | | * -------------------------------------------------------------------------------' -* |Bak/Mov| ! | # | 0 | = | | * | - | 1 | + | ] | ` | enter |PgUp| +* |Bak/Mov| ! | # | 0 | = | { | } | - | 1 | + | ] | ` | enter |PgUp| * -------------------------------------------------------------------------------- -* |Lsft | ; | ~ | : | ~ | "|"| $ | ~ | | | / | Rsft| Up| PgDn| +* |Lsft | ; | ~ | : | ~ | "|"| $ | * | | . | / | Rsft| Up| PgDn| * --------------------------------------------------------------------------------- * |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght| * --------------------------------------------------------------------------------- @@ -98,16 +111,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ M(VIBRK), KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\ - ____, KC_EXLM, KC_HASH, KC_0, KC_EQL, ____, KC_ASTR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\ - ____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_TILDE,____, ____, KC_SLSH, ____, ____, ____,\ + ____, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_LCBR, KC_RCBR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\ + ____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_ASTR, ____, KC_DOT , KC_SLSH, ____, ____, ____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), [_MOV] = KEYMAP (\ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____,RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, ____, KC_UP, ____, ____, ____, ____, ____, \ - ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, ____, KC_LEFT,KC_DOWN, KC_RIGHT, ____, ____,____,____,\ + ____, M(B_WIN),M(B_MAC),M(B_READ), M(B_VI), ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, M(BABL_UNDO), ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____,RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, M(BABL_DEL_LEFT_WORD), KC_UP, M(BABL_DEL_RIGHT_WORD), ____, ____, ____, ____, \ + ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, M(BABL_GO_START_LINE), KC_LEFT,KC_DOWN, KC_RIGHT, M(BABL_GO_END_LINE), ____,____,____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), @@ -122,7 +135,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; - const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_TAP_KEY(_SYM,KC_SPACE), [2] = ACTION_LAYER_TAP_KEY(_MOV,KC_BSPC) @@ -171,10 +183,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } - - + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + +/* If this is in the range of BABL macros, call a separate function */ +#ifdef USE_BABLPASTE + if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) { + if (record->event.pressed) { // is there a case where this isn't desired? + + babblePaste ( record, id ); + return MACRO_NONE; + } + } +#endif + // MACRODOWN only works in this function switch(id) { case 0: @@ -185,49 +208,72 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; - - case DHPASTE: - if(keyboard_report->mods & MOD_BIT(KC_LGUI) ) { - if (record->event.pressed) { - clear_keyboard_but_mods(); - register_code(KC_V); - } else { - unregister_code(KC_V); - } - }else { - if (record->event.pressed) { - register_code(KC_D); + /* Colemak mod-dh moves the D key to the qwerty V position + This hack makes apple-V_position do what I mean */ + case DHPASTE: + if(keyboard_report->mods & MOD_BIT(KC_LGUI) ) { + if (record->event.pressed) { + clear_keyboard_but_mods(); + register_code(KC_V); + } else { + unregister_code(KC_V); + } + } else { + if (record->event.pressed) { + register_code(KC_D); } else { - unregister_code(KC_D); - } - } + unregister_code(KC_D); + } + } break; case VIBRK: // vi esc: if (record->event.pressed) { - return MACRO( T(E),D(LSFT),T(SCLN),U(LSFT), END ); + return MACRO( T(ESC),D(LSFT),T(SCLN),U(LSFT), END ); } break; - } - return MACRO_NONE; -}; + +#ifdef USE_BABLPASTE -#ifdef AUDIO_ENABLE +#ifdef LINUX_MODE + case B_LNX: + return switch_babble_mode(LINUX_MODE); +#endif +#ifdef MS_MODE + case B_WIN: + return switch_babble_mode(MS_MODE); +#endif +#ifdef MAC_MODE + case B_MAC: + return switch_babble_mode(MAC_MODE); +#endif +#ifdef VI_MODE + case B_VI: + return switch_babble_mode(VI_MODE); +#endif +#ifdef READMUX_MODE + case B_READ: + return switch_babble_mode(READMUX_MODE); +#endif +#endif -void startup_user() -{ - _delay_ms(20); // gets rid of tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); -} -#endif + default: + return MACRO_NONE; + } -void matrix_init_user(void) { +return MACRO_NONE; +}; + + + + +void matrix_init_user(void) { } void matrix_scan_user(void) { @@ -240,3 +286,11 @@ void led_set_user(uint8_t usb_led) { } +macro_t* switch_babble_mode( uint8_t id) { + babble_mode= id; + return MACRO_NONE; //less typing above +} + + + + diff --git a/keyboards/handwired/MS-sculpt-mobile/rules.mk b/keyboards/handwired/MS-sculpt-mobile/rules.mk index cb9d5813cf..34ac78da81 100644 --- a/keyboards/handwired/MS-sculpt-mobile/rules.mk +++ b/keyboards/handwired/MS-sculpt-mobile/rules.mk @@ -1,5 +1,9 @@ #CFLAGS=-D ASTAR +## Project specific files +SRC= babblePaste.c + + ifdef ASTAR OPT_DEFS += -DBOOTLOADER_SIZE=4096 MCU = atmega32u4 -- cgit v1.2.3 From 1023a47be6b91282b92b9a44f4492aa88375bf8e Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Wed, 22 Feb 2017 16:51:25 -0500 Subject: Copy CMD60 as starting point and rename files --- keyboards/handwired/magicforce68/README.md | 35 +++++ keyboards/handwired/magicforce68/config.h | 162 +++++++++++++++++++++ .../magicforce68/keymaps/default/keymap.c | 66 +++++++++ keyboards/handwired/magicforce68/magicforce68.c | 8 + keyboards/handwired/magicforce68/magicforce68.h | 20 +++ keyboards/handwired/magicforce68/rules.mk | 73 ++++++++++ 6 files changed, 364 insertions(+) create mode 100644 keyboards/handwired/magicforce68/README.md create mode 100644 keyboards/handwired/magicforce68/config.h create mode 100644 keyboards/handwired/magicforce68/keymaps/default/keymap.c create mode 100644 keyboards/handwired/magicforce68/magicforce68.c create mode 100644 keyboards/handwired/magicforce68/magicforce68.h create mode 100644 keyboards/handwired/magicforce68/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/README.md b/keyboards/handwired/magicforce68/README.md new file mode 100644 index 0000000000..83e371543e --- /dev/null +++ b/keyboards/handwired/magicforce68/README.md @@ -0,0 +1,35 @@ +CMD60 keyboard firmware +====================== + +##CMD60 + +This layout has been designed to optimize use of the left-hand, and it focussed specifically on programmers who work +with text editors like SublimeText and Atom. It utilizes the power of Space_fn, and features a caps lock swap for Fn2 +and enter key on tap. These features allow you to keep your right hand on the mouse more and should enable you to +achieve a higher level of productivity if you take the time to learn its function layers. + +## Quantum MK Firmware + +For the full Quantum feature list, see [the parent readme.md](/doc/readme.md). + +## Building + +Download or clone the whole firmware and navigate to the keyboards/handwired/CMD60 folder. +Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use +the Teensy Loader to program your .hex file. + +Depending on which keymap you would like to use, you will have to compile slightly differently. + +### Default + +To build with the default keymap, simply run `make`. + +### Other Keymaps + +To build the firmware binary hex file with a keymap just do `make` with `keymap` option like: + +``` +$ make keymap=[default|jack|] +``` + +Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/` diff --git a/keyboards/handwired/magicforce68/config.h b/keyboards/handwired/magicforce68/config.h new file mode 100644 index 0000000000..9671b66bad --- /dev/null +++ b/keyboards/handwired/magicforce68/config.h @@ -0,0 +1,162 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#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 Hexwire +#define PRODUCT Magicforce 68 +#define DESCRIPTION Advanced Programming Keeb Layout + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +/* + * 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, F4, F5, F6, F7 } +#define MATRIX_COL_PINS { B0, B1, B2, B3, B7, D0, D1, D2, D3, C6, D7, B4, B5, B6 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* 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 */ + +/* 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 PAUSE +//#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/keyboards/handwired/magicforce68/keymaps/default/keymap.c b/keyboards/handwired/magicforce68/keymaps/default/keymap.c new file mode 100644 index 0000000000..9f9cbcd661 --- /dev/null +++ b/keyboards/handwired/magicforce68/keymaps/default/keymap.c @@ -0,0 +1,66 @@ +#include "CMD60.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( /* CMD60 - QWERTY */ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + 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, \ + LT(3, KC_ENT), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_NO, KC_RSFT, \ + KC_LCTL, KC_LGUI, KC_LALT, LT(2, KC_SPC), MO(3), MO(4), MO(5), TG(1) \ + ), + [1] = KEYMAP( /* CMD60 - GameMode */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \ + KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_RSFT, \ + KC_TRNS, KC_NO, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + ), + [2] = KEYMAP( /* CMD60 - Arrows */ + 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, KC_DEL, \ + KC_TRNS, KC_BSPC, KC_UP, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_UP, KC_DEL, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, \ + KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + ), + [3] = KEYMAP( /* CMD60 - Functions */ + 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, KC_DEL, \ + KC_AUDIO_MUTE, KC_BSPC, KC_PGUP, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_UP, KC_PGDN, KC_TRNS, KC_PAUSE, KC_SLCK, KC_PSCREEN, \ + KC_TRNS, KC_HOME, KC_PGDN, KC_END, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_INSERT, KC_NO, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + ), + [4] = KEYMAP( /* CMD60 - Mouse */ + KC_SYSTEM_SLEEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_TRNS, KC_NO, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_WH_UP, KC_MS_BTN3, KC_MS_WH_DOWN, KC_NO, KC_NO, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + ), + [5] = KEYMAP( /* CMD60 - Media */ + KC_SYSTEM_WAKE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP, KC_AUDIO_MUTE, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PLAY_PAUSE, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WWW_BACK, KC_WWW_FORWARD, KC_NO, KC_NO, KC_WWW_REFRESH, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboards/handwired/magicforce68/magicforce68.c b/keyboards/handwired/magicforce68/magicforce68.c new file mode 100644 index 0000000000..84b1007e2c --- /dev/null +++ b/keyboards/handwired/magicforce68/magicforce68.c @@ -0,0 +1,8 @@ +#include "magicforce68.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} diff --git a/keyboards/handwired/magicforce68/magicforce68.h b/keyboards/handwired/magicforce68/magicforce68.h new file mode 100644 index 0000000000..de465a828f --- /dev/null +++ b/keyboards/handwired/magicforce68/magicforce68.h @@ -0,0 +1,20 @@ +#ifndef MAGICFORCE68_H +#define MAGICFORCE68_H + +#include "quantum.h" + +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K45, K4A, K4B, K4C, K4D \ + ) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ + { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, KC_NO,K4A, K4B, K4C, K4D } \ +} + +#endif \ No newline at end of file diff --git a/keyboards/handwired/magicforce68/rules.mk b/keyboards/handwired/magicforce68/rules.mk new file mode 100644 index 0000000000..7117599173 --- /dev/null +++ b/keyboards/handwired/magicforce68/rules.mk @@ -0,0 +1,73 @@ + +# MCU name +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=512 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 + +ifndef QUANTUM_DIR + include ../../../Makefile +endif + + -- cgit v1.2.3 From 6ee823a821d9c89a67c53f65ecf4d745223694a0 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Sun, 26 Feb 2017 10:16:24 -0500 Subject: Add rule for flashing microcontroller using avrdude --- keyboards/handwired/magicforce68/rules.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/rules.mk b/keyboards/handwired/magicforce68/rules.mk index 7117599173..e897ef2523 100644 --- a/keyboards/handwired/magicforce68/rules.mk +++ b/keyboards/handwired/magicforce68/rules.mk @@ -70,4 +70,14 @@ ifndef QUANTUM_DIR include ../../../Makefile endif +avrdude: build + ls /dev/tty* > /tmp/1; \ + echo "Reset your Pro Micro now"; \ + while [[ -z $$USB ]]; do \ + sleep 1; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex +.PHONY: avrdude -- cgit v1.2.3 From f3aef727e174279e69d8d5831d859d00802eb8c4 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 7 Mar 2017 11:41:10 -0500 Subject: Set pinout and layout --- keyboards/handwired/magicforce68/config.h | 6 +- .../magicforce68/keymaps/default/keymap.c | 90 ++++++++++++---------- keyboards/handwired/magicforce68/magicforce68.h | 20 ++--- 3 files changed, 61 insertions(+), 55 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/config.h b/keyboards/handwired/magicforce68/config.h index 9671b66bad..8a49b09353 100644 --- a/keyboards/handwired/magicforce68/config.h +++ b/keyboards/handwired/magicforce68/config.h @@ -30,7 +30,7 @@ along with this program. If not, see . /* key matrix size */ #define MATRIX_ROWS 5 -#define MATRIX_COLS 14 +#define MATRIX_COLS 15 /* * Keyboard Matrix Assignments @@ -42,8 +42,8 @@ along with this program. If not, see . * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * */ -#define MATRIX_ROW_PINS { F0, F4, F5, F6, F7 } -#define MATRIX_COL_PINS { B0, B1, B2, B3, B7, D0, D1, D2, D3, C6, D7, B4, B5, B6 } +#define MATRIX_ROW_PINS { F0, F1, F4, F5, F6 } +#define MATRIX_COL_PINS { B2, B0, D3, D2, D1, D0, D4, C6, D7, E6, B4, B5, B6, B7, D6 } #define UNUSED_PINS /* COL2ROW or ROW2COL */ diff --git a/keyboards/handwired/magicforce68/keymaps/default/keymap.c b/keyboards/handwired/magicforce68/keymaps/default/keymap.c index 9f9cbcd661..628249c2d8 100644 --- a/keyboards/handwired/magicforce68/keymaps/default/keymap.c +++ b/keyboards/handwired/magicforce68/keymaps/default/keymap.c @@ -1,52 +1,58 @@ -#include "CMD60.h" +#include "magicforce68.h" + +#define _QWERTY 0 +#define _FN1 1 +#define _FN2 2 +#define KC_ KC_TRNS const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = KEYMAP( /* CMD60 - QWERTY */ - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ - 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, \ - LT(3, KC_ENT), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_NO, KC_RSFT, \ - KC_LCTL, KC_LGUI, KC_LALT, LT(2, KC_SPC), MO(3), MO(4), MO(5), TG(1) \ - ), - [1] = KEYMAP( /* CMD60 - GameMode */ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \ - KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_RSFT, \ - KC_TRNS, KC_NO, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ - ), - [2] = KEYMAP( /* CMD60 - Arrows */ - 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, KC_DEL, \ - KC_TRNS, KC_BSPC, KC_UP, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_UP, KC_DEL, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, \ - KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ - ), - [3] = KEYMAP( /* CMD60 - Functions */ - 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, KC_DEL, \ - KC_AUDIO_MUTE, KC_BSPC, KC_PGUP, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_UP, KC_PGDN, KC_TRNS, KC_PAUSE, KC_SLCK, KC_PSCREEN, \ - KC_TRNS, KC_HOME, KC_PGDN, KC_END, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_INSERT, KC_NO, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + [_QWERTY] = KEYMAP( + /*,----+----+----+----+----+----+----+----+----+----+----+----+----+--------. ,----+----. */ + ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS,EQL , BSPC , INS ,PGUP, + /*|----`----`----`----`----`----`----`----`----`----`----`----`----`--------| |----`----| */ + TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC,RBRC, BSLS , DEL ,PGDN, + /*|------`----`----`----`----`----`----`----`----`----`----`----`----`------| `----`----' */ + FN0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, ENTER , + /*|-------`----`----`----`----`----`----`----`----`----`----`----`----------| ,----. */ + LSFT , Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, RSFT , UP , + /*|---------`----`----`----`----`----`----`----`----`----`----`-------------.--|----|----. */ + LCTL ,LGUI ,LALT , SPACE , FN1 ,RALT ,RCTL , LEFT,DOWN,RGHT + /*`-----+-----+-----+------------------------------+------+-----+-----' `----+----+----' */ ), - [4] = KEYMAP( /* CMD60 - Mouse */ - KC_SYSTEM_SLEEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_TRNS, KC_NO, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_WH_UP, KC_MS_BTN3, KC_MS_WH_DOWN, KC_NO, KC_NO, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ - ), - [5] = KEYMAP( /* CMD60 - Media */ - KC_SYSTEM_WAKE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP, KC_AUDIO_MUTE, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PLAY_PAUSE, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WWW_BACK, KC_WWW_FORWARD, KC_NO, KC_NO, KC_WWW_REFRESH, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \ + + [_FN1] = KEYMAP( + /*,----+----+----+----+----+----+----+----+----+----+----+----+----+--------. ,----+----. */ + GRV , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , BSPC , VOLU,HOME, + /*|esc-`-1--`-2--`-3--`-4--`-5--`-6--`-7--`-8--`-9--`-0--`mnus`plus`--bksp--| |ins-`pgup| */ + , , , UP , , , , , , , , , , , VOLD,END, + /*|tab---`-q--`-w--`-e--`-r--`-t--`-y--`-u--`-i--`-o--`-p--`-{--`-}--`--|---| `del-`pgdn' */ + , ,LEFT,DOWN,RGHT, , , , , , , , , + /*|caps---`-a--`-s--`-d--`-f--`-g--`-h--`-j--`-k--`-l--`-;--`-'--`----enter-| ,----. */ + , , , , , , ,MUTE, , , , , MUTE, + /*|shift----`-z--`-x--`-c--`-v--`-b--`-n--`-m--`-,--`-.--`-/--`-------shift-.--|-up-|----. */ + , , , , , , , MPRV,MPLY,MNXT + /*`ctrl-+-gui-+-alt-+----------space---------------+-fn---+-alt-+ctrl-' `left+down+rght' */ ), + + [_FN2] = KEYMAP( + /*,----+----+----+----+----+----+----+----+----+----+----+----+----+--------. ,----+----. */ + GRV , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , BSPC , VOLU,HOME, + /*|esc-`-1--`-2--`-3--`-4--`-5--`-6--`-7--`-8--`-9--`-0--`mnus`plus`--bksp--| |ins-`pgup| */ + , , , UP , , , , 7 , 8 , 9 , , , , , VOLD,END, + /*|tab---`-q--`-w--`-e--`-r--`-t--`-y--`-u--`-i--`-o--`-p--`-{--`-}--`--|---| `del-`pgdn' */ + , ,LEFT,DOWN,RGHT, , , 4 , 5 , 6 , , , , + /*|caps---`-a--`-s--`-d--`-f--`-g--`-h--`-j--`-k--`-l--`-;--`-'--`----enter-| ,----. */ + , , , , , , 0 , 1 , 2 , 3 , , , MUTE, + /*|shift----`-z--`-x--`-c--`-v--`-b--`-n--`-m--`-,--`-.--`-/--`-------shift-.--|-up-|----. */ + , , , , , , , MPRV,MPLY,MNXT + /*`ctrl-+-gui-+-alt-+----------space---------------+-fn---+-alt-+ctrl-' `left+down+rght' */ + ) }; const uint16_t PROGMEM fn_actions[] = { - + [0] = LT(KC_FN2, KC_GRV), + [1] = MO(_FN1), + [2] = MO(_FN2), }; diff --git a/keyboards/handwired/magicforce68/magicforce68.h b/keyboards/handwired/magicforce68/magicforce68.h index de465a828f..cfcdce38d5 100644 --- a/keyboards/handwired/magicforce68/magicforce68.h +++ b/keyboards/handwired/magicforce68/magicforce68.h @@ -4,17 +4,17 @@ #include "quantum.h" #define KEYMAP( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ - K40, K41, K42, K45, K4A, K4B, K4C, K4D \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K2E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K3E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3C, K3D, \ + K40, K41, K42, K45, K49, K4A, K4B, K4C, K4D, K4E \ ) { \ - { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ - { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ - { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ - { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ - { K40, K41, K42, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, KC_NO,K4A, K4B, K4C, K4D } \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_NO, KC_##K2E }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_##K3C, KC_##K3D, KC_##K3E }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \ } #endif \ No newline at end of file -- cgit v1.2.3 From 2cd2ac02d1c215167a1d82d675dc7cab1d5d90be Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 7 Mar 2017 12:19:29 -0500 Subject: Add readme file --- keyboards/handwired/magicforce68/README.md | 39 +++++++-------------- keyboards/handwired/magicforce68/wiring-layout.png | Bin 0 -> 73739 bytes 2 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 keyboards/handwired/magicforce68/wiring-layout.png (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/README.md b/keyboards/handwired/magicforce68/README.md index 83e371543e..4f0ccecf99 100644 --- a/keyboards/handwired/magicforce68/README.md +++ b/keyboards/handwired/magicforce68/README.md @@ -1,35 +1,20 @@ -CMD60 keyboard firmware -====================== +Magicforce 68 Handwired +======================= -##CMD60 +This firmware is for a Magicforce 68 that's had its PCB removed and is handwired with an Arduino Micro. NOTE: The Arduino Micro is different than the Arduino *Pro* Micro. -This layout has been designed to optimize use of the left-hand, and it focussed specifically on programmers who work -with text editors like SublimeText and Atom. It utilizes the power of Space_fn, and features a caps lock swap for Fn2 -and enter key on tap. These features allow you to keep your right hand on the mouse more and should enable you to -achieve a higher level of productivity if you take the time to learn its function layers. +## Wiring Layout -## Quantum MK Firmware +![Wiring Layout](wiring-layout.png) -For the full Quantum feature list, see [the parent readme.md](/doc/readme.md). +## Pinout -## Building +The following pins are used: +- Columns 1-15: B2, B0, D3, D2, D1, D0, D4, C6, D7, E6, B4, B5, B6, B7, D6 +- Rows 1-5: F0, F1, F4, F5, F6 -Download or clone the whole firmware and navigate to the keyboards/handwired/CMD60 folder. -Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use -the Teensy Loader to program your .hex file. +## Compiling and loading the firmware -Depending on which keymap you would like to use, you will have to compile slightly differently. +To build the firmware, run `make`. -### Default - -To build with the default keymap, simply run `make`. - -### Other Keymaps - -To build the firmware binary hex file with a keymap just do `make` with `keymap` option like: - -``` -$ make keymap=[default|jack|] -``` - -Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/` +To flash the firemware onto the microcontroller, run `make avrdude`, and press the reset button. diff --git a/keyboards/handwired/magicforce68/wiring-layout.png b/keyboards/handwired/magicforce68/wiring-layout.png new file mode 100644 index 0000000000..816b10b2b5 Binary files /dev/null and b/keyboards/handwired/magicforce68/wiring-layout.png differ -- cgit v1.2.3 From 38a83700c3c21326e691452c4dc002d398812679 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 7 Mar 2017 12:29:48 -0500 Subject: Update description --- keyboards/handwired/magicforce68/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/config.h b/keyboards/handwired/magicforce68/config.h index 8a49b09353..1e2b7d3e73 100644 --- a/keyboards/handwired/magicforce68/config.h +++ b/keyboards/handwired/magicforce68/config.h @@ -26,7 +26,7 @@ along with this program. If not, see . #define DEVICE_VER 0x0001 #define MANUFACTURER Hexwire #define PRODUCT Magicforce 68 -#define DESCRIPTION Advanced Programming Keeb Layout +#define DESCRIPTION Handwired Magicforce 68 /* key matrix size */ #define MATRIX_ROWS 5 -- cgit v1.2.3 From 7042af702057d4d129f1517712fab7f28e75b2f3 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 7 Mar 2017 23:06:41 -0500 Subject: Add Makefile --- keyboards/handwired/magicforce68/Makefile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 keyboards/handwired/magicforce68/Makefile (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/Makefile b/keyboards/handwired/magicforce68/Makefile new file mode 100644 index 0000000000..191c6bb664 --- /dev/null +++ b/keyboards/handwired/magicforce68/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file -- cgit v1.2.3 From 3d082382b20ab338bb7f41b33329daffc994169a Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 7 Mar 2017 23:08:44 -0500 Subject: Fix function layer actions --- keyboards/handwired/magicforce68/keymaps/default/keymap.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/magicforce68/keymaps/default/keymap.c b/keyboards/handwired/magicforce68/keymaps/default/keymap.c index 628249c2d8..22553f714c 100644 --- a/keyboards/handwired/magicforce68/keymaps/default/keymap.c +++ b/keyboards/handwired/magicforce68/keymaps/default/keymap.c @@ -4,6 +4,8 @@ #define _FN1 1 #define _FN2 2 #define KC_ KC_TRNS +#define KC_X0 LT(_FN2, KC_GRV) +#define KC_X1 MO(_FN1) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = KEYMAP( @@ -12,11 +14,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /*|----`----`----`----`----`----`----`----`----`----`----`----`----`--------| |----`----| */ TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC,RBRC, BSLS , DEL ,PGDN, /*|------`----`----`----`----`----`----`----`----`----`----`----`----`------| `----`----' */ - FN0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, ENTER , + X0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, ENTER , /*|-------`----`----`----`----`----`----`----`----`----`----`----`----------| ,----. */ LSFT , Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, RSFT , UP , /*|---------`----`----`----`----`----`----`----`----`----`----`-------------.--|----|----. */ - LCTL ,LGUI ,LALT , SPACE , FN1 ,RALT ,RCTL , LEFT,DOWN,RGHT + LCTL ,LGUI ,LALT , SPACE , X1 ,RALT ,RCTL , LEFT,DOWN,RGHT /*`-----+-----+-----+------------------------------+------+-----+-----' `----+----+----' */ ), @@ -49,13 +51,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -const uint16_t PROGMEM fn_actions[] = { - [0] = LT(KC_FN2, KC_GRV), - [1] = MO(_FN1), - [2] = MO(_FN2), -}; - - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function -- cgit v1.2.3 From 01980c96e9c1e8ab5aad0e89d03c0e15417712c8 Mon Sep 17 00:00:00 2001 From: milestogo Date: Wed, 8 Mar 2017 01:06:25 -0800 Subject: added browser babble, removed code from keymap --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 408 +++++++++++++-------- keyboards/handwired/MS-sculpt-mobile/babblePaste.h | 151 +++++++- .../MS-sculpt-mobile/keymaps/milestogo/config.h | 13 +- .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 78 ++-- 4 files changed, 438 insertions(+), 212 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c index 93ff486e0d..491a79333e 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -15,6 +15,13 @@ and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jee // GLOBAL variable to determine mode. Sets startup default if no eeppom uint8_t babble_mode =0 ; +// small function that we might also want to call from a keymap. + +macro_t* switch_babble_mode( uint8_t id) { + babble_mode= id; + return MACRO_NONE; //less typing above +} + // Today I learned that the preprocessor can not create a switch statement label from an argument // And else statements have problems, see https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html#SEC15 @@ -23,63 +30,80 @@ uint8_t babble_mode =0 ; { action_macro_play( MACRO(macro)); return MACRO_NONE; } -const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { /* this function runs the appropriate babblepaste macro, given the global babble_mode, and a shortcut from the ENUM in babblePaste.h TODO, the pointers in this function should be stored in a PROGMEM array, not ram. But that requires even more clever preprocessor foo. */ - +const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { +/* if ( shortcut < BABL_START_NUM || \ shortcut >= (BABL_START_NUM + BABL_NUM_MACROS ) ) { return MACRO_NONE; } - - +*/ switch(babble_mode) { - -#ifdef MS_MODE + + +#ifdef MS_MODE + if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); } + case MS_MODE: - BABLM( BABL_DEL_RIGHT_1C, T(DEL), END ); - BABLM( BABL_DEL_LEFT_WORD, D(LCTRL), T(BSPACE), U(LCTRL), END ); - BABLM( BABL_DEL_RIGHT_WORD,D(LCTRL), T(DEL), U(LCTRL), END ); BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); - BABLM( BABL_GO_LEFT_WORD, D(LCTRL), T(LEFT), U(LCTRL), END ); - BABLM( BABL_GO_RIGHT_WORD, D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_WORD, D(LCTL), T(LEFT), U(LCTL), END ); + BABLM( BABL_GO_RIGHT_WORD, D(LCTL), T(RIGHT), U(LCTL), END ); BABLM( BABL_GO_START_LINE, T(HOME), END ); - BABLM( BABL_GO_START_DOC, D(LCTRL),T(HOME), U(LCTRL),END ); BABLM( BABL_GO_END_LINE, T(END), END ); - BABLM( BABL_GO_END_DOC, D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_START_DOC, D(LCTL),T(HOME), U(LCTL),END ); + BABLM( BABL_GO_END_DOC, D(LCTL),T(END), U(LCTL),END ); BABLM( BABL_GO_NEXT_LINE, T(DOWN), END ); BABLM( BABL_GO_PREV_LINE, T(UP), END ); BABLM( BABL_PGDN, T(PGDN), END ); BABLM( BABL_PGUP, T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_1C, T(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD, D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD, D(LCTL), T(DEL), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_END, D(RSFT), T(HOME), U(RSFT), T(DEL), END); + BABLM( BABL_DEL_TO_LINE_START, D(RSFT), T(END), U(RSFT), T(DEL), END ); #ifndef BABL_MOVEMENTONLY - BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); - BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); - BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); - BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); - BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); - BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_UNDO, D(LCTRL), T(Z), U(LCTRL), END ); - BABLM( BABL_REDO, D(LCTRL), T(Y), U(LCTRL), END ); - BABLM( BABL_CUT, D(LCTRL), T(X), U(LCTRL), END ); - BABLM( BABL_COPY, D(LCTRL), T(C), U(LCTRL), END ); - BABLM( BABL_PASTE, D(LCTRL), T(V), U(LCTRL), END ); - BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + BABLM( BABL_UNDO, D(LCTL), T(Z), U(LCTL), END ); + BABLM( BABL_REDO, D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_CUT, D(LCTL), T(X), U(LCTL), END ); + BABLM( BABL_COPY, D(LCTL), T(C), U(LCTL), END ); + BABLM( BABL_PASTE, D(LCTL), T(V), U(LCTL), END ); + BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_FIND, D(LCTL),T(F), U(LCTL),END ); BABLM( BABL_FIND_NEXT, T(F3),END ); - BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); + BABLM( BABL_FIND_REPLACE, D(LCTL),T(H), U(LCTL),END ); BABLM( BABL_RUNAPP, D(LGUI),T(R), U(LGUI),END ); BABLM( BABL_SWITCH_APP_NEXT, D(LALT),T(TAB), U(LALT),END ); BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); BABLM( BABL_HELP, T(F1),END ); +#ifndef BABL_NOBROWSER + BABLM( BABL_BROWSER_NEW_TAB, D(LCTL), T(T), U(LCTL),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LCTL), T(W), U(LCTL),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LCTL), T(TAB), U(LCTL),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LCTL), T(L), U(LCTL),END ); + BABLM( BABL_BROWSER_FORWARD, D(LALT), T(RIGHT), U(LALT),END ); + BABLM( BABL_BROWSER_BACK, D(LALT), T(LEFT), U(LALT),END ); + BABLM( BABL_BROWSER_FIND, D(LCTL), T(F), U(LCTL),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LCTL), T(D), U(LCTL),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LCTL),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LCTL), T(T), U(LCTL),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, T(F11),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LCTL), D(RSFT), T(EQL), U(RSFT), U(LCTL),END ); // ctr+ + + BABLM( BABL_BROWSER_ZOOM_OUT, D(LCTL), T(MINS), U(LCTL),END ); +#endif #endif - + // Todo, ring bell, flash light, show user this isn't supported return MACRO_NONE; @@ -87,62 +111,87 @@ But that requires even more clever preprocessor foo. #ifdef LINUX_MODE + if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); } + case LINUX_MODE: - - BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); - BABLM( BABL_DEL_LEFT_WORD , D(LCTRL), T(BSPACE), U(LCTRL), END ); - BABLM( BABL_DEL_RIGHT_WORD , D(LCTRL), T(DEL), U(LCTRL), END ); BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); - BABLM( BABL_GO_LEFT_WORD , D(LCTRL), T(LEFT), U(LCTRL), END ); - BABLM( BABL_GO_RIGHT_WORD , D(LCTRL), T(RIGHT), U(LCTRL), END ); + BABLM( BABL_GO_LEFT_WORD , D(LCTL), T(LEFT), U(LCTL), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LCTL), T(RIGHT), U(LCTL), END ); BABLM( BABL_GO_START_LINE , T(HOME), END ); - BABLM( BABL_GO_START_DOC , D(LCTRL),T(HOME), U(LCTRL),END ); BABLM( BABL_GO_END_LINE , T(END), END ); - BABLM( BABL_GO_END_DOC , D(LCTRL),T(END), U(LCTRL),END ); + BABLM( BABL_GO_START_DOC , D(LCTL),T(HOME), U(LCTL),END ); + BABLM( BABL_GO_END_DOC , D(LCTL),T(END), U(LCTL),END ); BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); BABLM( BABL_GO_PREV_LINE , T(UP), END ); BABLM( BABL_PGDN , T(PGDN), END ); BABLM( BABL_PGUP , T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LCTL), T(DEL), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_END, D(RSFT), T(HOME), U(RSFT), T(DEL), END); + BABLM( BABL_DEL_TO_LINE_START, D(RSFT), T(END), U(RSFT), T(DEL), END ); #ifndef BABL_MOVEMENTONLY - BABLM( BABL_UNDO , D(LCTRL), T(Z), U(LCTRL), END ); - BABLM( BABL_REDO , D(LCTRL), T(Y), U(LCTRL), END ); - BABLM( BABL_CUT , D(LCTRL), T(X), U(LCTRL), END ); - BABLM( BABL_COPY , D(LCTRL), T(C), U(LCTRL), END ); - BABLM( BABL_PASTE , D(LCTRL), T(V), U(LCTRL), END ); - BABLM( BABL_SELECT_ALL, D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_FIND, D(LCTRL),T(F), U(LCTRL),END ); + BABLM( BABL_UNDO , D(LCTL), T(Z), U(LCTL), END ); + BABLM( BABL_REDO , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_CUT , D(LCTL), T(X), U(LCTL), END ); + BABLM( BABL_COPY , D(LCTL), T(C), U(LCTL), END ); + BABLM( BABL_PASTE , D(LCTL), T(V), U(LCTL), END ); + BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_FIND, D(LCTL),T(F), U(LCTL),END ); /* BABLM(BABL_FIND_NEXT , T(F3),END ); KDE */ - BABLM( BABL_FIND_NEXT, D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ - /* BABLM( , D(LCTRL),T(R), U(LCTRL),END ); KDE */ - BABLM( BABL_FIND_REPLACE, D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ + BABLM( BABL_FIND_NEXT, D(LCTL),T(G), U(LCTL),END ); // Gnome*/ + /* BABLM( , D(LCTL),T(R), U(LCTL),END ); KDE */ + BABLM( BABL_FIND_REPLACE, D(LCTL),T(H), U(LCTL),END ); // Gnome*/ BABLM( BABL_RUNAPP, D(LALT),T(F2), U(LALT),END ); BABLM( BABL_SWITCH_APP_NEXT, D(LCTL),T(TAB), U(LCTL),END ); BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END ); - BABLM( BABL_HELP, END ); + //BABLM( BABL_HELP, END ); + +#ifndef BABL_NOBROWSER + BABLM( BABL_BROWSER_NEW_TAB, D(LCTL), T(T), U(LCTL),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LCTL), T(W), U(LCTL),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LCTL), T(TAB), U(LCTL),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LCTL), T(L), U(LCTL),END ); + BABLM( BABL_BROWSER_FORWARD, D(LALT), T(RIGHT), U(LALT),END ); + BABLM( BABL_BROWSER_BACK, D(LALT), T(LEFT), U(LALT),END ); + BABLM( BABL_BROWSER_FIND, D(LCTL), T(F), U(LCTL),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LCTL), T(D), U(LCTL),END ); + BABLM( BABL_BROWSER_DEV_TOOLS, D(LCTL), T(T), U(LCTL),END ); // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, T(F11),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LCTL), T(PLUS), U(LCTL),END ); + BABLM( BABL_BROWSER_ZOOM_OUT, D(LCTL), T(MINS), U(LCTL),END ); +#endif #endif return MACRO_NONE; #endif #ifdef MAC_MODE + if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); } + case MAC_MODE: - BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); - BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END ); - BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END ); BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END ); BABLM( BABL_GO_LEFT_WORD , D(LALT), T(LEFT), U(LALT), END ); BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(RIGHT), U(LALT), END ); BABLM( BABL_GO_START_LINE , D(LGUI), T(LEFT), U(LGUI), END ); - BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END ); BABLM( BABL_GO_END_LINE , D(LGUI), T(RIGHT), U(LGUI), END ); + BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END ); BABLM( BABL_GO_END_DOC , D(LGUI),T(DOWN), U(LGUI),END ); BABLM( BABL_GO_NEXT_LINE , T(DOWN), END ); BABLM( BABL_GO_PREV_LINE , T(UP), END ); BABLM( BABL_PGDN , D(LALT),T(DOWN), U(LALT), END ); BABLM( BABL_PGUP , D(LALT),T(UP), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_1C , D(DEL), END ); + BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END ); + BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END );// there must be another way + BABLM( BABL_DEL_TO_LINE_START, D(LGUI), T(BSPACE), U(LGUI), END ); #ifndef BABL_MOVEMENTONLY BABLM( BABL_UNDO , D(1), D(LGUI), T(Z), U(LGUI), END ); BABLM( BABL_REDO , D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); @@ -158,75 +207,92 @@ But that requires even more clever preprocessor foo. BABLM( BABL_SWITCH_APP_LAST , D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); BABLM( BABL_CLOSE_APP , D(LGUI),T(Q), U(LGUI),END ); BABLM( BABL_HELP , D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); + +#ifndef BABL_NOBROWSER + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ + + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +#endif #endif return MACRO_NONE; #endif #ifdef EMACS_MODE + + if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); } + case EMACS_MODE: switch(shortcut) { //probably should allow meta to not be ALT - - case BABL_DEL_RIGHT_1C: - BABLM( , D(LCTL), T(D), U(LCTL),END ); - case BABL_DEL_LEFT_WORD: - BABLM( , D(LCTL), T(BSPACE), U(LCTL), END ); - case BABL_DEL_RIGHT_WORD: - BABLM( , D(LALT), T(D), U(LALT), END ); - case BABL_GO_LEFT_1C: - BABLM( , T(LEFT), END ); - case BABL_GO_RIGHT_1C: - BABLM( , T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - BABLM( , D(LALT), T(B), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - BABLM( , D(LALT), T(F), U(LALT), END ); - case BABL_GO_START_LINE: - BABLM( , D(LCTRL), T(A), U(LCTRL), END ); - case BABL_GO_START_DOC: - BABLM( , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); - case BABL_GO_END_LINE: - BABLM( , D(LCTRL), T(E), U(LCTRL), END ); - case BABL_GO_END_DOC: - BABLM( , D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); - case BABL_GO_NEXT_LINE: - BABLM( , D(LCTRL), T(N), U(LCTRL), END ); - case BABL_GO_PREV_LINE: - BABLM( , D(LCTRL), T(P), U(LCTRL), END ); - case BABL_PGDN: - BABLM( ,D(LCTRL), T(V), U(LCTRL), END ); - case BABL_PGUP: - BABLM( , D(LALT), T(V), U(LALT), END ); + + BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD, D(LALT), T(B), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_GO_END_LINE , D(LCTL), T(E), U(LCTL), END ); + BABLM( BABL_GO_START_DOC , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); + BABLM( BABL_GO_END_DOC , D(LALT), D(LSFT), T(DOT), U(LSFT), U(LALT) ,END ); + BABLM( BABL_GO_NEXT_LINE , D(LCTL), T(N), U(LCTL), END ); + BABLM( BABL_GO_PREV_LINE , D(LCTL), T(P), U(LCTL), END ); + BABLM( BABL_PGDN , D(LCTL), T(V), U(LCTL), END ); + BABLM( BABL_PGUP , D(LALT), T(V), U(LALT), END ); + BABLM( BABL_DEL_RIGHT_1C, D(LCTL), T(D), U(LCTL),END ); + BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(BSPACE), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); + BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_START, T(ESC), T(0), D(LCTL), T(K), U(LCTL), END ); #ifndef BABL_MOVEMENTONLY - case BABL_UNDO: - BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); - case BABL_REDO: - BABLM( , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - case BABL_CUT: - BABLM( , D(LCTL), T(W), U(LCTL), END ); - case BABL_COPY: - BABLM( , D(LALT), T(W), U(LALT), END ); //really? - case BABL_PASTE: - BABLM( , D(LCTL), T(Y), U(LCTL), END ); - case BABL_SELECT_ALL: - BABLM( ,D(LCTL), T(X), U(LCTL),T(H), END ); - case BABL_FIND: - BABLM( , D(LCTRL), T(S), U(LCTRL),END ); - case BABL_FIND_NEXT: - BABLM( , D(LCTRL), T(S), U(LCTRL),END ); - case BABL_FIND_REPLACE: - BABLM( , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); - case BABL_RUNAPP: - BABLM( , D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably - case BABL_SWITCH_APP_NEXT: - BABLM( , D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably - case BABL_SWITCH_APP_LAST: - BABLM( , D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably - case BABL_CLOSE_APP: - BABLM( ,D(LCTL), T(X), U(LCTL),T(C),END ); - case BABL_HELP: - BABLM( , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help + BABLM( BABL_UNDO , D(LCTL), T(X), U(LCTL),T(C), END ); + BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( BABL_CUT , D(LCTL), T(W), U(LCTL), END ); + BABLM( BABL_COPY , D(LALT), T(W), U(LALT), END ); //really? + BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_SELECT_ALL ,D(LCTL), T(X), U(LCTL),T(H), END ); + BABLM( BABL_FIND , D(LCTL), T(S), U(LCTL),END ); + BABLM( BABL_FIND_NEXT , D(LCTL), T(S), U(LCTL),END ); + BABLM( BABL_FIND_REPLACE , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); + BABLM( BABL_RUNAPP , D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably + BABLM( BABL_SWITCH_APP_NEXT , D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably + BABLM( BABL_SWITCH_APP_LAST , D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably + BABLM( BABL_CLOSE_APP , D(LCTL), T(X), U(LCTL),T(C),END ); + BABLM( BABL_HELP , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help +#ifndef BABL_NOBROWSER +/* you get to figure w3 out + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ + + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +*/ +#endif #endif break; @@ -234,25 +300,31 @@ But that requires even more clever preprocessor foo. } #endif + + #ifdef VI_MODE + if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); } case VI_MODE: -//assume esc is already called +// you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell) + - BABLM( BABL_DEL_RIGHT_1C , T(X),END ); - BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END ); - BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END ); BABLM( BABL_GO_LEFT_1C , T(H), END ); BABLM( BABL_GO_RIGHT_1C , T(L), END ); BABLM( BABL_GO_LEFT_WORD , T(B),END ); BABLM( BABL_GO_RIGHT_WORD , T(W), END ); BABLM( BABL_GO_START_LINE , D(LSFT), T(6),U(LSFT), END ); //^ - BABLM( BABL_GO_START_DOC , T(G),T(G) ,END ); BABLM( BABL_GO_END_LINE , D(LSFT), T(4),U(LSFT) , END ); //$ + BABLM( BABL_GO_START_DOC , T(G),T(G) ,END ); BABLM( BABL_GO_END_DOC , D(LSFT), T(G),U(LSFT),END ); BABLM( BABL_GO_NEXT_LINE , T(J), END ); BABLM( BABL_GO_PREV_LINE, T(K), END ); - BABLM( BABL_PGDN ,D(LCTRL), T(F), U(LCTRL), END ); - BABLM( BABL_PGUP , D(LCTRL), T(B), U(LCTRL), END ); + BABLM( BABL_PGDN ,D(LCTL), T(F), U(LCTL), END ); + BABLM( BABL_PGUP , D(LCTL), T(B), U(LCTL), END ); + BABLM( BABL_DEL_RIGHT_1C , T(X),END ); + BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END ); + BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END ); + BABLM( BABL_DEL_TO_LINE_END, T(D),D(LSFT), T(4),U(LSFT) ,END ); // d$ + BABLM( BABL_DEL_TO_LINE_START, T(D),D(LSFT), T(6),U(LSFT) ,END ); #ifndef BABL_MOVEMENTONLY BABLM( BABL_UNDO , T(U), END ); BABLM( BABL_REDO , D(LCTL), T(R), U(LCTL), END ); @@ -268,6 +340,27 @@ But that requires even more clever preprocessor foo. BABLM( BABL_SWITCH_APP_LAST ,END ); BABLM(BABL_CLOSE_APP, D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END ); BABLM(BABL_HELP, D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help +#ifndef BABL_NOBROWSER +/* you get to figure this out + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), T(PLUS), U(LGUI),END ); + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +*/ +#endif #endif return MACRO_NONE; #endif @@ -278,37 +371,62 @@ But that requires even more clever preprocessor foo. #ifdef READMUX_MODE // Readline command line editing + tmux windowing // I havent decided how much to do readline and how much tmux + if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; } case READMUX_MODE: - BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END ); + + BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); + BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); + BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END ); + BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); + BABLM( BABL_GO_START_LINE , D(LCTL), T(A), U(LCTL), END ); + BABLM( BABL_GO_END_LINE , D(LCTL), T(E), U(LCTL), END ); + //BABLM( BABL_GO_START_DOC ,END );// tmux? + //BABLM( BABL_GO_END_DOC ,END ); // tmux? + BABLM( BABL_GO_NEXT_LINE , D(LCTL), T(N), U(LCTL), END ); + BABLM( BABL_GO_PREV_LINE , D(LCTL), T(P), U(LCTL), END ); + BABLM( BABL_PGDN , T(PGDN), END ); + BABLM( BABL_PGUP , T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END ); BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(W), U(LCTL), END ); - BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); - BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); - BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END ); - BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END ); - BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END ); - BABLM( BABL_GO_START_LINE , D(LCTRL), T(A), U(LCTRL), END ); - BABLM( BABL_GO_START_DOC ,END );// tmux? - BABLM( BABL_GO_END_LINE , D(LCTRL), T(E), U(LCTRL), END ); - BABLM( BABL_GO_END_DOC ,END ); // tmux? - BABLM( BABL_GO_NEXT_LINE , D(LCTRL), T(N), U(LCTRL), END ); - BABLM( BABL_GO_PREV_LINE , D(LCTRL), T(P), U(LCTRL), END ); - BABLM( BABL_PGDN , T(PGDN), END ); - BABLM( BABL_PGUP , T(PGUP), END ); + BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END ); + BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END ); + BABLM( BABL_DEL_TO_LINE_START, D(LCTL), T(U), U(LCTL), END ); #ifndef BABL_MOVEMENTONLY - BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END ); - BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time - BABLM( BABL_COPY ,END ); - BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); - BABLM( BABL_SELECT_ALL ,D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); - BABLM( BABL_FIND , D(LCTRL), T(R), U(LCTRL), END ); // search history - BABLM(BABL_FIND_NEXT, D(LCTRL), T(S), U(LCTRL), END ); - BABLM( BABL_FIND_REPLACE ,END ); - BABLM( BABL_RUNAPP , D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux - BABLM( BABL_SWITCH_APP_NEXT , D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux - BABLM( BABL_SWITCH_APP_LAST , D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux - BABLM( BABL_CLOSE_APP , D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want - BABLM( BABL_HELP ,END ); + BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END ); + BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably + BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time + //BABLM( BABL_COPY ,END ); + BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END ); + BABLM( BABL_SELECT_ALL , D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); + BABLM( BABL_FIND , D(LCTL), T(R), U(LCTL), END ); // search history + BABLM(BABL_FIND_NEXT, D(LCTL), T(S), U(LCTL), END ); + //BABLM( BABL_FIND_REPLACE ,END ); + BABLM( BABL_RUNAPP , D(LCTL), T(B), U(LCTL), T(C),END ); //tmux + BABLM( BABL_SWITCH_APP_NEXT , D(LCTL), T(B), U(LCTL), T(N),END ); //tmux + BABLM( BABL_SWITCH_APP_LAST , D(LCTL), T(B), U(LCTL), T(P),END ); //tmux + BABLM( BABL_CLOSE_APP , D(LCTL), T(B), U(LCTL), T(D),END); // usually what I want + // BABLM( BABL_HELP ,END ); +#ifndef BABL_NOBROWSER +/* Add lynx shortcuts? + BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END ); + BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END ); + BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END ); + BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END ); + BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END ); + BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END ); + BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END ); + BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END ); + BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END ); + BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END ); + //BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE + BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome + // Chrome + BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache + BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F + BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), T(PLUS), U(LGUI),END ); + BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END ); +*/ +#endif #endif return MACRO_NONE; diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h index 313fa80ec4..67153fb0d8 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h @@ -10,6 +10,8 @@ and jeebak & algernon's keymap #ifndef _babblePaste_h_included__ #define _babblePaste_h_included__ #include "action_layer.h" +#include "quantum_keycodes.h" +#include "config.h" #ifdef USE_BABLPASTE @@ -39,23 +41,28 @@ and jeebak & algernon's keymap /* Macros handled by babblepaste. Most should be available for all platforms. Whatever isn't defined will NOP */ enum { - - // Movement - BABL_DEL_RIGHT_1C= BABL_START_NUM, - BABL_DEL_LEFT_WORD, - BABL_DEL_RIGHT_WORD, - BABL_GO_LEFT_1C, +// Movement macros + // left & right + BABL_GO_LEFT_1C= BABL_START_NUM, BABL_GO_RIGHT_1C, - BABL_GO_LEFT_WORD, + BABL_GO_LEFT_WORD, BABL_GO_RIGHT_WORD, BABL_GO_START_LINE, BABL_GO_END_LINE, + // now up & down BABL_GO_START_DOC, BABL_GO_END_DOC, BABL_GO_NEXT_LINE, BABL_GO_PREV_LINE, BABL_PGDN, BABL_PGUP, + // And the delete options + //BABL_DEL_LEFT_1C == backspace, so why bother. + BABL_DEL_RIGHT_1C, // usually = Del + BABL_DEL_LEFT_WORD, + BABL_DEL_RIGHT_WORD, + BABL_DEL_TO_LINE_END, // delete from cursor to end of line + BABL_DEL_TO_LINE_START, // delete from cursor to begining line #ifndef BABL_MOVEMENTONLY // Cut & Paste BABL_UNDO, @@ -64,20 +71,142 @@ enum { BABL_COPY, BABL_PASTE, BABL_SELECT_ALL, - // GUI or app + /* not yet implemented + BABL_SWAP_LAST2C // swap last characters before the cursor + BABL_SWAP_LAST2W // Swap the last two words before the cursor + */ + // find & replace BABL_FIND, BABL_FIND_NEXT, BABL_FIND_REPLACE, + // GUI or app BABL_RUNAPP, BABL_SWITCH_APP_NEXT, BABL_SWITCH_APP_LAST, // previous BABL_CLOSE_APP, - BABL_HELP + BABL_HELP, + +#ifndef BABL_NOBROWSER + BABL_BROWSER_NEW_TAB, + BABL_BROWSER_CLOSE_TAB, + BABL_BROWSER_REOPEN_LAST_TAB, + BABL_BROWSER_NEXT_TAB, + BABL_BROWSER_PREV_TAB, + BABL_BROWSER_URL_BAR, + BABL_BROWSER_FORWARD, + BABL_BROWSER_BACK, + BABL_BROWSER_FIND, + BABL_BROWSER_BOOKMARK, + BABL_BROWSER_DEV_TOOLS, // hard one to remember + BABL_BROWSER_RELOAD, + BABL_BROWSER_FULLSCREEN, + BABL_BROWSER_ZOOM_IN, + BABL_BROWSER_ZOOM_OUT, + +#endif + #endif +// Macros for mode switching +#ifdef MS_MODE + BABL_WINDOWS, +#endif +#ifdef MAC_MODE + BABL_MAC, +#endif +#ifdef LINUX_MODE + BABL_LINUX, +#endif +#ifdef EMACS_MODE + BABL_EMACS, +#endif +#ifdef VI_MODE + BABL_VI, +#endif +#ifdef READMUX_MODE + BABL_READLINE, +#endif + + }; -// How many macros/ how many array elements? -#define BABL_NUM_MACROS 28 +// BUG, used to jump to babble functiion. Surely there is a way to calculate size of enum? +#define BABL_NUM_MACROS 48 + 4 // 48 + # of defined modes. + +/* And all the shorthand keymap ready versions */ +// First the mode switching macros +#ifdef MS_MODE +#define B_WIN M(BABL_WINDOWS) +#endif +#ifdef MAC_MODE +#define B_MAC M(BABL_MAC) +#endif +#ifdef LINUX_MODE +#define B_LNX M(BABL_LINUX) +#endif +#ifdef EMACS_MODE +#define B_EMAX M(BABL_EMACS) +#endif +#ifdef VI_MODE +#define B_VI M(BABL_VI) +#endif +#ifdef READMUX_MODE +#define B_READ M(BABL_READLINE) +#endif + +// and all the movement & action. + +#define B_L1C M(BABL_GO_LEFT_1C) +#define B_R1C M(BABL_GO_RIGHT_1C) +#define B_L1W M(BABL_GO_LEFT_WORD) +#define B_R1W M(BABL_GO_RIGHT_WORD) +#define B_GSOL M(BABL_GO_START_LINE) +#define B_GEOL M(BABL_GO_END_LINE) +#define B_GTOP M(BABL_GO_START_DOC) +#define B_GEND M(BABL_GO_END_DOC) +#define B_DOWN M(BABL_GO_NEXT_LINE) +#define B_UP M(BABL_GO_PREV_LINE) +#define B_PGDN M(BABL_PGDN) +#define B_PGUP M(BABL_PGUP) +//#define B_BKSP M(BABL_DEL_LEFT_1C) == backspace so why bother. +#define B_DEL M(BABL_DEL_RIGHT_1C) // usually = Del +#define B_DLW M(BABL_DEL_LEFT_WORD) +#define B_DRW M(BABL_DEL_RIGHT_WORD) +#define B_DEOL M(BABL_DEL_TO_LINE_END) // delete from cursor to end of line +#define B_DSOL M(BABL_DEL_TO_LINE_START) // delete from cursor to begining line +#define B_UNDO M(BABL_UNDO) +#define B_REDO M(BABL_REDO) +#define B_CUT M(BABL_CUT) +#define B_COPY M(BABL_COPY) +#define B_PAST M(BABL_PASTE) +#define B_SELA M(BABL_SELECT_ALL) +#define B_FIND M(BABL_FIND) +#define B_FINDN M(BABL_FIND_NEXT) +#define B_FINDR M(BABL_FIND_REPLACE) +#define B_RAPP M(BABL_RUNAPP) +#define B_NAPP M(BABL_SWITCH_APP_NEXT) +#define B_PAPP M(BABL_SWITCH_APP_LAST) // previous +#define B_CAPP M(BABL_CLOSE_APP) +#define B_HELP M(BABL_HELP) +#define B_NTAB M(BABL_BROWSER_NEW_TAB) +#define B_CTAB M(BABL_BROWSER_CLOSE_TAB) +#define B_ROTB M(BABL_BROWSER_REOPEN_LAST_TAB) +#define B_NXTB M(BABL_BROWSER_NEXT_TAB) +#define B_PTAB M(BABL_BROWSER_PREV_TAB) +#define B_NURL M(BABL_BROWSER_URL_BAR) +#define B_BFWD M(BABL_BROWSER_FORWARD) +#define B_BBAK M(BABL_BROWSER_BACK) +#define B_BFND M(BABL_BROWSER_FIND) +#define B_BOOK M(BABL_BROWSER_BOOKMARK) +#define B_BDEV M(BABL_BROWSER_DEV_TOOLS) // hard one to remember +#define B_BRLD M(BABL_BROWSER_RELOAD) +#define B_BFUlL M(BABL_BROWSER_FULLSCREEN) +#define B_ZMIN M(BABL_BROWSER_ZOOM_IN) +#define B_ZMOT M(BABL_BROWSER_ZOOM_OUT) + + + + + /* from action_macro.h diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h index 7ad1b0f0f5..9f9b050944 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h @@ -5,23 +5,28 @@ #define USE_BABLPASTE +// Expect to get errors if you comment a feature out and leave it in your keymap. + #ifdef USE_BABLPASTE //define BabblePaste maps // Windows. -//#define MS_MODE 1 -#define MAC_MODE 0 +#define MS_MODE 0 +#define MAC_MODE 1 //aka gnome+KDE //#define LINUX_MODE 2 //#define EMACS_MODE 3 -//#define VI_MODE 4 +#define VI_MODE 4 //#define WORDSTAR_MODE 5 // Readline and tmux #define READMUX_MODE 6 #endif // Uncomment if you need more free flash space -// It removes everything but cursor movement + +// This removes everything but cursor movement //#define BABL_MOVEMENTONLY +// and this just removes browser shortcuts +//#define BABL_NOBROWSER // place overrides here #endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c index 3a162db864..a662825475 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -14,13 +14,6 @@ #define _TRAN 5 - - -// adjust babblemode default -extern uint8_t babble_mode; - - - enum layer_keycodes { QWR, CDH, @@ -46,11 +39,6 @@ TRAN enum macro_keycodes { DHPASTE=1, VIBRK, -B_LNX, -B_WIN, -B_MAC, -B_VI, -B_READ , }; @@ -115,24 +103,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_ASTR, ____, KC_DOT , KC_SLSH, ____, ____, ____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), +/* +* |ESC | Win| MAC|RdLn| VI | | | | | | | | | | | | +* -------------------------------------------------------------------------------' +* | | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del| +* --------------------------------------------------------------------------- +* | tab | q | w |Find| |pTab |DSOL|DelW| Up |DelW|DEOL| [ | ] | \ | | +* -------------------------------------------------------------------------------' +* |Bak/Mov| a | s | d | |nTab |GSOL| <- | Dwn | -> | EOL | ' | enter |PgUp| +* -------------------------------------------------------------------------------- +* |Lsft |Undo| Cut|Copy|Pste| b | n | m | , | . | / | Rsft| Up| PgDn| +* --------------------------------------------------------------------------------- +* |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght| +* --------------------------------------------------------------------------------- +*/ [_MOV] = KEYMAP (\ - ____, M(B_WIN),M(B_MAC),M(B_READ), M(B_VI), ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, M(BABL_UNDO), ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____,RGUI(KC_TAB), ____, ____, RCTL(KC_B), ____, M(BABL_DEL_LEFT_WORD), KC_UP, M(BABL_DEL_RIGHT_WORD), ____, ____, ____, ____, \ - ____, RCTL(KC_A), KC_S, RCTL(KC_K), RCTL(KC_E), ____, M(BABL_GO_START_LINE), KC_LEFT,KC_DOWN, KC_RIGHT, M(BABL_GO_END_LINE), ____,____,____,\ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, B_MAC,B_WIN,B_READ, B_VI, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, B_PAPP, B_NAPP, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, B_UNDO, ____, B_BFND, ____, B_PTAB, B_DSOL, B_DLW, B_UP, B_DRW, B_DEOL, ____, ____, ____, \ + ____, B_SELA, B_BRLD, ____, ____, B_NXTB, B_GSOL, B_L1C, B_DOWN, B_R1C,B_GEOL, ____, ____, ____,\ + ____, B_UNDO,B_CUT, B_COPY, B_PAST, B_PAST, ____, ____, ____, ____, ____, ____, ____, ____, \ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), [_TRAN] = KEYMAP (\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ - ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ -) + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ + ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ +) }; const uint16_t PROGMEM fn_actions[] = { @@ -188,6 +190,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { /* If this is in the range of BABL macros, call a separate function */ +/* Any clever remapping with modifiers should happen here e.g. shift bablkey does opposite*/ #ifdef USE_BABLPASTE if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) { if (record->event.pressed) { // is there a case where this isn't desired? @@ -235,31 +238,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) - -#ifdef USE_BABLPASTE - -#ifdef LINUX_MODE - case B_LNX: - return switch_babble_mode(LINUX_MODE); -#endif -#ifdef MS_MODE - case B_WIN: - return switch_babble_mode(MS_MODE); -#endif -#ifdef MAC_MODE - case B_MAC: - return switch_babble_mode(MAC_MODE); -#endif -#ifdef VI_MODE - case B_VI: - return switch_babble_mode(VI_MODE); -#endif -#ifdef READMUX_MODE - case B_READ: - return switch_babble_mode(READMUX_MODE); -#endif -#endif - default: return MACRO_NONE; @@ -286,10 +264,6 @@ void led_set_user(uint8_t usb_led) { } -macro_t* switch_babble_mode( uint8_t id) { - babble_mode= id; - return MACRO_NONE; //less typing above -} -- cgit v1.2.3 From 89aba30c7f50aa733262f4add253817e2fb84e8a Mon Sep 17 00:00:00 2001 From: milestogo Date: Wed, 8 Mar 2017 01:25:33 -0800 Subject: fix stupid error w/ mode switch --- keyboards/handwired/MS-sculpt-mobile/babblePaste.c | 38 +++++++++++++++------- keyboards/handwired/MS-sculpt-mobile/babblePaste.h | 10 +++++- keyboards/handwired/MS-sculpt-mobile/config.h | 5 ++- .../MS-sculpt-mobile/keymaps/default/Makefile | 2 +- .../MS-sculpt-mobile/keymaps/milestogo/config.h | 10 +++--- .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 4 ++- keyboards/handwired/MS-sculpt-mobile/readme.md | 2 +- keyboards/handwired/MS-sculpt-mobile/rules.mk | 5 +-- 8 files changed, 51 insertions(+), 25 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c index 491a79333e..3a9b86997d 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.c +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.c @@ -19,7 +19,7 @@ uint8_t babble_mode =0 ; macro_t* switch_babble_mode( uint8_t id) { babble_mode= id; - return MACRO_NONE; //less typing above + return MACRO_NONE; //less typing where called } @@ -42,12 +42,32 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { return MACRO_NONE; } */ - switch(babble_mode) { - - + + +#ifdef MS_MODE + if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); } +#endif +#ifdef MAC_MODE + if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); } +#endif +#ifdef LINUX_MODE + if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); } +#endif + #ifdef READMUX_MODE + if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; } +#endif +#ifdef VI_MODE + if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); } +#endif +#ifdef EMACS_MODE + if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); } +#endif + + + + switch(babble_mode) { #ifdef MS_MODE - if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); } case MS_MODE: BABLM( BABL_GO_LEFT_1C, T(LEFT), END ); @@ -111,7 +131,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef LINUX_MODE - if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); } case LINUX_MODE: BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); @@ -172,7 +191,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #endif #ifdef MAC_MODE - if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); } case MAC_MODE: BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); @@ -234,8 +252,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef EMACS_MODE - if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); } - case EMACS_MODE: switch(shortcut) { //probably should allow meta to not be ALT @@ -303,7 +319,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef VI_MODE - if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); } case VI_MODE: // you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell) @@ -371,7 +386,8 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) { #ifdef READMUX_MODE // Readline command line editing + tmux windowing // I havent decided how much to do readline and how much tmux - if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; } + + case READMUX_MODE: BABLM( BABL_GO_LEFT_1C , T(LEFT), END ); diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h index 67153fb0d8..3067c854de 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.h +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.h @@ -18,6 +18,9 @@ and jeebak & algernon's keymap /* *************************** // Uncomment any modes you want. Whatever mode = 0 will be the default on boot +// Expect to get errors if you comment a feature out and leave it in your keymap. + +#define USE_BABLPASTE //#define MS_MODE 0 // Windows. //#define MAC_MODE 1 @@ -26,6 +29,11 @@ and jeebak & algernon's keymap //#define VI_MODE 4 //#define WORDSTAR_MODE 5 //#define READMUX 6 // Readline and tmux + +// This removes everything but cursor movement +//#define BABL_MOVEMENTONLY +// and this just removes browser shortcuts +//#define BABL_NOBROWSER ****************************/ @@ -130,7 +138,7 @@ enum { }; // BUG, used to jump to babble functiion. Surely there is a way to calculate size of enum? -#define BABL_NUM_MACROS 48 + 4 // 48 + # of defined modes. +#define BABL_NUM_MACROS 48+4 // 48 + # of defined modes. /* And all the shorthand keymap ready versions */ // First the mode switching macros diff --git a/keyboards/handwired/MS-sculpt-mobile/config.h b/keyboards/handwired/MS-sculpt-mobile/config.h index d85c5c6233..f89514278d 100644 --- a/keyboards/handwired/MS-sculpt-mobile/config.h +++ b/keyboards/handwired/MS-sculpt-mobile/config.h @@ -25,7 +25,6 @@ along with this program. If not, see . #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 #define MANUFACTURER Microsoftplus -#define PRODUCT sculpt mobile #define DESCRIPTION 6000 /* key matrix size */ @@ -33,14 +32,14 @@ along with this program. If not, see . #define MATRIX_COLS 18 #ifdef ASTAR - +#define PRODUCT sculpt mobile astar /*0 1 2 3 4 5 6 7 8 */ #define MATRIX_ROW_PINS {D7, C6, D4, D0, D1, D3, D2, E2} /* A B C D E F G H I J K L M N O P Q R */ #define MATRIX_COL_PINS {B4, B5, E6, B7, B6, D6, C7, F7, F6, F4,F5, F1,F0, D5, B0, B1, B2, B3} #else - +#define PRODUCT sculpt mobile teensypp /* 0 1 2 3 4 5 6 7 */ #define MATRIX_ROW_PINS { F7,F6,F4,F5,F3,F2,F1,F0} /* A B C D E F G H I J K L M N O P Q R */ diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile index 9d3df5964f..8b829218b2 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/default/Makefile @@ -17,5 +17,5 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend ifndef QUANTUM_DIR - include ../../../../Makefile + include ../../../../../Makefile endif diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h index 9f9b050944..8cf4202cda 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/config.h @@ -10,15 +10,15 @@ #ifdef USE_BABLPASTE //define BabblePaste maps // Windows. -#define MS_MODE 0 -#define MAC_MODE 1 +#define MAC_MODE 0 +#define MS_MODE 1 //aka gnome+KDE //#define LINUX_MODE 2 //#define EMACS_MODE 3 -#define VI_MODE 4 -//#define WORDSTAR_MODE 5 +#define VI_MODE 3 // Readline and tmux -#define READMUX_MODE 6 +#define READMUX_MODE 2 +//#define WORDSTAR_MODE 5 #endif // Uncomment if you need more free flash space diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c index a662825475..3b2f53a0c1 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), /* -* |ESC | Win| MAC|RdLn| VI | | | | | | | | | | | | +* |ESC | MAC| Win|RdLn| VI | | | | | | | | | | | | * -------------------------------------------------------------------------------' * | | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del| * --------------------------------------------------------------------------- @@ -192,6 +192,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) /* If this is in the range of BABL macros, call a separate function */ /* Any clever remapping with modifiers should happen here e.g. shift bablkey does opposite*/ #ifdef USE_BABLPASTE + if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) { if (record->event.pressed) { // is there a case where this isn't desired? @@ -201,6 +202,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } #endif + // MACRODOWN only works in this function switch(id) { case 0: diff --git a/keyboards/handwired/MS-sculpt-mobile/readme.md b/keyboards/handwired/MS-sculpt-mobile/readme.md index 58029b50db..d435b449fb 100644 --- a/keyboards/handwired/MS-sculpt-mobile/readme.md +++ b/keyboards/handwired/MS-sculpt-mobile/readme.md @@ -53,6 +53,6 @@ The Astar mini has all pins exposed , so you can do 18x8 If you want a speaker, LEDs &etc, you'll need to free up a pin. I recommend joining columns R and L to the same pin. -Building - edit rules.mk to set ASTAR=1 or comment it out for teensy2++ +Building - add ASTAR=1 to the compile line or leave out for teensy2++ diff --git a/keyboards/handwired/MS-sculpt-mobile/rules.mk b/keyboards/handwired/MS-sculpt-mobile/rules.mk index 34ac78da81..680389c846 100644 --- a/keyboards/handwired/MS-sculpt-mobile/rules.mk +++ b/keyboards/handwired/MS-sculpt-mobile/rules.mk @@ -1,10 +1,10 @@ -#CFLAGS=-D ASTAR ## Project specific files SRC= babblePaste.c ifdef ASTAR + CFLAGS=-D ASTAR OPT_DEFS += -DBOOTLOADER_SIZE=4096 MCU = atmega32u4 OPT_DEFS += -DCATERINA_BOOTLOADER @@ -40,7 +40,8 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID AUDIO_ENABLE ?= no # Audio output on port C6 -USB ?= /dev/cu.usbmodem1421 +USB ?= /dev/cu.usbmodem14141 + upload: build -- cgit v1.2.3 From b5bfb5104b63766ab9a54509302a3f4b0b1d7b16 Mon Sep 17 00:00:00 2001 From: milestogo Date: Wed, 8 Mar 2017 15:48:39 -0800 Subject: docs for babblepaste --- .../handwired/MS-sculpt-mobile/babblePaste.txt | 586 ++++----------------- .../MS-sculpt-mobile/keymaps/milestogo/keymap.c | 10 +- 2 files changed, 115 insertions(+), 481 deletions(-) (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt b/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt index 6170ec7af5..cf75e153e8 100644 --- a/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt +++ b/keyboards/handwired/MS-sculpt-mobile/babblePaste.txt @@ -1,489 +1,123 @@ -/* A library to output the right key shortcut in any common app. -Given a global variable babble_mode to show the environment and a -key that calls the paste macro, do the right type of paste. -Setting the context is done by another macro, or TBD interaction with the host. + BabblePaste is a library of common macros used to make sure that +you can have one "paste" button on one layer, and it will do the +right thing on any OS or app. Windows=Ctrl-V. Mac = Command-V and so on. -Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts -and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c -*/ +The babblepaste library looks for the current status in a babble_mode global variable. +To switch modes, run the switch_babble_mode() function, or a pre defined macro. +Currently supported are Windows, OS X, Gnome/kde, Emacs, VI and readline, +across 42+ common macro actions. -#include "eeconfig.h" +###To use the library +1) Paste the following into your config.h. -// Comment out anything you will never use. -// Windows. -#define MS_MODE 0 -#define MAC_MODE 1 -//aka gnome+KDE -#define LINUX_MODE 2 -#define EMACS_MODE 3 -#define VI_MODE 4 -//#define WORDSTAR_MODE 5 +//////Begin////// +#define USE_BABLPASTE 1 + +#ifdef USE_BABLPASTE +/* define BabblePaste maps. Whatever = 0 will be the default. */ +// MAC_MODE 0 +// MS_MODE 1 +// LINUX_MODE 2 +// EMACS_MODE 3 +// VI_MODE 3 // Readline and tmux -#define READMUX 6 +// READMUX_MODE 2 +// WORDSTAR_MODE 5 +#endif -// GLOBAL variable. Sets startup default if no eeppom -char babble_mode = MAC_MODE ; +// Uncomment these to remove options an free up flash space +// This removes everything but cursor movement +// BABL_MOVEMENTONLY +// and this just removes browser shortcuts +// BABL_NOBROWSER +///////End/////// -/* minimum set required for babble: - // Cut & Paste - BABL_UNDO - BABL_REDO - BABL_CUT - BABL_COPY - BABL_PASTE - BABL_SELECT_ALL - - // Movement - BABL_DEL_RIGHT_1C - BABL_DEL_RIGHT_1C - BABL_DEL_LEFT_WORD - BABL_DEL_RIGHT_WORD - BABL_GO_LEFT_1C - BABL_GO_LEFT_WORD - BABL_GO_RIGHT_WORD - BABL_GOTO_START_LINE - BABL_GOTO_START_DOC - BABL_GOTO_END_LINE - BABL_GOTO_END_DOC - BABL_GOTO_NEXT_LINE // down arrow will do. - BABL_GOTO_PREV_LINE // up arrow will do. - BABL_PGDN - BABL_PGUP - - // GUI - BABL_FIND - BABL_FIND_NEXT - BABL_FIND_REPLACE - BABL_RUNAPP - BABL_SWITCH_NEXT - BABL_SWITCH_LAST // previous - BABL_CLOSE_APP - BABL_HELP -*/ +2) Add the following to your keymap in the action_get_macro +//////Begin////// +#ifdef USE_BABLPASTE + if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) { + if (record->event.pressed) { // is there a case where this isn't desired? + + babblePaste ( record, id ); + return MACRO_NONE; + } + } +#endif +///////End/////// +3) add Babbelpaste actions to your keymap. See the full list in babblePaste.h, or the +list below +B_L1C // go left 1 char +B_R1C // go Right 1 char + B_L1W //GO_LEFT_1 WORD + B_R1W //BABL_GO_RIGHT_1 WORD + B_GSOL // BABL_GOTO_START of _LINE + B_GEOL // BABL_GOTO_END_LINE + B_GTOP //BABL_GOTO_START_DOC + B_GEND //BABL_GO_END_DOC + B_DOWN //BABL_GO_NEXT_LINE + B_UP // BABL_GO_PREV_LINE + B_PGDN //PGDN + B_PGUP //PGUP +// B_BKSP //backspace so why bother. + B_DEL // DEL_RIGHT_1 Char // usually = Del + B_DLW // DEL_LEFT_ 1 WORD) + B_DRW //DEL_RIGHT_1 WORD + B_DEOL // delete from cursor to end of line + B_DSOL // delete from cursor to begining line + B_UNDO //UNDO + B_REDO // REDO + B_CUT // CUT) + B_COPY // COPY) + B_PAST // PASTE) + B_SELA // SELECT_ALL + B_FIND // FIND) + B_FINDN //FIND_NEXT) + B_FINDR // FIND_REPLACE) + B_RAPP // open application launcher + B_NAPP // switch to next app + B_PAPP // switch to previous app + B_CAPP // CLOSE_APP) + B_HELP // HELP) + B_NTAB // BROWSER_NEW_TAB) + B_CTAB //BROWSER_CLOSE_TAB) + B_ROTB //BROWSER_REOPEN_LAST_TAB) + B_NXTB //BROWSER_NEXT_TAB) + B_PTAB //BROWSER_PREV_TAB) + B_NURL //BROWSER_jump to URL_BAR) + B_BFWD // BROWSER_FORWARD (in history) + B_BBAK //BROWSER_BACK (in history) + B_BFND // BROWSER_FIND) + B_BOOK //BROWSER_New BOOKMARK) + B_BDEV //BROWSER_ Open DEV_TOOLS) // hard one to remember + B_BRLD // BROWSER_RELOAD Page + B_BFUlL // BROWSER_FULLSCREEN) + B_ZMIN // BROWSER_ZOOM_IN) + B_ZMOT //BROWSER_ZOOM_OUT) -static macro_t *babblePaste (keyrecord_t *record, uint16_t shortcut) { - switch(babble_mode) { - -#ifdef MS_MODE - case MS_MODE: - switch(shortcut) { - - case BABL_UNDO: - return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); - case BABL_REDO: - return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); - case BABL_CUT: - return MACRO( D(LCTRL), T(X), U(LCTRL), END ); - case BABL_COPY: - return MACRO( D(LCTRL), T(C), U(LCTRL), END ); - case BABL_PASTE: - return MACRO( D(LCTRL), T(V), U(LCTRL), END ); - case BABL_SELECT_ALL: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_DEL_RIGHT_1C: - return MACRO( D(DEL), END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); - case BABL_GOTO_START_LINE: - return MACRO( T(HOME), END ); - case BABL_GOTO_START_DOC: - return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); - case BABL_GOTO_END_LINE: - return MACRO( T(END), END ); - case BABL_GOTO_END_DOC: - return MACRO( D(LCTRL),T(END), U(LCTRL),END ); - case BABL_GOTO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GOTO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); - case BABL_FIND: - return MACRO( D(LCTRL),T(F), U(LCTRL),END ); - case BABL_FIND_NEXT: - return MACRO( T(F3),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LCTRL),T(H), U(LCTRL),END ); - case BABL_RUNAPP: - return MACRO( D(LGUI),T(R), U(LGUI),END ); - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LALT),T(TAB), U(LALT),END ); - case BABL_SWITCH_APP_LAST: - return MACRO( D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END ); - case BABL_CLOSE_APP: - return MACRO( D(LALT),T(F4), U(LALT),END ); - case BABL_HELP: - return MACRO( T(F1),END ); - break; - - return MACRO_NONE; - } - -#endif -#ifdef LINUX_MODE - case LINUX_MODE: - switch(shortcut) { - - case BABL_UNDO: - return MACRO( D(LCTRL), T(Z), U(LCTRL), END ); - case BABL_REDO: - return MACRO( D(LCTRL), T(Y), U(LCTRL), END ); - case BABL_CUT: - return MACRO( D(LCTRL), T(X), U(LCTRL), END ); - case BABL_COPY: - return MACRO( D(LCTRL), T(C), U(LCTRL), END ); - case BABL_PASTE: - return MACRO( D(LCTRL), T(V), U(LCTRL), END ); - case BABL_SELECT_ALL: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_DEL_RIGHT_1C: - return MACRO( D(DEL), END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTRL), T(BSPACE), U(LCTRL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LCTRL), T(DEL), U(LCTRL), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LCTRL), T(LEFT), U(LCTRL), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LCTRL), T(RIGHT), U(LCTRL), END ); - case BABL_GOTO_START_LINE: - return MACRO( T(HOME), END ); - case BABL_GOTO_START_DOC: - return MACRO( D(LCTRL),T(HOME), U(LCTRL),END ); - case BABL_GOTO_END_LINE: - return MACRO( T(END), END ); - case BABL_GOTO_END_DOC: - return MACRO( D(LCTRL),T(END), U(LCTRL),END ); - case BABL_GOTO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GOTO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); - case BABL_FIND: - return MACRO( D(LCTRL),T(F), U(LCTRL),END ); - case BABL_FIND_NEXT: - /* return MACRO( T(F3),END ); KDE */ - return MACRO( D(LCTRL),T(G), U(LCTRL),END ); // Gnome*/ - case BABL_FIND_REPLACE: - /* return MACRO( D(LCTRL),T(R), U(LCTRL),END ); KDE */ - return MACRO( D(LCTRL),T(H), U(LCTRL),END ); // Gnome*/ - case BABL_RUNAPP: - return MACRO( D(LALT),T(F2), U(LALT),END ); - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LCTL),T(TAB), U(LCTL),END ); - case BABL_SWITCH_APP_LAST: - return MACRO( D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END ); - case BABL_CLOSE_APP: - return MACRO( D(LALT),T(F4), U(LALT),END ); - case BABL_HELP: - return MACRO_NONE; - break; - - return MACRO_NONE; - } - -#endif - - - -#ifdef MAC_MODE - case MAC_MODE: - switch(shortcut) { - - case BABL_UNDO: - return MACRO( D(LGUI), T(Z), U(LGUI), END ); - case BABL_REDO: - return MACRO( D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END ); - case BABL_CUT: - return MACRO( D(LGUI), T(X), U(LGUI), END ); - case BABL_COPY: - return MACRO( D(LGUI), T(C), U(LGUI), END ); - case BABL_PASTE: - return MACRO( D(LGUI), T(V), U(LGUI), END ); - case BABL_SELECT_ALL: - return MACRO( D(LGUI), T(A), U(LGUI), END ); - case BABL_DEL_RIGHT_1C: - return MACRO( D(DEL), END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LALT), T(BSPACE), U(LALT), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(DEL), U(LALT), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(LEFT), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(RIGHT), U(LALT), END ); - case BABL_GOTO_START_LINE: - return MACRO( D(LGUI), T(LEFT), U(LGUI), END ); - case BABL_GOTO_START_DOC: - return MACRO( D(LGUI),T(UP), U(LGUI),END ); - case BABL_GOTO_END_LINE: - return MACRO( D(LGUI), T(RIGHT), U(LGUI), END ); - case BABL_GOTO_END_DOC: - return MACRO( D(LGUI),T(DOWN), U(LGUI),END ); - case BABL_GOTO_NEXT_LINE: - return MACRO( T(DOWN), END ); - case BABL_GOTO_PREV_LINE: - return MACRO( T(UP), END ); - case BABL_PGDN: - return MACRO( D(LALT), T(DOWN), U(LALT), END ); - case BABL_PGUP: - return MACRO( D(LALT), T(UP), U(LALT), END ); - case BABL_FIND: - return MACRO( D(LGUI),T(F), U(LGUI),END ); - case BABL_FIND_NEXT: - return MACRO( D(LGUI),T(G), U(LGUI),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LGUI),T(F), U(LGUI),END ); - case BABL_RUNAPP: - return MACRO( D(LGUI),T(R), U(LGUI),END ); - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LGUI),T(TAB), U(LGUI),END ); - case BABL_SWITCH_APP_LAST: - return MACRO( D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END ); - case BABL_CLOSE_APP: - return MACRO( D(LGUI),T(Q), U(LGUI),END ); - case BABL_HELP: - return MACRO( D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END ); - break; - - return MACRO_NONE; - } - -#endif - -#ifdef EMACS_MODE - case EMACS_MODE: - switch(shortcut) { -//probably should allow meta to not be ALT - case BABL_UNDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); - case BABL_REDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - case BABL_CUT: - return MACRO( D(LCTL), T(W), U(LCTL), END ); - case BABL_COPY: - return MACRO( D(LALT), T(W), U(LALT), END ); - case BABL_PASTE: - return MACRO( D(LCTL), T(Y), U(LCTL), END ); - case BABL_SELECT_ALL: - return MACRO(D(LCTL), T(X), U(LCTL),T(H), END ); - case BABL_DEL_RIGHT_1C: - return MACRO( D(LCTL), T(D), U(LCTL),END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTL), T(BSPACE), U(LCTL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(D), U(LALT), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(B), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(F), U(LALT), END ); - case BABL_GOTO_START_LINE: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_GOTO_START_DOC: - return MACRO( D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END ); - case BABL_GOTO_END_LINE: - return MACRO( D(LCTRL), T(E), U(LCTRL), END ); - case BABL_GOTO_END_DOC: - return MACRO( D(LALT), D(LSFT), T(DOT),U(LSFT), U(LALT) ,END ); - case BABL_GOTO_NEXT_LINE: - return MACRO( D(LCTRL), T(N), U(LCTRL), END ); - case BABL_GOTO_PREV_LINE: - rreturn MACRO( D(LCTRL), T(P), U(LCTRL), END ); - case BABL_PGDN: - return MACRO(D(LCTRL), T(V), U(LCTRL), END ); - case BABL_PGUP: - return MACRO( D(LALT), T(V), U(LALT), END ); - case BABL_FIND: - return MACRO( D(LCTRL), T(S), U(LCTRL),END ); - case BABL_FIND_NEXT: - return MACRO( D(LCTRL), T(S), U(LCTRL),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); - case BABL_RUNAPP: - return MACRO( D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably - case BABL_SWITCH_APP_LAST: - return MACRO( D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably - case BABL_CLOSE_APP: - return MACRO(D(LCTL), T(X), U(LCTL),T(C),END ); - case BABL_HELP: - return MACRO( D(LCTL),T(H), U(LCTL),T(A),END); // start search in help - break; - - return MACRO_NONE; - } - -#endif -#ifdef VI_MODE - case VI_MODE: - switch(shortcut) { -//assume esc is already called - case BABL_UNDO: - return MACRO( T(U), END ); - case BABL_REDO: - return MACRO( D(LCTL), T(R), U(LCTL), END ); - case BABL_CUT: - return MACRO( T(X), END ); - case BABL_COPY: - return MACRO( T(Y),END ); - case BABL_PASTE: - return MACRO( T(P), END ); - case BABL_SELECT_ALL: - return MACRO( T(COLN),T(PERC),T(Y), END ); // wrong but helpful? - case BABL_DEL_RIGHT_1C: - return MACRO( T(X),END ); - case BABL_DEL_LEFT_WORD: - return MACRO( T(D),T(G),T(E),END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( T(D),T(W),END ); - case BABL_GO_LEFT_1C: - return MACRO( T(H), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(L), END ); - case BABL_GO_LEFT_WORD: - return MACRO( T(B),END ); - case BABL_GO_RIGHT_WORD: - return MACRO( T(W), END ); - case BABL_GOTO_START_LINE: - return MACRO( T(CIRC), END ); - case BABL_GOTO_START_DOC: - return MACRO( T(G),T(G) ,END ); - case BABL_GOTO_END_LINE: - return MACRO( T(DLR), END ); - case BABL_GOTO_END_DOC: - return MACRO( D(LSFT), T(G),U(LSFT), ,END ); - case BABL_GOTO_NEXT_LINE: - return MACRO( T(J), END ); - case BABL_GOTO_PREV_LINE: - rreturn MACRO( T(K), END ); - case BABL_PGDN: - return MACRO(D(LCTRL), T(F), U(LCTRL), END ); - case BABL_PGUP: - return MACRO( D(LCTRL), T(B), U(LCTRL), END ); - case BABL_FIND: - return MACRO( T(SLASH),END ); - case BABL_FIND_NEXT: - return MACRO( T(N),END ); - case BABL_FIND_REPLACE: - return MACRO( D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END ); - case BABL_RUNAPP: - return MACRO_NONE; - case BABL_SWITCH_APP_NEXT: - return MACRO_NONE; - case BABL_SWITCH_APP_LAST: - return MACRO_NONE; - case BABL_CLOSE_APP: - return MACRO(T(COLN), T(Q), T(EXLM),END ); - case BABL_HELP: - return MACRO(T(COLN),T(H),END); // start search in help - break; - - return MACRO_NONE; - } - -#endif -#ifdef READMUX_MODE -// I havent decided how much to do bash and how much tmux - case READMUX_MODE: - switch(shortcut) { - case BABL_UNDO: - return MACRO( D(LALT), T(R), U(LALT) , END ); - case BABL_REDO: - return MACRO( D(LCTL), T(X), U(LCTL),T(C), END ); // arguably - case BABL_CUT: - return MACRO( D(LCTL), T(K), U(LCTL), END ); // wrong half the time - case BABL_COPY: - return MACRO_NONE; - case BABL_PASTE: - return MACRO( D(LCTL), T(Y), U(LCTL), END ); - case BABL_SELECT_ALL: - return MACRO(D(LCTL), T(A), T(K), T(Y), U(LCTL) , END ); // should this be tmux all? - case BABL_DEL_RIGHT_1C: - return MACRO( D(LCTL), T(D), U(LCTL),END ); - case BABL_DEL_LEFT_WORD: - return MACRO( D(LCTL), T(W), U(LCTL), END ); - case BABL_DEL_RIGHT_WORD: - return MACRO( D(LALT), T(D), U(LALT), END ); - case BABL_GO_LEFT_1C: - return MACRO( T(LEFT), END ); - case BABL_GO_RIGHT_1C: - return MACRO( T(RIGHT), END ); - case BABL_GO_LEFT_WORD: - return MACRO( D(LALT), T(B), U(LALT), END ); - case BABL_GO_RIGHT_WORD: - return MACRO( D(LALT), T(F), U(LALT), END ); - case BABL_GOTO_START_LINE: - return MACRO( D(LCTRL), T(A), U(LCTRL), END ); - case BABL_GOTO_START_DOC: - return MACRO_NONE; // tmux? - case BABL_GOTO_END_LINE: - return MACRO( D(LCTRL), T(E), U(LCTRL), END ); - case BABL_GOTO_END_DOC: - return MACRO_NONE; // tmux? - case BABL_GOTO_NEXT_LINE: - return MACRO( D(LCTRL), T(N), U(LCTRL), END ); - case BABL_GOTO_PREV_LINE: - return MACRO( D(LCTRL), T(P), U(LCTRL), END ); - case BABL_PGDN: - return MACRO( T(PGDN), END ); - case BABL_PGUP: - return MACRO( T(PGUP), END ); - case BABL_FIND: - return MACRO( D(LCTRL), T(R), U(LCTRL), END ); // search history - case BABL_FIND_NEXT: - eturn MACRO( D(LCTRL), T(S), U(LCTRL), END ); - case BABL_FIND_REPLACE: - return MACRO_NONE; // tmux? - case BABL_RUNAPP: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(C),END ); //tmux - case BABL_SWITCH_APP_NEXT: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(N),END ); //tmux - case BABL_SWITCH_APP_LAST: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(P),END ); //tmux - case BABL_CLOSE_APP: - return MACRO( D(LCTRL), T(B), U(LCTRL), T(D),END); // usually what I want - break; - case BABL_HELP: - return MACRO_NONE; - break; - - return MACRO_NONE; - } - -#endif - return MACRO_NONE; -} \ No newline at end of file +#### Development notes +-Why a new function? Because it would make the keymap too ugly to put it there. +-Why not return the macro to action_get_macro? Because I kept running into scope problems +and pointers to the wrong type. +-Why not an array of arrays as a lookup instead of a function? That would allow you +to store the lookup table in PROGMEM. True, but that takes more pre-processor skill +than I had. + +-Have you tested this on every platform? No. Submit a patch. + + +### Next steps for someone. +Make it easier to pair macros with modifiers. So key foo will jump to start of line, and +Shift(foo) will jump to the first tab in a browser. + +## Thanks + +Thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts +and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c +And of course QMK... + diff --git a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c index 3b2f53a0c1..395a9fb470 100644 --- a/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c +++ b/keyboards/handwired/MS-sculpt-mobile/keymaps/milestogo/keymap.c @@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \ M(VIBRK), KC_CIRC, KC_LCBR, KC_RCBR,KC_AT, KC_PERC, ____, KC_LBRC,KC_LPRN,KC_RPRN,KC_UNDS, ____, ____, ____,\ ____, KC_EXLM, KC_HASH, KC_0, KC_EQL, KC_LCBR, KC_RCBR,KC_MINS,KC_1, KC_PLUS,KC_RBRC, KC_GRV, ____, ____,\ - ____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_ASTR, ____, KC_DOT , KC_SLSH, ____, ____, ____,\ + ____, KC_SCLN, KC_TILDE, KC_COLN, KC_TILDE, KC_PIPE, KC_DLR, KC_ASTR, ____, KC_DOT , KC_SLSH, ____, ____, ____,\ ____, ____, ____, ____, ____, ____, ____, ____, ____, ____ ), /* @@ -108,11 +108,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * -------------------------------------------------------------------------------' * | | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del| * --------------------------------------------------------------------------- -* | tab | q | w |Find| |pTab |DSOL|DelW| Up |DelW|DEOL| [ | ] | \ | | +* | tab | | |Find| |pTab |DSOL|DelW| Up |DelW|DEOL| [ | ] | \ | | * -------------------------------------------------------------------------------' -* |Bak/Mov| a | s | d | |nTab |GSOL| <- | Dwn | -> | EOL | ' | enter |PgUp| +* |Bak/Mov| | | | |nTab |GSOL| <- | Dwn | -> | EOL | ' | enter |PgUp| * -------------------------------------------------------------------------------- -* |Lsft |Undo| Cut|Copy|Pste| b | n | m | , | . | / | Rsft| Up| PgDn| +* |Lsft |Undo| Cut|Copy|Pste| | | | | | / | Rsft| Up| PgDn| * --------------------------------------------------------------------------------- * |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght| * --------------------------------------------------------------------------------- @@ -189,7 +189,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { -/* If this is in the range of BABL macros, call a separate function */ +/* If id is in the range of BABL macros, call the babl function */ /* Any clever remapping with modifiers should happen here e.g. shift bablkey does opposite*/ #ifdef USE_BABLPASTE -- cgit v1.2.3 From a8f872e728cde990f7b272306480eedc96a7f3f7 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 9 Mar 2017 09:21:25 -0500 Subject: Initial commit for handwired numpad --- keyboards/handwired/numpad20/Makefile | 3 + keyboards/handwired/numpad20/config.h | 162 +++++++++++++++++++++ .../handwired/numpad20/keymaps/default/keymap.c | 16 ++ keyboards/handwired/numpad20/numpad20.c | 8 + keyboards/handwired/numpad20/numpad20.h | 20 +++ keyboards/handwired/numpad20/rules.mk | 83 +++++++++++ 6 files changed, 292 insertions(+) create mode 100644 keyboards/handwired/numpad20/Makefile create mode 100644 keyboards/handwired/numpad20/config.h create mode 100644 keyboards/handwired/numpad20/keymaps/default/keymap.c create mode 100644 keyboards/handwired/numpad20/numpad20.c create mode 100644 keyboards/handwired/numpad20/numpad20.h create mode 100644 keyboards/handwired/numpad20/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/numpad20/Makefile b/keyboards/handwired/numpad20/Makefile new file mode 100644 index 0000000000..191c6bb664 --- /dev/null +++ b/keyboards/handwired/numpad20/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/handwired/numpad20/config.h b/keyboards/handwired/numpad20/config.h new file mode 100644 index 0000000000..847f2111f5 --- /dev/null +++ b/keyboards/handwired/numpad20/config.h @@ -0,0 +1,162 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xBB80 +#define PRODUCT_ID 0x0504 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Hexwire +#define PRODUCT Numpad 20 +#define DESCRIPTION Handwired 4x5 numpad + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +/* + * 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 { F6, B1, B3, B6, B5 } +#define MATRIX_COL_PINS { D1, D0, F5, F4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* 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 */ + +/* 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 PAUSE +//#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/keyboards/handwired/numpad20/keymaps/default/keymap.c b/keyboards/handwired/numpad20/keymaps/default/keymap.c new file mode 100644 index 0000000000..37031206a9 --- /dev/null +++ b/keyboards/handwired/numpad20/keymaps/default/keymap.c @@ -0,0 +1,16 @@ +#include "numpad20.h" + +#define KC_ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = COMPACT_KEYMAP( + LEFT,RGHT, UP ,DOWN, \ + P7 , P8 , P9 ,PLUS, \ + P4 , P5 , P6 ,MINS, \ + P1 , P2 , P3 , ENT, \ + P0 ,DOT ,RGHT, TAB \ + ) +}; + +const uint16_t PROGMEM fn_actions[] = { +}; diff --git a/keyboards/handwired/numpad20/numpad20.c b/keyboards/handwired/numpad20/numpad20.c new file mode 100644 index 0000000000..101cf2cb4b --- /dev/null +++ b/keyboards/handwired/numpad20/numpad20.c @@ -0,0 +1,8 @@ +#include "numpad20.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} diff --git a/keyboards/handwired/numpad20/numpad20.h b/keyboards/handwired/numpad20/numpad20.h new file mode 100644 index 0000000000..191979be0d --- /dev/null +++ b/keyboards/handwired/numpad20/numpad20.h @@ -0,0 +1,20 @@ +#ifndef NUMPAD20_H +#define NUMPAD20_H + +#include "quantum.h" + +#define COMPACT_KEYMAP( \ + K00, K01, K02, K03, \ + K10, K11, K12, K13, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33, \ + K40, K41, K42, K43 \ + ) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03 }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13 }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23 }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33 }, \ + { KC_##K40, KC_##K41, KC_##K42, KC_##K43 } \ +} + +#endif \ No newline at end of file diff --git a/keyboards/handwired/numpad20/rules.mk b/keyboards/handwired/numpad20/rules.mk new file mode 100644 index 0000000000..e897ef2523 --- /dev/null +++ b/keyboards/handwired/numpad20/rules.mk @@ -0,0 +1,83 @@ + +# MCU name +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=512 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 + +ifndef QUANTUM_DIR + include ../../../Makefile +endif + +avrdude: build + ls /dev/tty* > /tmp/1; \ + echo "Reset your Pro Micro now"; \ + while [[ -z $$USB ]]; do \ + sleep 1; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex + +.PHONY: avrdude -- cgit v1.2.3 From 20a48e0198b02a246dce2b729c14809ccaa471c6 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 9 Mar 2017 12:02:05 -0500 Subject: Add handwired 5x13 ortholinear keyboard --- keyboards/handwired/ortho5x13/Makefile | 3 + keyboards/handwired/ortho5x13/config.h | 162 ++++++++++++ .../handwired/ortho5x13/keymaps/default/keymap.c | 289 +++++++++++++++++++++ keyboards/handwired/ortho5x13/ortho5x13.c | 8 + keyboards/handwired/ortho5x13/ortho5x13.h | 36 +++ keyboards/handwired/ortho5x13/rules.mk | 83 ++++++ 6 files changed, 581 insertions(+) create mode 100644 keyboards/handwired/ortho5x13/Makefile create mode 100644 keyboards/handwired/ortho5x13/config.h create mode 100644 keyboards/handwired/ortho5x13/keymaps/default/keymap.c create mode 100644 keyboards/handwired/ortho5x13/ortho5x13.c create mode 100644 keyboards/handwired/ortho5x13/ortho5x13.h create mode 100644 keyboards/handwired/ortho5x13/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/ortho5x13/Makefile b/keyboards/handwired/ortho5x13/Makefile new file mode 100644 index 0000000000..191c6bb664 --- /dev/null +++ b/keyboards/handwired/ortho5x13/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/handwired/ortho5x13/config.h b/keyboards/handwired/ortho5x13/config.h new file mode 100644 index 0000000000..f85159596c --- /dev/null +++ b/keyboards/handwired/ortho5x13/config.h @@ -0,0 +1,162 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xBB80 +#define PRODUCT_ID 0x050D +#define DEVICE_VER 0x0001 +#define MANUFACTURER Hexwire +#define PRODUCT Ortho 5x13 +#define DESCRIPTION Handwired 5x13 ortholinear keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 13 + +/* + * 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 { D3, D2, D1, D0, D4 } +#define MATRIX_COL_PINS { C6, D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* 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 */ + +/* 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 PAUSE +//#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/keyboards/handwired/ortho5x13/keymaps/default/keymap.c b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c new file mode 100644 index 0000000000..c1262a83d7 --- /dev/null +++ b/keyboards/handwired/ortho5x13/keymaps/default/keymap.c @@ -0,0 +1,289 @@ +#include "ortho5x13.h" +#include "action_layer.h" +#include "eeconfig.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + BACKLIT +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +#define KC_L1 LOWER +#define KC_L2 RAISE + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,------------------------------------------------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | + * |------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | + * |------+------+------+------+------+-------------+------+------+------+------+------+------| + * | ` | A | S | D | F | G | H | J | K | L | ; | ' | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | Up | + * |------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Hyper| Ctrl | Alt | GUI |Lower | Space |Raise | Bksp |Shift | Left | Down |Right | + * `------------------------------------------------------------------------------------------' + */ +[_QWERTY] = COMPACT_KEYMAP( + //,----+----+----+----+----+----+----+----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS,EQL , + //|----+----+----+----+----+----+----+----+----+----+----+----+----| + TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC,RBRC, + //|----+----+----+----+----+----+----+----+----+----+----+----+----| + GRV , A , S , D , F , G , H , J , K , L ,SCLN,QUOT,BSLS, + //|----+----+----+----+----+----+----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,ENT , UP , + //|----+----+----+----+----+---------+----+----+----+----+----+----| + HYPR,LCTL,LALT,LGUI, L1 , SPACE , L2 ,BSPC,RSFT,LEFT,RGHT,DOWN + //`----+----+----+----+----+---------+----+----+----+----+----+----' + ), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, + {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | " | , | . | P | Y | F | G | C | R | L | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL}, + {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, + {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, + {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL}, + {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Audoff|Aud on|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | |Voice-|Voice+|Musoff|Mus on| | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, + {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, + {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, + {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +} + + +}; + +#ifdef AUDIO_ENABLE +float tone_startup[][2] = { + {NOTE_B5, 20}, + {NOTE_B6, 8}, + {NOTE_DS6, 20}, + {NOTE_B6, 8} +}; + +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); + +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); + +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +#endif + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistant_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + return false; + break; + } + return true; +}; + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() +{ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_NOTE_ARRAY(music_scale, false, 0); +} + +#endif \ No newline at end of file diff --git a/keyboards/handwired/ortho5x13/ortho5x13.c b/keyboards/handwired/ortho5x13/ortho5x13.c new file mode 100644 index 0000000000..cf8352cc43 --- /dev/null +++ b/keyboards/handwired/ortho5x13/ortho5x13.c @@ -0,0 +1,8 @@ +#include "ortho5x13.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} diff --git a/keyboards/handwired/ortho5x13/ortho5x13.h b/keyboards/handwired/ortho5x13/ortho5x13.h new file mode 100644 index 0000000000..d442212fe9 --- /dev/null +++ b/keyboards/handwired/ortho5x13/ortho5x13.h @@ -0,0 +1,36 @@ +#ifndef ORTHO5X13_H +#define ORTHO5X13_H + +#include "quantum.h" + +#define KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \ + k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b, k4c \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c }, \ + { k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b, k3c }, \ + { k40, k41, k42, k43, k44, k45, KC_NO, k47, k48, k49, k4a, k4b, k4c } \ +} + +#define COMPACT_KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \ + k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b, k4c \ +) \ +{ \ + { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_##k06, KC_##k07, KC_##k08, KC_##k09, KC_##k0a, KC_##k0b, KC_##k0c }, \ + { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_##k16, KC_##k17, KC_##k18, KC_##k19, KC_##k1a, KC_##k1b, KC_##k1c }, \ + { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_##k26, KC_##k27, KC_##k28, KC_##k29, KC_##k2a, KC_##k2b, KC_##k2c }, \ + { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35, KC_##k35, KC_##k37, KC_##k38, KC_##k39, KC_##k3a, KC_##k3b, KC_##k3c }, \ + { KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, KC_##k45, KC_NO, KC_##k47, KC_##k48, KC_##k49, KC_##k4a, KC_##k4b, KC_##k4c } \ +} + +#endif \ No newline at end of file diff --git a/keyboards/handwired/ortho5x13/rules.mk b/keyboards/handwired/ortho5x13/rules.mk new file mode 100644 index 0000000000..e897ef2523 --- /dev/null +++ b/keyboards/handwired/ortho5x13/rules.mk @@ -0,0 +1,83 @@ + +# MCU name +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=512 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 + +ifndef QUANTUM_DIR + include ../../../Makefile +endif + +avrdude: build + ls /dev/tty* > /tmp/1; \ + echo "Reset your Pro Micro now"; \ + while [[ -z $$USB ]]; do \ + sleep 1; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex + +.PHONY: avrdude -- cgit v1.2.3 From 71857ebc3f410b918481f4a6bbed93f1cb2eec65 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 28 Mar 2017 09:17:09 -0400 Subject: Move Atreus50 to hardwired directory and update README --- keyboards/handwired/atreus50/Makefile | 3 + keyboards/handwired/atreus50/atreus50.c | 10 + keyboards/handwired/atreus50/atreus50.h | 36 +++ keyboards/handwired/atreus50/config.h | 163 ++++++++++++++ .../handwired/atreus50/keymaps/default/Makefile | 6 + .../handwired/atreus50/keymaps/default/keymap.c | 250 +++++++++++++++++++++ keyboards/handwired/atreus50/readme.md | 16 ++ keyboards/handwired/atreus50/rules.mk | 81 +++++++ 8 files changed, 565 insertions(+) create mode 100644 keyboards/handwired/atreus50/Makefile create mode 100644 keyboards/handwired/atreus50/atreus50.c create mode 100644 keyboards/handwired/atreus50/atreus50.h create mode 100644 keyboards/handwired/atreus50/config.h create mode 100644 keyboards/handwired/atreus50/keymaps/default/Makefile create mode 100644 keyboards/handwired/atreus50/keymaps/default/keymap.c create mode 100644 keyboards/handwired/atreus50/readme.md create mode 100644 keyboards/handwired/atreus50/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/atreus50/Makefile b/keyboards/handwired/atreus50/Makefile new file mode 100644 index 0000000000..57b2ef62e5 --- /dev/null +++ b/keyboards/handwired/atreus50/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif diff --git a/keyboards/handwired/atreus50/atreus50.c b/keyboards/handwired/atreus50/atreus50.c new file mode 100644 index 0000000000..225a51bcce --- /dev/null +++ b/keyboards/handwired/atreus50/atreus50.c @@ -0,0 +1,10 @@ +#include "atreus50.h" + +void matrix_init_kb(void) { + + // Turn status LED on + //DDRE |= (1<<6); + PORTE |= (1<<6); + + matrix_init_user(); +}; diff --git a/keyboards/handwired/atreus50/atreus50.h b/keyboards/handwired/atreus50/atreus50.h new file mode 100644 index 0000000000..de06f255e8 --- /dev/null +++ b/keyboards/handwired/atreus50/atreus50.h @@ -0,0 +1,36 @@ +#ifndef ATREUS50_H +#define ATREUS50_H + +#include "quantum.h" + +// The first section contains all of the arguements +// The second converts the arguments into a two-dimensional array +#define KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ + k30, k31, k32, k33, k34, k35, km0, km1, k36, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, KC_NO, k06, k07, k08, k09, k0a, k0b }, \ + { k10, k11, k12, k13, k14, k15, KC_NO, k16, k17, k18, k19, k1a, k1b }, \ + { k20, k21, k22, k23, k24, k25, km0, k26, k27, k28, k29, k2a, k2b }, \ + { k30, k31, k32, k33, k34, k35, km1, k36, k37, k38, k39, k3a, k3b } \ +} + +#define COMPACT_KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ + k30, k31, k32, k33, k34, k35, km0, km1, k36, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_NO, KC_##k06, KC_##k07, KC_##k08, KC_##k09, KC_##k0a, KC_##k0b }, \ + { KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_NO, KC_##k16, KC_##k17, KC_##k18, KC_##k19, KC_##k1a, KC_##k1b }, \ + { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_##km0, KC_##k26, KC_##k27, KC_##k28, KC_##k29, KC_##k2a, KC_##k2b }, \ + { KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35, KC_##km1, KC_##k36, KC_##k37, KC_##k38, KC_##k39, KC_##k3a, KC_##k3b } \ +} + +#define KC_ KC_TRNS + +#endif diff --git a/keyboards/handwired/atreus50/config.h b/keyboards/handwired/atreus50/config.h new file mode 100644 index 0000000000..2e34e0f898 --- /dev/null +++ b/keyboards/handwired/atreus50/config.h @@ -0,0 +1,163 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xBB80 +#define PRODUCT_ID 0x040D +#define DEVICE_VER 0x0001 +#define MANUFACTURER Hexwire +#define PRODUCT Atreus 50 Keyboard +#define DESCRIPTION Atreus layout with extra column + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 13 + +/* Planck PCB default pin-out */ +#define MATRIX_ROW_PINS { D3, D2, D1, D0 } +#define MATRIX_COL_PINS { D4, D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + + +/* 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 */ + +/* 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 + + +/* ws2812 RGB LED */ +#define RGB_DI_PIN C6 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + + +/* + * 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 PAUSE +//#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/keyboards/handwired/atreus50/keymaps/default/Makefile b/keyboards/handwired/atreus50/keymaps/default/Makefile new file mode 100644 index 0000000000..d7b0fa7fd8 --- /dev/null +++ b/keyboards/handwired/atreus50/keymaps/default/Makefile @@ -0,0 +1,6 @@ +RGBLIGHT_ENABLE = yes +AUDIO_ENABLE = no + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/handwired/atreus50/keymaps/default/keymap.c b/keyboards/handwired/atreus50/keymaps/default/keymap.c new file mode 100644 index 0000000000..415405ec23 --- /dev/null +++ b/keyboards/handwired/atreus50/keymaps/default/keymap.c @@ -0,0 +1,250 @@ +#include "atreus50.h" +#include "action_layer.h" +#include "eeconfig.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _MOVEMENT 5 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + MOVEMENT, + BACKLIT +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define KC_X0 MT(MOD_LCTL, KC_ESC) // Hold for Left Ctrl, Tap for ESC +#define KC_X1 LOWER +#define KC_X2 RAISE +#define KC_X3 MO(_MOVEMENT) +#define KC_X4 MT(MOD_LSFT, KC_ENT) // Hold for Left Shift, Tap for Enter + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = COMPACT_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, X4 , + //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| + GRV ,LCTL,LALT,LGUI, X1 ,SPC , X3 ,RSFT,BSPC, X2 ,LEFT,DOWN, UP ,RGHT + //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' + ), + + [_COLEMAK] = COMPACT_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,MINS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X0 , A , R , S , T , D , H , N , E , I , O ,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSFT, Z , X , C , V , B , K , M ,COMM,DOT ,SLSH, X4 , + //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| + GRV ,LCTL,LALT,LGUI, X1 ,SPC , X3 ,RSFT,BSPC, X2 ,LEFT,DOWN, UP ,RGHT + //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' + ), + + [_DVORAK] = COMPACT_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,MINS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X0 , A , O , E , U , I , D , H , R , N , S ,SLSH, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSFT,SCLN, Q , J , K , X , B , M , W , V , Z , X4 , + //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| + GRV ,LCTL,LALT,LGUI, X1 ,SPC , X3 ,RSFT,BSPC, X2 ,LEFT,DOWN, UP ,RGHT + //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' + ), + + [_LOWER] = COMPACT_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,DEL , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + DEL , F1 , F2 , F3 , F4 , F5 , F6 ,UNDS,PLUS,LCBR,RCBR,PIPE, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , F7 , F8 , F9 ,F10 ,F11 , F12 ,END , , , , , + //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| + , , , , , , , , , ,MNXT,VOLD,VOLU,MPLY + //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' + ), + + [_RAISE] = COMPACT_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + GRV , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,DEL , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + DEL , F1 , F2 , F3 , F4 , F5 , F6 ,MINS,EQL ,LBRC,RBRC,BSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , F7 , F8 , F9 ,F10 ,F11 , F12 ,NUHS,NUBS, , , , + //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| + , , , , , , , , , ,MNXT,VOLD,VOLU,MPLY + //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' + ), + + [_MOVEMENT] = COMPACT_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR, UP ,LPRN,RPRN,DEL , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + DEL , F1 , F2 , F3 , F4 , F5 , F6 ,LEFT,DOWN,RGHT,RCBR,PIPE, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , F7 , F8 , F9 ,F10 ,F11 , F12 ,END , , , , , + //|----+----+----+----+----+----|----+----|----+----+----+----+----+----| + , , , , , , , ,PGDN,PGUP,MNXT,VOLD,VOLU,MPLY + //`----+----+----+----+----+----+----+----+----+----+----+----+----+----' + ), + +/* Adjust (Lower + Raise) + * |------+------+------+------+------+------. ,------+------+------+------+------+------| + * | | Reset| | | | | | | | | | | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | |Audoff|Aud on|AGnorm| |AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | |Voice-|Voice+|Musoff|Mus on| | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | | | + * `-------------------------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, RESET, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) + +}; + +#ifdef AUDIO_ENABLE +float tone_startup[][2] = { + {NOTE_B5, 20}, + {NOTE_B6, 8}, + {NOTE_DS6, 20}, + {NOTE_B6, 8} +}; + +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); + +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); + +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +#endif + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistant_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + return false; + break; + } + return true; +}; + +void matrix_init_user(void) { + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() +{ + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_NOTE_ARRAY(music_scale, false, 0); +} + +#endif diff --git a/keyboards/handwired/atreus50/readme.md b/keyboards/handwired/atreus50/readme.md new file mode 100644 index 0000000000..0c24f67db2 --- /dev/null +++ b/keyboards/handwired/atreus50/readme.md @@ -0,0 +1,16 @@ +Handwired Atreus50 +================== + +This firmware is for a Handwired Atreus50 using an Arduino Pro Micro. + +## Pinout + +The following pins are used: +- Columns 1-13: D4, D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 +- Rows 1-4: D3, D2, D1, D0 + +## Compiling and loading the firmware + +To build the firmware, run `make`. + +To flash the firemware onto the microcontroller, run `make avrdude`, and press the reset button. diff --git a/keyboards/handwired/atreus50/rules.mk b/keyboards/handwired/atreus50/rules.mk new file mode 100644 index 0000000000..7770ea2a27 --- /dev/null +++ b/keyboards/handwired/atreus50/rules.mk @@ -0,0 +1,81 @@ + + +# 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 +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +avrdude: build + ls /dev/tty* > /tmp/1; \ + echo "Reset your Pro Micro now"; \ + while [[ -z $$USB ]]; do \ + sleep 1; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex + +.PHONY: avrdude -- cgit v1.2.3