summaryrefslogtreecommitdiff
path: root/keyboards/pegasushoof
diff options
context:
space:
mode:
authorDaniel Svensson2016-05-29 02:48:56 +0200
committerDaniel Svensson2016-10-13 12:50:54 +0200
commitb73adf0dea567407bd5e6bd7921b607529a2aa4a (patch)
tree58c374de493fbe0b7596a032cbfbd3f052850025 /keyboards/pegasushoof
parent0a9ad8f335f5b5b9d184d9e5e9ece6cda149df7e (diff)
Support the Pegasus Hoof controller.
Replacement controller for Filco Majestouch TKL keyboards. matrix.c ported from: https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard More details: http://bathroomepiphanies.com/controllers/
Diffstat (limited to 'keyboards/pegasushoof')
-rw-r--r--keyboards/pegasushoof/Makefile3
-rw-r--r--keyboards/pegasushoof/README.md24
-rw-r--r--keyboards/pegasushoof/config.h46
-rw-r--r--keyboards/pegasushoof/keymaps/blowrak/Makefile22
-rw-r--r--keyboards/pegasushoof/keymaps/blowrak/keymap.c112
-rw-r--r--keyboards/pegasushoof/keymaps/default/Makefile22
-rw-r--r--keyboards/pegasushoof/keymaps/default/keymap.c60
-rw-r--r--keyboards/pegasushoof/matrix.c204
-rw-r--r--keyboards/pegasushoof/pegasushoof.c51
-rw-r--r--keyboards/pegasushoof/pegasushoof.h51
-rw-r--r--keyboards/pegasushoof/rules.mk67
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 @@
+ifndef MAKEFILE_INCLUDED
+ include ../../Makefile
+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 @@
+pegasushoof keyboard firmware
+=============================
+
+## Quantum MK Firmware
+
+For the full Quantum feature list, see [the parent README.md](/README.md).
+
+## Building
+
+Download or clone the whole firmware and navigate to the `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.
+
+Depending on which keymap you would like to use, you will have to compile slightly differently.
+
+### Default
+To build all keymaps, simply run `make`, the `.hex` files will end up in the top directory.
+
+### Specific Keymap
+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.
+
+To build the firmware binary hex file with a keymap just enter the keymap directory and type `make`:
+```
+$ cd keymaps/default
+$ make
+```
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 @@
+/*
+Copyright 2016 Daniel Svensson <dsvensson@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6050
+#define DEVICE_VER 0x0104
+#define MANUFACTURER Filco
+#define PRODUCT Majestouch TKL \\w The Pegasus Hoof
+#define DESCRIPTION QMK firmware for Majestouch TKL
+
+/* key matrix size */
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 18
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCING_DELAY 5
+
+/* key combination for magic key command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#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 @@
+# 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 ?= yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
+CONSOLE_ENABLE ?= yes # Console for debug(+400)
+COMMAND_ENABLE ?= yes # Commands for debug and configuration
+CUSTOM_MATRIX ?= yes # Custom matrix file for the Pegasus Hoof due to the 2x74HC42
+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.
+
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+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 @@
+/*
+Copyright 2016 Daniel Svensson <dsvensson@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "pegasushoof.h"
+
+#define _______ KC_TRNS
+
+/* Swedish keys */
+#define SE_HALF KC_GRV
+#define SE_PLUS KC_MINS
+#define SE_ACUT KC_EQL
+#define SE_AO KC_LBRC
+#define SE_CIRC KC_RBRC
+#define SE_QUOT KC_BSLS
+#define SE_OE KC_SCLN
+#define SE_AE KC_QUOT
+#define SE_MINS KC_SLSH
+#define SE_LTGT KC_NUBS
+#define SE_LCBR RALT(KC_7)
+#define SE_LBRC RALT(KC_8)
+#define SE_RBRC RALT(KC_9)
+#define SE_RCBR RALT(KC_0)
+#define SE_PIPE RALT(SE_LTGT)
+#define SE_BSLS RALT(SE_PLUS)
+
+#define KM_BLOWRAK 0
+#define KM_QWERTY 1
+#define KM_MEDIA 2
+#define KM_HAXHAX 3
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Blowrak ISO layer, a Swedish take on Dvorak */
+ [KM_BLOWRAK] = 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_PSCR,KC_SLCK,KC_PAUS, \
+ 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, \
+ 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, \
+ 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, \
+ 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, \
+ KC_FN0, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT),
+ /* Layer 1: Standard ISO layer */
+ [KM_QWERTY] = 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_PSCR,KC_SLCK,KC_PAUS, \
+ 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, \
+ 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, \
+ 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, \
+ 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, \
+ KC_FN0, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN1, KC_LEFT,KC_DOWN,KC_RGHT),
+ /* Layer 2: Media layer */
+ [KM_MEDIA] = KEYMAP( \
+ _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,KC_VOLU, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_MUTE,_______,KC_VOLD, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_MPLY, \
+ _______,_______,_______, _______, _______,_______,RESET ,_______, KC_MPRV,KC_MSTP,KC_MNXT),
+ /* Layer 3: Programming layer */
+ [KM_HAXHAX] = KEYMAP( \
+ _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
+ _______,SE_LCBR,SE_PIPE,SE_RCBR,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
+ _______,SE_LBRC,SE_BSLS,SE_RBRC,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______, \
+ _______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(KM_MEDIA),
+ [1] = ACTION_LAYER_TOGGLE(KM_QWERTY)
+};
+
+void matrix_scan_user(void)
+{
+ uint8_t layer = biton32(layer_state);
+ switch (layer) {
+ case KM_BLOWRAK:
+ ph_caps_led_on();
+ ph_sclk_led_off();
+ break;
+ case KM_QWERTY:
+ ph_sclk_led_on();
+ ph_caps_led_off();
+ break;
+ }
+}
+
+/* Mixes in KM_HAXHAX via RALT modifier without shadowing the RALT key combinations. */
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ uint8_t modifiers = get_mods();
+ if (modifiers & MOD_BIT(KC_RALT) && record->event.pressed) {
+ uint16_t kc = keymap_key_to_keycode(KM_HAXHAX, record->event.key);
+ if (kc != KC_TRNS) {
+ register_code(kc);
+ unregister_code(kc);
+ return false;
+ }
+ }
+ return true;
+}
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 @@
+# 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 ?= yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
+CONSOLE_ENABLE ?= yes # Console for debug(+400)
+COMMAND_ENABLE ?= yes # Commands for debug and configuration
+CUSTOM_MATRIX ?= yes # Custom matrix file for the Pegasus Hoof due to the 2x74HC42
+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.
+
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+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 @@
+/*
+Copyright 2016 Daniel Svensson <dsvensson@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "pegasushoof.h"
+
+#define _______ KC_TRNS
+
+#define KM_QWERTY 0
+#define KM_MEDIA 1
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Layer 0: Standard ISO layer */
+ [KM_QWERTY] = 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_PSCR,KC_SLCK,KC_PAUS, \
+ 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, \
+ 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, \
+ 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, \
+ 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, \
+ KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_MENU,KC_FN0, KC_LEFT,KC_DOWN,KC_RGHT),
+ /* Layer 1: Function layer */
+ [KM_MEDIA] = KEYMAP( \
+ _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_WAKE,KC_PWR, KC_SLEP, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,KC_VOLU, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,KC_VOLD, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, \
+ _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, KC_MPLY, \
+ _______,_______,_______, _______, _______,_______,RESET ,_______, KC_MPRV,KC_MSTP,KC_MNXT)
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [0] = ACTION_LAYER_MOMENTARY(KM_MEDIA)
+};
+
+void led_set_user(uint8_t usb_led) {
+ if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
+ ph_caps_led_on();
+ } else {
+ ph_caps_led_off();
+ }
+
+ if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
+ ph_sclk_led_on();
+ } else {
+ ph_sclk_led_off();
+ }
+}
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 @@
+/*
+Copyright 2014 Ralf Schmitt <ralf@bunkertor.net>
+Copyright 2016 Daniel Svensson <dsvensson@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "wait.h"
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+
+static uint8_t debouncing = DEBOUNCING_DELAY;
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static matrix_row_t read_cols(void);
+static void select_row(uint8_t col);
+
+inline uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ /* Column output pins */
+ DDRD |= 0b01111011;
+ /* Row input pins */
+ DDRC &= ~0b10000000;
+ DDRB &= ~0b01111111;
+ PORTC |= 0b10000000;
+ PORTB |= 0b01111111;
+
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+
+ matrix_init_quantum();
+}
+
+uint8_t matrix_scan(void)
+{
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ select_row(col);
+ wait_us(30);
+ matrix_row_t rows = read_cols();
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
+ bool curr_bit = rows & (1<<row);
+ if (prev_bit != curr_bit) {
+ matrix_debouncing[row] ^= (matrix_row_t) 1 << col;
+ debouncing = DEBOUNCING_DELAY;
+ }
+ }
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ wait_ms(1);
+ } else {
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ matrix[i] = matrix_debouncing[i];
+ }
+ }
+ }
+
+ matrix_scan_quantum();
+
+ return 1;
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing)
+ return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return matrix[row] & 1 << col;
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+static matrix_row_t read_cols(void)
+{
+ return
+ (PINB & (1 << 5) ? 0 : 1 << 0) |
+ (PINC & (1 << 7) ? 0 : 1 << 1) |
+ (PINB & (1 << 4) ? 0 : 1 << 2) |
+ (PINB & (1 << 6) ? 0 : 1 << 3) |
+ (PINB & (1 << 1) ? 0 : 1 << 4) |
+ (PINB & (1 << 0) ? 0 : 1 << 5) |
+ (PINB & (1 << 3) ? 0 : 1 << 6) |
+ (PINB & (1 << 2) ? 0 : 1 << 7);
+}
+
+static void select_row(uint8_t col)
+{
+ switch (col) {
+ case 0:
+ PORTD = (PORTD & ~0b01111011) | 0b00110011;
+ break;
+ case 1:
+ PORTD = (PORTD & ~0b01111011) | 0b01110000;
+ break;
+ case 2:
+ PORTD = (PORTD & ~0b01111011) | 0b00010011;
+ break;
+ case 3:
+ PORTD = (PORTD & ~0b01111011) | 0b01101000;
+ break;
+ case 4:
+ PORTD = (PORTD & ~0b01111011) | 0b00001011;
+ break;
+ case 5:
+ PORTD = (PORTD & ~0b01111011) | 0b00111011;
+ break;
+ case 6:
+ PORTD = (PORTD & ~0b01111011) | 0b01111000;
+ break;
+ case 7:
+ PORTD = (PORTD & ~0b01111011) | 0b01100001;
+ break;
+ case 8:
+ PORTD = (PORTD & ~0b01111011) | 0b01101001;
+ break;
+ case 9:
+ PORTD = (PORTD & ~0b01111011) | 0b01110001;
+ break;
+ case 10:
+ PORTD = (PORTD & ~0b01111011) | 0b01101010;
+ break;
+ case 11:
+ PORTD = (PORTD & ~0b01111011) | 0b01100010;
+ break;
+ case 12:
+ PORTD = (PORTD & ~0b01111011) | 0b01111001;
+ break;
+ case 13:
+ PORTD = (PORTD & ~0b01111011) | 0b01100000;
+ break;
+ case 14:
+ PORTD = (PORTD & ~0b01111011) | 0b01000011;
+ break;
+ case 15:
+ PORTD = (PORTD & ~0b01111011) | 0b00011011;
+ break;
+ case 16:
+ PORTD = (PORTD & ~0b01111011) | 0b00100011;
+ break;
+ case 17:
+ PORTD = (PORTD & ~0b01111011) | 0b00101011;
+ break;
+ }
+}
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 @@
+/*
+Copyright 2016 Daniel Svensson <dsvensson@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "pegasushoof.h"
+
+__attribute__ ((weak))
+void matrix_init_user(void) {
+};
+
+__attribute__ ((weak))
+void matrix_scan_user(void) {
+}
+
+__attribute__ ((weak))
+bool process_action_user(keyrecord_t *record) {
+ return true;
+}
+
+__attribute__ ((weak))
+void led_set_user(uint8_t usb_led) {
+}
+
+void matrix_init_kb(void) {
+ matrix_init_user();
+}
+
+void matrix_scan_kb(void) {
+ matrix_scan_user();
+}
+
+bool process_action_kb(keyrecord_t *record) {
+ return process_action_user(record);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ led_set_user(usb_led);
+}
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 @@
+/*
+Copyright 2016 Daniel Svensson <dsvensson@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PEGASUSHOOF_H
+#define PEGASUSHOOF_H
+
+#include "matrix.h"
+#include "quantum.h"
+
+#define ___ KC_NO
+
+#define KEYMAP( \
+ KG6, KH4, KI4, KI2, KI6, KP5, KL6, KM2, KM4, KO4, KO5, KO6, KO0, KN5, KN7, KP7, \
+ KG4, KG5, KH5, KI5, KJ5, KJ4, KK4, KK5, KL5, KM5, KF5, KF4, KL4, KO2, KR4, KC4, KE4, \
+ KG2, KG7, KH7, KI7, KJ7, KJ2, KK2, KK7, KL7, KM7, KF7, KF2, KL2, KO3, KQ4, KC5, KE5, \
+ KH2, KG3, KH3, KI3, KJ3, KJ6, KK6, KK3, KL3, KM3, KF3, KF6, KO1, \
+ KB2, KH6, KG1, KH1, KI1, KJ1, KJ0, KK0, KK1, KL1, KM1, KF0, KB3, KC6, \
+ KP4, KD2, KN6, KQ6, KN0, KA3, KM0, KP1, KC0, KQ0, KR0 \
+ ) { /* 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 */ \
+ /* 0 */ { ___ , ___ , KC0 , ___ , ___ , KF0 , ___ , ___ , ___ , KJ0 , KK0 , ___ , KM0 , KN0 , KO0 , ___ , KQ0 , KR0 }, \
+ /* 1 */ { ___ , ___ , ___ , ___ , ___ , ___ , KG1 , KH1 , KI1 , KJ1 , KK1 , KL1 , KM1 , ___ , KO1 , KP1 , ___ , ___ }, \
+ /* 2 */ { ___ , KB2 , ___ , KD2 , ___ , KF2 , KG2 , KH2 , KI2 , KJ2 , KK2 , KL2 , KM2 , ___ , KO2 , ___ , ___ , ___ }, \
+ /* 3 */ { KA3 , KB3 , ___ , ___ , ___ , KF3 , KG3 , KH3 , KI3 , KJ3 , KK3 , KL3 , KM3 , ___ , KO3 , ___ , ___ , ___ }, \
+ /* 4 */ { ___ , ___ , KC4 , ___ , KE4 , KF4 , KG4 , KH4 , KI4 , KJ4 , KK4 , KL4 , KM4 , ___ , KO4 , KP4 , KQ4 , KR4 }, \
+ /* 5 */ { ___ , ___ , KC5 , ___ , KE5 , KF5 , KG5 , KH5 , KI5 , KJ5 , KK5 , KL5 , KM5 , KN5 , KO5 , KP5 , ___ , ___ }, \
+ /* 6 */ { ___ , ___ , KC6 , ___ , ___ , KF6 , KG6 , KH6 , KI6 , KJ6 , KK6 , KL6 , ___ , KN6 , KO6 , ___ , KQ6 , ___ }, \
+ /* 7 */ { ___ , ___ , ___ , ___ , ___ , KF7 , KG7 , KH7 , KI7 , KJ7 , KK7 , KL7 , KM7 , KN7 , ___ , KP7 , ___ , ___ }, \
+ }
+
+inline void ph_caps_led_on(void) { DDRC |= (1<<6); PORTC &= ~(1<<6); }
+inline void ph_caps_led_off(void) { DDRC &= ~(1<<6); PORTC &= ~(1<<6); }
+
+inline void ph_sclk_led_on(void) { DDRC |= (1<<5); PORTC &= ~(1<<5); }
+inline void ph_sclk_led_off(void) { DDRC &= ~(1<<5); PORTC &= ~(1<<5); }
+
+
+#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 @@
+# MCU name
+MCU = atmega32u2
+
+# 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 yes to no to disable
+#
+BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
+CONSOLE_ENABLE ?= yes # Console for debug(+400)
+COMMAND_ENABLE ?= yes # Commands for debug and configuration
+NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE ?= 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.
+
+
+CUSTOM_MATRIX ?= yes
+SRC = matrix.c