diff options
| -rw-r--r-- | keyboards/pegasushoof/Makefile | 3 | ||||
| -rw-r--r-- | keyboards/pegasushoof/README.md | 24 | ||||
| -rw-r--r-- | keyboards/pegasushoof/config.h | 46 | ||||
| -rw-r--r-- | keyboards/pegasushoof/keymaps/blowrak/Makefile | 22 | ||||
| -rw-r--r-- | keyboards/pegasushoof/keymaps/blowrak/keymap.c | 112 | ||||
| -rw-r--r-- | keyboards/pegasushoof/keymaps/default/Makefile | 22 | ||||
| -rw-r--r-- | keyboards/pegasushoof/keymaps/default/keymap.c | 60 | ||||
| -rw-r--r-- | keyboards/pegasushoof/matrix.c | 204 | ||||
| -rw-r--r-- | keyboards/pegasushoof/pegasushoof.c | 51 | ||||
| -rw-r--r-- | keyboards/pegasushoof/pegasushoof.h | 51 | ||||
| -rw-r--r-- | keyboards/pegasushoof/rules.mk | 67 |
11 files changed, 662 insertions, 0 deletions
diff --git a/keyboards/pegasushoof/Makefile b/keyboards/pegasushoof/Makefile new file mode 100644 index 000000000..57b2ef62e --- /dev/null +++ b/keyboards/pegasushoof/Makefile | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | ifndef MAKEFILE_INCLUDED | ||
| 2 | include ../../Makefile | ||
| 3 | endif | ||
diff --git a/keyboards/pegasushoof/README.md b/keyboards/pegasushoof/README.md new file mode 100644 index 000000000..074222c71 --- /dev/null +++ b/keyboards/pegasushoof/README.md | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | pegasushoof keyboard firmware | ||
| 2 | ============================= | ||
| 3 | |||
| 4 | ## Quantum MK Firmware | ||
| 5 | |||
| 6 | For the full Quantum feature list, see [the parent README.md](/README.md). | ||
| 7 | |||
| 8 | ## Building | ||
| 9 | |||
| 10 | Download or clone the whole firmware and navigate to the `keyboard/pegasushoof` 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. | ||
| 11 | |||
| 12 | Depending on which keymap you would like to use, you will have to compile slightly differently. | ||
| 13 | |||
| 14 | ### Default | ||
| 15 | To build all keymaps, simply run `make`, the `.hex` files will end up in the top directory. | ||
| 16 | |||
| 17 | ### Specific Keymap | ||
| 18 | Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>/keymap.c` in the `keymaps` folder, and see keymap document (you can find in top README.md) and existent keymap files. | ||
| 19 | |||
| 20 | To build the firmware binary hex file with a keymap just enter the keymap directory and type `make`: | ||
| 21 | ``` | ||
| 22 | $ cd keymaps/default | ||
| 23 | $ make | ||
| 24 | ``` | ||
diff --git a/keyboards/pegasushoof/config.h b/keyboards/pegasushoof/config.h new file mode 100644 index 000000000..0dbec26e4 --- /dev/null +++ b/keyboards/pegasushoof/config.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Daniel Svensson <dsvensson@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xFEED | ||
| 25 | #define PRODUCT_ID 0x6050 | ||
| 26 | #define DEVICE_VER 0x0104 | ||
| 27 | #define MANUFACTURER Filco | ||
| 28 | #define PRODUCT Majestouch TKL \\w The Pegasus Hoof | ||
| 29 | #define DESCRIPTION QMK firmware for Majestouch TKL | ||
| 30 | |||
| 31 | /* key matrix size */ | ||
| 32 | #define MATRIX_ROWS 8 | ||
| 33 | #define MATRIX_COLS 18 | ||
| 34 | |||
| 35 | /* COL2ROW or ROW2COL */ | ||
| 36 | #define DIODE_DIRECTION COL2ROW | ||
| 37 | |||
| 38 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 39 | #define DEBOUNCING_DELAY 5 | ||
| 40 | |||
| 41 | /* key combination for magic key command */ | ||
| 42 | #define IS_COMMAND() ( \ | ||
| 43 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 44 | ) | ||
| 45 | |||
| 46 | #endif | ||
diff --git a/keyboards/pegasushoof/keymaps/blowrak/Makefile b/keyboards/pegasushoof/keymaps/blowrak/Makefile new file mode 100644 index 000000000..fec0d2d97 --- /dev/null +++ b/keyboards/pegasushoof/keymaps/blowrak/Makefile | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # Build Options | ||
| 2 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 3 | # the appropriate keymap folder that will get included automatically | ||
| 4 | # | ||
| 5 | BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) | ||
| 6 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 7 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 8 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
| 9 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 10 | CUSTOM_MATRIX ?= yes # Custom matrix file for the Pegasus Hoof due to the 2x74HC42 | ||
| 11 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 12 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 13 | MIDI_ENABLE ?= no # MIDI controls | ||
| 14 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 15 | UNICODE_ENABLE ?= no # Unicode | ||
| 16 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 17 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 18 | |||
| 19 | |||
| 20 | ifndef QUANTUM_DIR | ||
| 21 | include ../../../../Makefile | ||
| 22 | endif | ||
diff --git a/keyboards/pegasushoof/keymaps/blowrak/keymap.c b/keyboards/pegasushoof/keymaps/blowrak/keymap.c new file mode 100644 index 000000000..6faf4db6f --- /dev/null +++ b/keyboards/pegasushoof/keymaps/blowrak/keymap.c | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Daniel Svensson <dsvensson@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "pegasushoof.h" | ||
| 19 | |||
| 20 | #define _______ KC_TRNS | ||
| 21 | |||
| 22 | /* Swedish keys */ | ||
| 23 | #define SE_HALF KC_GRV | ||
| 24 | #define SE_PLUS KC_MINS | ||
| 25 | #define SE_ACUT KC_EQL | ||
| 26 | #define SE_AO KC_LBRC | ||
| 27 | #define SE_CIRC KC_RBRC | ||
| 28 | #define SE_QUOT KC_BSLS | ||
| 29 | #define SE_OE KC_SCLN | ||
| 30 | #define SE_AE KC_QUOT | ||
| 31 | #define SE_MINS KC_SLSH | ||
| 32 | #define SE_LTGT KC_NUBS | ||
| 33 | #define SE_LCBR RALT(KC_7) | ||
| 34 | #define SE_LBRC RALT(KC_8) | ||
| 35 | #define SE_RBRC RALT(KC_9) | ||
| 36 | #define SE_RCBR RALT(KC_0) | ||
| 37 | #define SE_PIPE RALT(SE_LTGT) | ||
| 38 | #define SE_BSLS RALT(SE_PLUS) | ||
| 39 | |||
| 40 | #define KM_BLOWRAK 0 | ||
| 41 | #define KM_QWERTY 1 | ||
| 42 | #define KM_MEDIA 2 | ||
| 43 | #define KM_HAXHAX 3 | ||
| 44 | |||
| 45 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 46 | /* Layer 0: Blowrak ISO layer, a Swedish take on Dvorak */ | ||
| 47 | [KM_BLOWRAK] = KEYMAP( \ | ||
| 48 | 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_PSCR,KC_SLCK,KC_PAUS, \ | ||
| 49 | SE_HALF, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, SE_PLUS,SE_ACUT,KC_BSPC, KC_INS, KC_HOME,KC_PGUP, \ | ||
| 50 | KC_TAB, SE_AO, SE_AE, SE_OE, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_COMM,SE_CIRC,SE_QUOT, KC_DEL, KC_END, KC_PGDN, \ | ||
| 51 | KC_LCTRL,KC_A, KC_O, KC_E, KC_U, KC_I, KC_H, KC_D, KC_T, KC_N, KC_S, SE_MINS, KC_ENT, \ | ||
| 52 | KC_LSFT, SE_LTGT,KC_DOT, KC_Q, KC_J, KC_K, KC_B, KC_X, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_UP, \ | ||
| 53 | KC_FN0, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT), | ||
| 54 | /* Layer 1: Standard ISO layer */ | ||
| 55 | [KM_QWERTY] = KEYMAP( \ | ||
| 56 | 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_PSCR,KC_SLCK,KC_PAUS, \ | ||
| 57 | SE_HALF, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, SE_PLUS,SE_ACUT,KC_BSPC, KC_INS, KC_HOME,KC_PGUP, \ | ||
| 58 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, SE_AO, SE_CIRC,SE_QUOT, KC_DEL, KC_END, KC_PGDN, \ | ||
| 59 | KC_LCTRL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SE_OE, SE_AE, KC_ENT, \ | ||
| 60 | KC_LSFT, SE_LTGT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, SE_MINS, KC_RSFT, KC_UP, \ | ||
| 61 | KC_FN0, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT), | ||
| 62 | /* Layer 2: Media layer */ | ||
| 63 | [KM_MEDIA] = KEYMAP( \ | ||
| 64 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \ | ||
| 65 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,KC_VOLU, \ | ||
| 66 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_MUTE,_______,KC_VOLD, \ | ||
| 67 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ | ||
| 68 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_MPLY, \ | ||
| 69 | _______,_______,_______, _______, _______,_______,RESET ,_______, KC_MPRV,KC_MSTP,KC_MNXT), | ||
| 70 | /* Layer 3: Programming layer */ | ||
| 71 | [KM_HAXHAX] = KEYMAP( \ | ||
| 72 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 73 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 74 | _______,SE_LCBR,SE_PIPE,SE_RCBR,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \ | ||
| 75 | _______,SE_LBRC,SE_BSLS,SE_RBRC,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ | ||
| 76 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, \ | ||
| 77 | _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______), | ||
| 78 | }; | ||
| 79 | |||
| 80 | const uint16_t PROGMEM fn_actions[] = { | ||
| 81 | [0] = ACTION_LAYER_MOMENTARY(KM_MEDIA), | ||
| 82 | [1] = ACTION_LAYER_TOGGLE(KM_QWERTY) | ||
| 83 | }; | ||
| 84 | |||
| 85 | void matrix_scan_user(void) | ||
| 86 | { | ||
| 87 | uint8_t layer = biton32(layer_state); | ||
| 88 | switch (layer) { | ||
| 89 | case KM_BLOWRAK: | ||
| 90 | ph_caps_led_on(); | ||
| 91 | ph_sclk_led_off(); | ||
| 92 | break; | ||
| 93 | case KM_QWERTY: | ||
| 94 | ph_sclk_led_on(); | ||
| 95 | ph_caps_led_off(); | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | /* Mixes in KM_HAXHAX via RALT modifier without shadowing the RALT key combinations. */ | ||
| 101 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 102 | uint8_t modifiers = get_mods(); | ||
| 103 | if (modifiers & MOD_BIT(KC_RALT) && record->event.pressed) { | ||
| 104 | uint16_t kc = keymap_key_to_keycode(KM_HAXHAX, record->event.key); | ||
| 105 | if (kc != KC_TRNS) { | ||
| 106 | register_code(kc); | ||
| 107 | unregister_code(kc); | ||
| 108 | return false; | ||
| 109 | } | ||
| 110 | } | ||
| 111 | return true; | ||
| 112 | } | ||
diff --git a/keyboards/pegasushoof/keymaps/default/Makefile b/keyboards/pegasushoof/keymaps/default/Makefile new file mode 100644 index 000000000..fec0d2d97 --- /dev/null +++ b/keyboards/pegasushoof/keymaps/default/Makefile | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # Build Options | ||
| 2 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 3 | # the appropriate keymap folder that will get included automatically | ||
| 4 | # | ||
| 5 | BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) | ||
| 6 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 7 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 8 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
| 9 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 10 | CUSTOM_MATRIX ?= yes # Custom matrix file for the Pegasus Hoof due to the 2x74HC42 | ||
| 11 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 12 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 13 | MIDI_ENABLE ?= no # MIDI controls | ||
| 14 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 15 | UNICODE_ENABLE ?= no # Unicode | ||
| 16 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 17 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 18 | |||
| 19 | |||
| 20 | ifndef QUANTUM_DIR | ||
| 21 | include ../../../../Makefile | ||
| 22 | endif | ||
diff --git a/keyboards/pegasushoof/keymaps/default/keymap.c b/keyboards/pegasushoof/keymaps/default/keymap.c new file mode 100644 index 000000000..aa006b23a --- /dev/null +++ b/keyboards/pegasushoof/keymaps/default/keymap.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Daniel Svensson <dsvensson@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "pegasushoof.h" | ||
| 19 | |||
| 20 | #define _______ KC_TRNS | ||
| 21 | |||
| 22 | #define KM_QWERTY 0 | ||
| 23 | #define KM_MEDIA 1 | ||
| 24 | |||
| 25 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 26 | /* Layer 0: Standard ISO layer */ | ||
| 27 | [KM_QWERTY] = KEYMAP( \ | ||
| 28 | 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_PSCR,KC_SLCK,KC_PAUS, \ | ||
| 29 | KC_GRV, 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_INS, KC_HOME,KC_PGUP, \ | ||
| 30 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ | ||
| 31 | KC_CLCK, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ | ||
| 32 | KC_LSFT, KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ | ||
| 33 | KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN0, KC_LEFT,KC_DOWN,KC_RGHT), | ||
| 34 | /* Layer 1: Function layer */ | ||
| 35 | [KM_MEDIA] = KEYMAP( \ | ||
| 36 | _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \ | ||
| 37 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,KC_VOLU, \ | ||
| 38 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,KC_VOLD, \ | ||
| 39 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \ | ||
| 40 | _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_MPLY, \ | ||
| 41 | _______,_______,_______, _______, _______,_______,RESET ,_______, KC_MPRV,KC_MSTP,KC_MNXT) | ||
| 42 | }; | ||
| 43 | |||
| 44 | const uint16_t PROGMEM fn_actions[] = { | ||
| 45 | [0] = ACTION_LAYER_MOMENTARY(KM_MEDIA) | ||
| 46 | }; | ||
| 47 | |||
| 48 | void led_set_user(uint8_t usb_led) { | ||
| 49 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 50 | ph_caps_led_on(); | ||
| 51 | } else { | ||
| 52 | ph_caps_led_off(); | ||
| 53 | } | ||
| 54 | |||
| 55 | if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { | ||
| 56 | ph_sclk_led_on(); | ||
| 57 | } else { | ||
| 58 | ph_sclk_led_off(); | ||
| 59 | } | ||
| 60 | } | ||
diff --git a/keyboards/pegasushoof/matrix.c b/keyboards/pegasushoof/matrix.c new file mode 100644 index 000000000..d2a74b8d7 --- /dev/null +++ b/keyboards/pegasushoof/matrix.c | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2014 Ralf Schmitt <ralf@bunkertor.net> | ||
| 3 | Copyright 2016 Daniel Svensson <dsvensson@gmail.com> | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stdint.h> | ||
| 20 | #include <stdbool.h> | ||
| 21 | #include <avr/io.h> | ||
| 22 | #include <util/delay.h> | ||
| 23 | #include "wait.h" | ||
| 24 | #include "print.h" | ||
| 25 | #include "debug.h" | ||
| 26 | #include "util.h" | ||
| 27 | #include "matrix.h" | ||
| 28 | |||
| 29 | static uint8_t debouncing = DEBOUNCING_DELAY; | ||
| 30 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 31 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 32 | |||
| 33 | static matrix_row_t read_cols(void); | ||
| 34 | static void select_row(uint8_t col); | ||
| 35 | |||
| 36 | inline uint8_t matrix_rows(void) | ||
| 37 | { | ||
| 38 | return MATRIX_ROWS; | ||
| 39 | } | ||
| 40 | |||
| 41 | inline uint8_t matrix_cols(void) | ||
| 42 | { | ||
| 43 | return MATRIX_COLS; | ||
| 44 | } | ||
| 45 | |||
| 46 | void matrix_init(void) | ||
| 47 | { | ||
| 48 | /* Column output pins */ | ||
| 49 | DDRD |= 0b01111011; | ||
| 50 | /* Row input pins */ | ||
| 51 | DDRC &= ~0b10000000; | ||
| 52 | DDRB &= ~0b01111111; | ||
| 53 | PORTC |= 0b10000000; | ||
| 54 | PORTB |= 0b01111111; | ||
| 55 | |||
| 56 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 57 | matrix[i] = 0; | ||
| 58 | matrix_debouncing[i] = 0; | ||
| 59 | } | ||
| 60 | |||
| 61 | matrix_init_quantum(); | ||
| 62 | } | ||
| 63 | |||
| 64 | uint8_t matrix_scan(void) | ||
| 65 | { | ||
| 66 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { | ||
| 67 | select_row(col); | ||
| 68 | wait_us(30); | ||
| 69 | matrix_row_t rows = read_cols(); | ||
| 70 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 71 | bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col); | ||
| 72 | bool curr_bit = rows & (1<<row); | ||
| 73 | if (prev_bit != curr_bit) { | ||
| 74 | matrix_debouncing[row] ^= (matrix_row_t) 1 << col; | ||
| 75 | debouncing = DEBOUNCING_DELAY; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | if (debouncing) { | ||
| 81 | if (--debouncing) { | ||
| 82 | wait_ms(1); | ||
| 83 | } else { | ||
| 84 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 85 | matrix[i] = matrix_debouncing[i]; | ||
| 86 | } | ||
| 87 | } | ||
| 88 | } | ||
| 89 | |||
| 90 | matrix_scan_quantum(); | ||
| 91 | |||
| 92 | return 1; | ||
| 93 | } | ||
| 94 | |||
| 95 | bool matrix_is_modified(void) | ||
| 96 | { | ||
| 97 | if (debouncing) | ||
| 98 | return false; | ||
| 99 | return true; | ||
| 100 | } | ||
| 101 | |||
| 102 | inline | ||
| 103 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 104 | { | ||
| 105 | return matrix[row] & 1 << col; | ||
| 106 | } | ||
| 107 | |||
| 108 | inline | ||
| 109 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 110 | { | ||
| 111 | return matrix[row]; | ||
| 112 | } | ||
| 113 | |||
| 114 | void matrix_print(void) | ||
| 115 | { | ||
| 116 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 117 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 118 | phex(row); print(": "); | ||
| 119 | pbin_reverse16(matrix_get_row(row)); | ||
| 120 | print("\n"); | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | uint8_t matrix_key_count(void) | ||
| 125 | { | ||
| 126 | uint8_t count = 0; | ||
| 127 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 128 | count += bitpop16(matrix[i]); | ||
| 129 | } | ||
| 130 | return count; | ||
| 131 | } | ||
| 132 | |||
| 133 | static matrix_row_t read_cols(void) | ||
| 134 | { | ||
| 135 | return | ||
| 136 | (PINB & (1 << 5) ? 0 : 1 << 0) | | ||
| 137 | (PINC & (1 << 7) ? 0 : 1 << 1) | | ||
| 138 | (PINB & (1 << 4) ? 0 : 1 << 2) | | ||
| 139 | (PINB & (1 << 6) ? 0 : 1 << 3) | | ||
| 140 | (PINB & (1 << 1) ? 0 : 1 << 4) | | ||
| 141 | (PINB & (1 << 0) ? 0 : 1 << 5) | | ||
| 142 | (PINB & (1 << 3) ? 0 : 1 << 6) | | ||
| 143 | (PINB & (1 << 2) ? 0 : 1 << 7); | ||
| 144 | } | ||
| 145 | |||
| 146 | static void select_row(uint8_t col) | ||
| 147 | { | ||
| 148 | switch (col) { | ||
| 149 | case 0: | ||
| 150 | PORTD = (PORTD & ~0b01111011) | 0b00110011; | ||
| 151 | break; | ||
| 152 | case 1: | ||
| 153 | PORTD = (PORTD & ~0b01111011) | 0b01110000; | ||
| 154 | break; | ||
| 155 | case 2: | ||
| 156 | PORTD = (PORTD & ~0b01111011) | 0b00010011; | ||
| 157 | break; | ||
| 158 | case 3: | ||
| 159 | PORTD = (PORTD & ~0b01111011) | 0b01101000; | ||
| 160 | break; | ||
| 161 | case 4: | ||
| 162 | PORTD = (PORTD & ~0b01111011) | 0b00001011; | ||
| 163 | break; | ||
| 164 | case 5: | ||
| 165 | PORTD = (PORTD & ~0b01111011) | 0b00111011; | ||
| 166 | break; | ||
| 167 | case 6: | ||
| 168 | PORTD = (PORTD & ~0b01111011) | 0b01111000; | ||
| 169 | break; | ||
| 170 | case 7: | ||
| 171 | PORTD = (PORTD & ~0b01111011) | 0b01100001; | ||
| 172 | break; | ||
| 173 | case 8: | ||
| 174 | PORTD = (PORTD & ~0b01111011) | 0b01101001; | ||
| 175 | break; | ||
| 176 | case 9: | ||
| 177 | PORTD = (PORTD & ~0b01111011) | 0b01110001; | ||
| 178 | break; | ||
| 179 | case 10: | ||
| 180 | PORTD = (PORTD & ~0b01111011) | 0b01101010; | ||
| 181 | break; | ||
| 182 | case 11: | ||
| 183 | PORTD = (PORTD & ~0b01111011) | 0b01100010; | ||
| 184 | break; | ||
| 185 | case 12: | ||
| 186 | PORTD = (PORTD & ~0b01111011) | 0b01111001; | ||
| 187 | break; | ||
| 188 | case 13: | ||
| 189 | PORTD = (PORTD & ~0b01111011) | 0b01100000; | ||
| 190 | break; | ||
| 191 | case 14: | ||
| 192 | PORTD = (PORTD & ~0b01111011) | 0b01000011; | ||
| 193 | break; | ||
| 194 | case 15: | ||
| 195 | PORTD = (PORTD & ~0b01111011) | 0b00011011; | ||
| 196 | break; | ||
| 197 | case 16: | ||
| 198 | PORTD = (PORTD & ~0b01111011) | 0b00100011; | ||
| 199 | break; | ||
| 200 | case 17: | ||
| 201 | PORTD = (PORTD & ~0b01111011) | 0b00101011; | ||
| 202 | break; | ||
| 203 | } | ||
| 204 | } | ||
diff --git a/keyboards/pegasushoof/pegasushoof.c b/keyboards/pegasushoof/pegasushoof.c new file mode 100644 index 000000000..6bb249aef --- /dev/null +++ b/keyboards/pegasushoof/pegasushoof.c | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Daniel Svensson <dsvensson@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "pegasushoof.h" | ||
| 19 | |||
| 20 | __attribute__ ((weak)) | ||
| 21 | void matrix_init_user(void) { | ||
| 22 | }; | ||
| 23 | |||
| 24 | __attribute__ ((weak)) | ||
| 25 | void matrix_scan_user(void) { | ||
| 26 | } | ||
| 27 | |||
| 28 | __attribute__ ((weak)) | ||
| 29 | bool process_action_user(keyrecord_t *record) { | ||
| 30 | return true; | ||
| 31 | } | ||
| 32 | |||
| 33 | __attribute__ ((weak)) | ||
| 34 | void led_set_user(uint8_t usb_led) { | ||
| 35 | } | ||
| 36 | |||
| 37 | void matrix_init_kb(void) { | ||
| 38 | matrix_init_user(); | ||
| 39 | } | ||
| 40 | |||
| 41 | void matrix_scan_kb(void) { | ||
| 42 | matrix_scan_user(); | ||
| 43 | } | ||
| 44 | |||
| 45 | bool process_action_kb(keyrecord_t *record) { | ||
| 46 | return process_action_user(record); | ||
| 47 | } | ||
| 48 | |||
| 49 | void led_set_kb(uint8_t usb_led) { | ||
| 50 | led_set_user(usb_led); | ||
| 51 | } | ||
diff --git a/keyboards/pegasushoof/pegasushoof.h b/keyboards/pegasushoof/pegasushoof.h new file mode 100644 index 000000000..d031e3ed2 --- /dev/null +++ b/keyboards/pegasushoof/pegasushoof.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Daniel Svensson <dsvensson@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef PEGASUSHOOF_H | ||
| 19 | #define PEGASUSHOOF_H | ||
| 20 | |||
| 21 | #include "matrix.h" | ||
| 22 | #include "quantum.h" | ||
| 23 | |||
| 24 | #define ___ KC_NO | ||
| 25 | |||
| 26 | #define KEYMAP( \ | ||
| 27 | KG6, KH4, KI4, KI2, KI6, KP5, KL6, KM2, KM4, KO4, KO5, KO6, KO0, KN5, KN7, KP7, \ | ||
| 28 | KG4, KG5, KH5, KI5, KJ5, KJ4, KK4, KK5, KL5, KM5, KF5, KF4, KL4, KO2, KR4, KC4, KE4, \ | ||
| 29 | KG2, KG7, KH7, KI7, KJ7, KJ2, KK2, KK7, KL7, KM7, KF7, KF2, KL2, KO3, KQ4, KC5, KE5, \ | ||
| 30 | KH2, KG3, KH3, KI3, KJ3, KJ6, KK6, KK3, KL3, KM3, KF3, KF6, KO1, \ | ||
| 31 | KB2, KH6, KG1, KH1, KI1, KJ1, KJ0, KK0, KK1, KL1, KM1, KF0, KB3, KC6, \ | ||
| 32 | KP4, KD2, KN6, KQ6, KN0, KA3, KM0, KP1, KC0, KQ0, KR0 \ | ||
| 33 | ) { /* 00-A 01-B 02-C 03-D 04-E 05-F 06-G 07-H 08-I 09-J 10-K 11-L 12-M 13-N 14-O 15-P 16-Q 17-R */ \ | ||
| 34 | /* 0 */ { ___ , ___ , KC0 , ___ , ___ , KF0 , ___ , ___ , ___ , KJ0 , KK0 , ___ , KM0 , KN0 , KO0 , ___ , KQ0 , KR0 }, \ | ||
| 35 | /* 1 */ { ___ , ___ , ___ , ___ , ___ , ___ , KG1 , KH1 , KI1 , KJ1 , KK1 , KL1 , KM1 , ___ , KO1 , KP1 , ___ , ___ }, \ | ||
| 36 | /* 2 */ { ___ , KB2 , ___ , KD2 , ___ , KF2 , KG2 , KH2 , KI2 , KJ2 , KK2 , KL2 , KM2 , ___ , KO2 , ___ , ___ , ___ }, \ | ||
| 37 | /* 3 */ { KA3 , KB3 , ___ , ___ , ___ , KF3 , KG3 , KH3 , KI3 , KJ3 , KK3 , KL3 , KM3 , ___ , KO3 , ___ , ___ , ___ }, \ | ||
| 38 | /* 4 */ { ___ , ___ , KC4 , ___ , KE4 , KF4 , KG4 , KH4 , KI4 , KJ4 , KK4 , KL4 , KM4 , ___ , KO4 , KP4 , KQ4 , KR4 }, \ | ||
| 39 | /* 5 */ { ___ , ___ , KC5 , ___ , KE5 , KF5 , KG5 , KH5 , KI5 , KJ5 , KK5 , KL5 , KM5 , KN5 , KO5 , KP5 , ___ , ___ }, \ | ||
| 40 | /* 6 */ { ___ , ___ , KC6 , ___ , ___ , KF6 , KG6 , KH6 , KI6 , KJ6 , KK6 , KL6 , ___ , KN6 , KO6 , ___ , KQ6 , ___ }, \ | ||
| 41 | /* 7 */ { ___ , ___ , ___ , ___ , ___ , KF7 , KG7 , KH7 , KI7 , KJ7 , KK7 , KL7 , KM7 , KN7 , ___ , KP7 , ___ , ___ }, \ | ||
| 42 | } | ||
| 43 | |||
| 44 | inline void ph_caps_led_on(void) { DDRC |= (1<<6); PORTC &= ~(1<<6); } | ||
| 45 | inline void ph_caps_led_off(void) { DDRC &= ~(1<<6); PORTC &= ~(1<<6); } | ||
| 46 | |||
| 47 | inline void ph_sclk_led_on(void) { DDRC |= (1<<5); PORTC &= ~(1<<5); } | ||
| 48 | inline void ph_sclk_led_off(void) { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } | ||
| 49 | |||
| 50 | |||
| 51 | #endif | ||
diff --git a/keyboards/pegasushoof/rules.mk b/keyboards/pegasushoof/rules.mk new file mode 100644 index 000000000..b3eeebfdb --- /dev/null +++ b/keyboards/pegasushoof/rules.mk | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | # MCU name | ||
| 2 | MCU = atmega32u2 | ||
| 3 | |||
| 4 | # Processor frequency. | ||
| 5 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 6 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 7 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 8 | # automatically to create a 32-bit value in your source code. | ||
| 9 | # | ||
| 10 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 11 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 12 | # does not *change* the processor frequency - it should merely be updated to | ||
| 13 | # reflect the processor speed set externally so that the code can use accurate | ||
| 14 | # software delays. | ||
| 15 | F_CPU = 16000000 | ||
| 16 | |||
| 17 | # | ||
| 18 | # LUFA specific | ||
| 19 | # | ||
| 20 | # Target architecture (see library "Board Types" documentation). | ||
| 21 | ARCH = AVR8 | ||
| 22 | |||
| 23 | # Input clock frequency. | ||
| 24 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 25 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 26 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 27 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 28 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 29 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 30 | # source code. | ||
| 31 | # | ||
| 32 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 33 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 34 | F_USB = $(F_CPU) | ||
| 35 | |||
| 36 | # Interrupt driven control endpoint task(+60) | ||
| 37 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 38 | |||
| 39 | |||
| 40 | # Boot Section Size in *bytes* | ||
| 41 | # Teensy halfKay 512 | ||
| 42 | # Teensy++ halfKay 1024 | ||
| 43 | # Atmel DFU loader 4096 | ||
| 44 | # LUFA bootloader 4096 | ||
| 45 | # USBaspLoader 2048 | ||
| 46 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 47 | |||
| 48 | |||
| 49 | # Build Options | ||
| 50 | # change yes to no to disable | ||
| 51 | # | ||
| 52 | BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) | ||
| 53 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 54 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 55 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
| 56 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 57 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 58 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 59 | MIDI_ENABLE ?= no # MIDI controls | ||
| 60 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 61 | UNICODE_ENABLE ?= no # Unicode | ||
| 62 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 63 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 64 | |||
| 65 | |||
| 66 | CUSTOM_MATRIX ?= yes | ||
| 67 | SRC = matrix.c | ||
