From 5b4bcfa7f2530ad12ef801101933aba6ac46acb2 Mon Sep 17 00:00:00 2001 From: MechMerlin <30334081+mechmerlin@users.noreply.github.com> Date: Wed, 19 Sep 2018 16:25:58 -0700 Subject: Keyboard: Move Bathroom Epiphany boards into its own directory (#3936) * make bpiphany directory with simple readme file * move unloved_bastard to bpiphany directory * move frosty_flake to bpiphany directory * move pegasushoof to bpiphany directory * move tiger_lily to bpiphany directory * add a little more info to readme * move kitten_paw to bpiphany directory * update make instructions * update intro text * add missing routines to matrix.c of unloved_bastard * add missing routines --- keyboards/bpiphany/frosty_flake/config.h | 147 +++++++++++++ keyboards/bpiphany/frosty_flake/frosty_flake.c | 63 ++++++ keyboards/bpiphany/frosty_flake/frosty_flake.h | 106 ++++++++++ .../bpiphany/frosty_flake/keymaps/QFR_JM/config.h | 11 + .../bpiphany/frosty_flake/keymaps/QFR_JM/keymap.c | 132 ++++++++++++ .../bpiphany/frosty_flake/keymaps/QFR_JM/readme.md | 86 ++++++++ .../bpiphany/frosty_flake/keymaps/QFR_JM/rules.mk | 17 ++ .../bpiphany/frosty_flake/keymaps/default/config.h | 8 + .../bpiphany/frosty_flake/keymaps/default/keymap.c | 11 + .../frosty_flake/keymaps/default/readme.md | 1 + .../bpiphany/frosty_flake/keymaps/default/rules.mk | 21 ++ .../bpiphany/frosty_flake/keymaps/nikchi/config.h | 23 +++ .../bpiphany/frosty_flake/keymaps/nikchi/keymap.c | 228 +++++++++++++++++++++ .../bpiphany/frosty_flake/keymaps/nikchi/readme.md | 24 +++ .../bpiphany/frosty_flake/keymaps/nikchi/rules.mk | 24 +++ .../keymaps/nikchi/variableTapDance.md | 9 + .../bpiphany/frosty_flake/keymaps/tkl/config.h | 8 + .../bpiphany/frosty_flake/keymaps/tkl/keymap.c | 11 + .../bpiphany/frosty_flake/keymaps/tkl/readme.md | 1 + .../bpiphany/frosty_flake/keymaps/tkl/rules.mk | 17 ++ keyboards/bpiphany/frosty_flake/matrix.c | 155 ++++++++++++++ keyboards/bpiphany/frosty_flake/readme.md | 43 ++++ keyboards/bpiphany/frosty_flake/rules.mk | 73 +++++++ 23 files changed, 1219 insertions(+) create mode 100644 keyboards/bpiphany/frosty_flake/config.h create mode 100644 keyboards/bpiphany/frosty_flake/frosty_flake.c create mode 100644 keyboards/bpiphany/frosty_flake/frosty_flake.h create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/config.h create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/keymap.c create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/readme.md create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/rules.mk create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/default/config.h create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/default/keymap.c create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/default/readme.md create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/default/rules.mk create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/nikchi/readme.md create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/nikchi/rules.mk create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/tkl/config.h create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/tkl/keymap.c create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/tkl/readme.md create mode 100644 keyboards/bpiphany/frosty_flake/keymaps/tkl/rules.mk create mode 100644 keyboards/bpiphany/frosty_flake/matrix.c create mode 100644 keyboards/bpiphany/frosty_flake/readme.md create mode 100644 keyboards/bpiphany/frosty_flake/rules.mk (limited to 'keyboards/bpiphany/frosty_flake') diff --git a/keyboards/bpiphany/frosty_flake/config.h b/keyboards/bpiphany/frosty_flake/config.h new file mode 100644 index 0000000000..2c73f10743 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/config.h @@ -0,0 +1,147 @@ +/* +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 Bathroom Epiphanies +#define PRODUCT frosty_flake +#define DESCRIPTION Frosty Flake controller for the CM Storm Quick Fire Rapid + +/* + * Frosty Flake Rev. 20140521 made by Bathroom Ephiphanies + * Ported from the Bathroom Epiphanies TMK Firmware: + * https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard/tree/master/be_controllers + * + */ + +/* key matrix size */ +#define MATRIX_ROWS 8 // Row0 - Row7 in the schematic +#define MATRIX_COLS 18 // ColA - ColR in the schematic + +/* + * Keyboard Matrix Assignments + */ +#define UNUSED_PINS { B0, C4, D3 } + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* 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/bpiphany/frosty_flake/frosty_flake.c b/keyboards/bpiphany/frosty_flake/frosty_flake.c new file mode 100644 index 0000000000..1cd4760389 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/frosty_flake.c @@ -0,0 +1,63 @@ +#include "frosty_flake.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + DDRB |= (1<<7); + DDRC |= (1<<5) | (1<<6); + + print_dec(usb_led); + + if (usb_led & (1<event.pressed) { // pointer + SEND_STRING("<- "); +// return MACRO(D(LSFT), T(COMM), U(LSFT), T(MINS), END); + } + break; + case R_PIPE: + if (record->event.pressed) { // dplyr pipe + SEND_STRING("%>% "); +// return MACRO(D(LSFT), T(5), T(DOT), T(5), U(LSFT), END); + } + break; + } + return MACRO_NONE; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + } + return true; +} \ No newline at end of file diff --git a/keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/readme.md b/keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/readme.md new file mode 100644 index 0000000000..f12a0ffba1 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/readme.md @@ -0,0 +1,86 @@ + +# TKL keymap for frosty\_flake +``` +make frosty_flake:QFR_JM + +dfu-programmer atmega32u2 erase +dfu-programmer atmega32u2 flash frosty_flake_QFR_JM.hex +dfu-programmer atmega32u2 start +``` + +##Layers +``` + ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. + |ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 |F10 |F11 |F12 | |PrSc|ScLk|PsBk| + '----' '-------------------' '-------------------' '-------------------' '--------------' + ,-------------------------------------------------------------------------. ,--------------. + | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bspc | | Ins|Home|PgUp| + |-------------------------------------------------------------------------| |--------------| + | Tab | Q | W | F | P | G | J | L | U | Y | ; | [ | ] | \ | | Del|End |PgDn| + |-------------------------------------------------------------------------| '--------------' + | Bspc | A | R | S | T | D | H | N | E | I | O | ' | Enter | + |-------------------------------------------------------------------------| ,----. + | LSPO | Z | X | C | V | B | K | M | , | . | / | RSPC | | Up | + |-------------------------------------------------------------------------| ,--------------. + |Ctrl|LGUI|LAlt| Space/Lower |MSE |RGUI|Menu|Ctrl| |Left|Down|Rght| + '-------------------------------------------------------------------------' '--------------' + +``` +### Base Layer - Colemak +The base layout is Colemak by default, but this can be changed to QWERTY via the *LOWER* layer. +* I've implemented COLEMAK = SAFE\_RANGE when enumerating the custom\_keycodes, but I don't actually know what this does... + +* Space cadet is implemented in the shift keys (hold for shift, tap for respective parentheses) + +#### Layer Shifting +* The spacebar is a **TAP_KEY** macro - Hold for momentary *LOWER* layer, Tap for Space. +* The Right hand ALT key is a **TAP_TOGGLE** macro for the *MOUSE* layer (RAlt is accessible through LOWER, if you want...) + +### LOWER +``` + ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. + |ESC | | F1 | F2 | F3 | F4 | |>/|||Stop| << | >> | | F9 |MUTE|Vol-|Vol+| |QWTY|CLMK|PsBk| + '----' '-------------------' '-------------------' '-------------------' '--------------' + ,-------------------------------------------------------------------------. ,--------------. + | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | _ | + | Bspc | | Ins|Home|PgUp| + |-------------------------------------------------------------------------| |--------------| + | Tab |PgUp|Home| Up | End| | | | | | | { | } | | | | Del|End |PgDn| + |-------------------------------------------------------------------------| '--------------' + | Bckspc|PgDn|Left|Down|Rght| | | | | | | ' | Enter | + |-------------------------------------------------------------------------| ,----. + | LSPO | <- |%>% | { | [ | ` | | | ] | } | . | / | RSPC | | Up | + |-------------------------------------------------------------------------| ,--------------. + |Ctrl|LGUI|LAlt| |RAlt|RGUI|Menu|Ctrl| |Left|Down|Rght| + '-------------------------------------------------------------------------' '--------------' +``` +The *LOWER* layer contains a navigation cluster on the left hand. This layer is momentary when the spacebar or LOWER (RAlt) key is held and toggled on/off when the LOWER key is tapped. + +* The Navigation cluster is offset to the right compared to the traditional **WASD** nav cluster. With this implementation, you don't need to move your hand from the home position when navigating. Page Up & Down keys are found on the far left of the cluster. + +* All unused (blank on the above keymap) keys are locked out using the XXXXXXX filler (KC\_NO), all modifiers (edge |\_| keys \[except 0, \. & Fn\] on the above keymap) and the ZXCV cluster are transparent (\_\_\_\_\_\_\_) to the Base layer. + +* The base layer can be switched to QWERTY or COLEMAK by pressing the Pause Break or Scroll Lock keys respectively + +### MOUSE +``` + ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. + |ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 |F10 |F11 |F12 | |PrSc|ScLk|PsBk| + '----' '-------------------' '-------------------' '-------------------' '--------------' + ,-------------------------------------------------------------------------. ,--------------. + | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Del | | Ins|Home|PgUp| + |-------------------------------------------------------------------------| |--------------| + | Tab | WhU| WhL| MsU| WhR| | | M3 | M4 | M5 | | [ | ] | \ | | Del|End |PgDn| + |-------------------------------------------------------------------------| '--------------' + | BSPC | WhD| MsL| MsD| MsR| | |LClk |RClk | | | ' | Enter | + |-------------------------------------------------------------------------| ,----. + | LSPO | Z | X | C | V | | | | , | . | / | RSPC | | Up | + |-------------------------------------------------------------------------| ,--------------. + |Ctrl|LGUI|LAlt| Accel ++ |MSE |RGUI|Menu|Ctrl| |Left|Down|Rght| + '-------------------------------------------------------------------------' '--------------' +``` +The *MOUSE* layer contains keys replicating functions found on the mouse. + +* The navigation cluster (Up, Down, Left, Right) is a replication of the Navigation cluster on the *LOWER* layer. The scroll keys are analagous to the Page Up & Downkeys. +* The primary click (right & left) buttons are on the right home row (index & middle fingers) +* Secondary click buttons are above the standard keys (M3/Wheel click, M4, M5) but I do not use this function. + diff --git a/keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/rules.mk b/keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/rules.mk new file mode 100644 index 0000000000..0ae0b96462 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/QFR_JM/rules.mk @@ -0,0 +1,17 @@ +# 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 = 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. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/bpiphany/frosty_flake/keymaps/default/config.h b/keyboards/bpiphany/frosty_flake/keymaps/default/config.h new file mode 100644 index 0000000000..8893d122e0 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/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/bpiphany/frosty_flake/keymaps/default/keymap.c b/keyboards/bpiphany/frosty_flake/keymaps/default/keymap.c new file mode 100644 index 0000000000..4dc7ed655f --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/default/keymap.c @@ -0,0 +1,11 @@ +#include "frosty_flake.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[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_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_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ + 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_P7, KC_P8, KC_P9,KC_PPLS, \ + 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_P4, KC_P5, KC_P6, \ + 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_P1, KC_P2, KC_P3,KC_PENT, \ + KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) +}; \ No newline at end of file diff --git a/keyboards/bpiphany/frosty_flake/keymaps/default/readme.md b/keyboards/bpiphany/frosty_flake/keymaps/default/readme.md new file mode 100644 index 0000000000..11bf4825ff --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for frosty_flake diff --git a/keyboards/bpiphany/frosty_flake/keymaps/default/rules.mk b/keyboards/bpiphany/frosty_flake/keymaps/default/rules.mk new file mode 100644 index 0000000000..9d3df5964f --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/default/rules.mk @@ -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/bpiphany/frosty_flake/keymaps/nikchi/config.h b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h new file mode 100644 index 0000000000..3f78526437 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h @@ -0,0 +1,23 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define TAPPING_TERM 200 +#define LEADER_TIMEOUT 800 + +#define DISABLE_SPACE_CADET_ROLLOVER + +#define UNICODE_TYPE_DELAY 0 + +#define LSPO_KEY KC_9 +#define RSPC_KEY KC_0 + +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_DELAY 0 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 +#define MOUSEKEY_WHEEL_DELAY 0 +// place overrides here + +#endif diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c new file mode 100644 index 0000000000..bf7c5e5883 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c @@ -0,0 +1,228 @@ +#include "frosty_flake.h" +#include "action_layer.h" +#include "eeconfig.h" +#include "process_unicode.h" +#include "process_unicodemap.h" +#include "quantum.h" + +#define _______ KC_TRNS +#define MAXEMOJITAPS 80 + + +//declarations for tap dancing emojis +void register_hex32(uint32_t hex); +void cycleEmojis(qk_tap_dance_state_t *state, void *user_data); +void cycleAnimals(qk_tap_dance_state_t *state, void *user_data); +void cycleFoods(qk_tap_dance_state_t *state, void *user_data); +void cycleEtc(qk_tap_dance_state_t *state, void *user_data); +void cycleAll(qk_tap_dance_state_t *state, void *user_data); + +void tap(uint16_t keycode){ + register_code(keycode); + unregister_code(keycode); +}; + +//Tap Dance Declarations +enum taps{ + TD_CTCPS = 0, + EMOJIS, + ANIMAL, + HAND, + MEMES, + COPA, + ALLS +}; + +enum unicode_name { + EMOTIS = 1,//80, //1F60x - 1F64x + ANIMALS, //64, //1F40x - 1F43x + SYMBOLS,// = 45, //1F300 - 1F32C + FOODS,// = 87 , //1F32D - + ETC,// = 192, //1F44x -1F4Fx + VEHICLES,// = 83, //1F68x - 1F6Dx + SUPPLEMENT,// = 32, //1F91x-1F92x + ALCHEMY,// = 116 //1F70x - 1F773 + +}; + +enum my_macros { + NEWDESK = 0, + LEFTDESK, + RIGHTDESK, + CLOSEDESK +}; + + +// Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + // Tap once for CTRL, twice for Caps Lock + [TD_CTCPS] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_CAPS), + [COPA] = ACTION_TAP_DANCE_DOUBLE(LCTL(KC_C), LCTL(KC_V)), + [EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEmojis, NULL, NULL, 800), + [ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAnimals, NULL, NULL, 800), + //[SYMBOLS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleSymbols, NULL, NULL, 800), + [FOODS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleFoods, NULL, NULL, 800), + [ETC] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEtc, NULL, NULL, 800), + //[VEHICLES] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleVehicles, NULL, NULL, 800), + //[SUPPLEMENT] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleSupplement, NULL, NULL, 800), + [ALLS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAll, NULL, NULL, 800) +// Other declarations would go here, separated by commas, if you have them +}; + +// macros +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch(id) { + case NEWDESK: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( I(1), D(LGUI), D(LCTL), D(D), U(LGUI), U(LCTL), U(D), END ); // NEW DESKTOP + } + break; + case LEFTDESK: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( I(1), D(LGUI), D(LCTL), D(LEFT), U(LGUI), U(LCTL), U(LEFT), END ); // LEFT DESKTOP + } + break; + case RIGHTDESK: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( I(1), D(LGUI), D(LCTL), D(RGHT), U(LGUI), U(LCTL), U(RGHT), END ); // RIGHT DESKTOP + } + break; + case CLOSEDESK: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( I(1), D(LGUI), D(LCTL), D(F4), U(LGUI), U(LCTL), U(F4), END ); // CLOSE DESKTOP + } + break; + } + return MACRO_NONE; +}; + + +// emojis in unicode +const uint32_t PROGMEM unicode_map[] = { + [EMOTIS] = 0x1F600, + [ANIMALS] = 0x1F400, + [SYMBOLS] = 0x1F300, + [FOODS] = 0x1F32D, + [ETC] = 0x1F440, + [VEHICLES] = 0x1F680, + [SUPPLEMENT] = 0x1F910, + [ALCHEMY] = 0x1F700 + }; +// Layouts +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[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_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_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ + 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_P7, KC_P8, KC_P9,KC_PPLS, \ + KC_LCTL, 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_P4, KC_P5, KC_P6, \ + KC_LSPO,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSPC, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ + TD(TD_CTCPS),KC_LGUI,KC_LALT, KC_SPC, KC_LEAD,KC_RGUI, KC_APP,MO(1) , KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT), +[1] = KEYMAP(\ + TD(ALLS), 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, TD(EMOJIS),TD(ANIMAL),TD(ETC),TD(FOODS), KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_MPRV,KC_MPLY,KC_MNXT, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ + KC_TAB, KC_Q, M(0), KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_UP ,KC_RBRC,KC_BSLS, KC_MUTE,KC_VOLD,KC_VOLU, KC_P7, KC_P8, KC_P9,KC_PPLS, \ + KC_LCTL, M(1), M(3), M(2), KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_LEFT,KC_RGHT, KC_ENT, KC_P4, KC_P5, KC_P6, \ + KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_DOWN, KC_RSFT, KC_MS_U, KC_P1, KC_P2, KC_P3,KC_PENT, \ + KC_BTN1,KC_BTN3,KC_BTN2, KC_SPC, KC_RALT,KC_RGUI, TG(2),_______ , KC_MS_L,KC_MS_D,KC_MS_R, KC_P0,KC_PDOT), +[2] = 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_MPRV,KC_MPLY,KC_MNXT, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ + 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_MUTE,KC_VOLD,KC_VOLU, KC_P7, KC_P8, KC_P9,KC_PPLS, \ + KC_LCTL, KC_D, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, \ + 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_MS_U, KC_P1, KC_P2, KC_P3,KC_PENT, \ + KC_BTN1,KC_BTN3,KC_BTN2, KC_SPC, KC_RALT,KC_RGUI, TG(2) , KC_NO , KC_MS_L,KC_MS_D,KC_MS_R, KC_P0,KC_PDOT), +}; + +LEADER_EXTERNS(); + +void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + SEQ_TWO_KEYS(KC_A, KC_A) { // select all and copy + register_code(KC_LCTL); + tap(KC_A); + tap(KC_C); + unregister_code(KC_LCTL); + } + } +} + +void matrix_init_user(void) { + _delay_ms(500); + set_unicode_input_mode(UC_WINC); +}; + +void cycleAll(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 1) { + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[EMOTIS])); + unicode_input_finish(); + } + else if(state->count <= 1642) { + tap(KC_BSPC); + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[1])+state->count); + unicode_input_finish(); + } +}; + + +void cycleEmojis(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 1) { + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[EMOTIS])); + unicode_input_finish(); + } + else if(state->count <= 80) { + tap(KC_BSPC); + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[EMOTIS])+state->count); + unicode_input_finish(); + } +}; + +void cycleAnimals(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 1) { + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[ANIMALS])); + unicode_input_finish(); + } + else if(state->count <= MAXEMOJITAPS) { + tap(KC_BSPC); + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[ANIMALS])+state->count); + unicode_input_finish(); + } +}; + +void cycleFoods(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 1) { + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[FOODS])); + unicode_input_finish(); + } + else if(state->count <= 87) { + tap(KC_BSPC); + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[FOODS])+state->count); + unicode_input_finish(); + } +}; + + +void cycleEtc(qk_tap_dance_state_t *state, void *user_data) { + if(state->count == 1) { + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[ETC])); + unicode_input_finish(); + } + else if(state->count <= MAXEMOJITAPS) { + tap(KC_BSPC); + unicode_input_start(); + register_hex32(pgm_read_dword(&unicode_map[ETC])+state->count); + unicode_input_finish(); + } +}; + diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/readme.md b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/readme.md new file mode 100644 index 0000000000..0b01f9dbf8 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/readme.md @@ -0,0 +1,24 @@ +# The Nikchi's keymap for frosty_flake + +### FEATURING +-SPACE CADET +-Caps Lock is now LCTRL +-LCTRL is Tap(LCTRL, Caps Lock) + +### LEADER KEY - RALT +COMBOS +-a,a => Select All, Copy + + + +### FN REBINDS for Windows +``` + [W] [New Desktop] +[A][S][D] [Left Desk][Delete Desk][Right Desk] + +[Ins][Hom][PUp] [RW][PP][FF] +[Del][End][PDn] [MU][VD][VU] + +Arrows are Mouskeys, left three mods are clicks + +``` \ No newline at end of file diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/rules.mk b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/rules.mk new file mode 100644 index 0000000000..b21eb64044 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/rules.mk @@ -0,0 +1,24 @@ +# 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 = no # 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 +UNICODEMAP_ENABLE = yes # unicodemap +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 +TAP_DANCE_ENABLE = yes +LEADER_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md new file mode 100644 index 0000000000..b2e5041393 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/nikchi/variableTapDance.md @@ -0,0 +1,9 @@ +# Tap Dancing to different beats. +Tap Dance is constrained normally by `TAPPING_TERM` defined in your keyboard's config.h This proves to be challenging to work with when sometimes you just need more time to tap out your dance, or even a different "beat". + + + +- `ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term)` : This works the same as `ACTION_TAP_DANCE_FN_ADVANCED` just with the extra `tap_specific_tapping_term` arguement at the end. This way you can set a specific tap dance to have a longer or shorter tap in between your taps, giving you more, or less, time in between each tap. + + +`tap_specific_tapping_term` should be the same type and range of values that one would put into the `TAPPING_TERM` definition in the config.h file. diff --git a/keyboards/bpiphany/frosty_flake/keymaps/tkl/config.h b/keyboards/bpiphany/frosty_flake/keymaps/tkl/config.h new file mode 100644 index 0000000000..8893d122e0 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/tkl/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/bpiphany/frosty_flake/keymaps/tkl/keymap.c b/keyboards/bpiphany/frosty_flake/keymaps/tkl/keymap.c new file mode 100644 index 0000000000..99dc95627e --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/tkl/keymap.c @@ -0,0 +1,11 @@ +#include "frosty_flake.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = KEYMAP_TKL(\ + 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_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_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_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ) +}; diff --git a/keyboards/bpiphany/frosty_flake/keymaps/tkl/readme.md b/keyboards/bpiphany/frosty_flake/keymaps/tkl/readme.md new file mode 100644 index 0000000000..a076a65de9 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/tkl/readme.md @@ -0,0 +1 @@ +# TKL keymap for frosty_flake diff --git a/keyboards/bpiphany/frosty_flake/keymaps/tkl/rules.mk b/keyboards/bpiphany/frosty_flake/keymaps/tkl/rules.mk new file mode 100644 index 0000000000..f29756f223 --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/keymaps/tkl/rules.mk @@ -0,0 +1,17 @@ +# 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 = 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 +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. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/bpiphany/frosty_flake/matrix.c b/keyboards/bpiphany/frosty_flake/matrix.c new file mode 100644 index 0000000000..480e3455ba --- /dev/null +++ b/keyboards/bpiphany/frosty_flake/matrix.c @@ -0,0 +1,155 @@ +/* + Copyright 2017 Gabriel Young + + 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 . +*/ + +#include +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif +static uint8_t debouncing = DEBOUNCING_DELAY; + +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +static matrix_row_t scan_col(void) { + return ( + (PINC&(1<<7) ? 0 : ((matrix_row_t)1<<0)) | + (PINB&(1<<5) ? 0 : ((matrix_row_t)1<<1)) | + (PINB&(1<<4) ? 0 : ((matrix_row_t)1<<2)) | + (PINB&(1<<6) ? 0 : ((matrix_row_t)1<<3)) | + (PINB&(1<<1) ? 0 : ((matrix_row_t)1<<4)) | + (PINB&(1<<2) ? 0 : ((matrix_row_t)1<<5)) | + (PINB&(1<<3) ? 0 : ((matrix_row_t)1<<6)) | + (PINB&(1<<0) ? 0 : ((matrix_row_t)1<<7)) + ); +} + +static void select_col(uint8_t col) { + switch (col) { + case 0: PORTD = (PORTD & ~0b01111011) | 0b00011011; break; + case 1: PORTD = (PORTD & ~0b01111011) | 0b01000011; break; + case 2: PORTD = (PORTD & ~0b01111011) | 0b01101010; break; + case 3: PORTD = (PORTD & ~0b01111011) | 0b01111001; break; + case 4: PORTD = (PORTD & ~0b01111011) | 0b01100010; break; + case 5: PORTD = (PORTD & ~0b01111011) | 0b01110001; break; + case 6: PORTD = (PORTD & ~0b01111011) | 0b01100001; break; + case 7: PORTD = (PORTD & ~0b01111011) | 0b01110000; break; + case 8: PORTD = (PORTD & ~0b01111011) | 0b01100000; break; + case 9: PORTD = (PORTD & ~0b01111011) | 0b01101000; break; + case 10: PORTD = (PORTD & ~0b01111011) | 0b00101011; break; + case 11: PORTD = (PORTD & ~0b01111011) | 0b00110011; break; + case 12: PORTD = (PORTD & ~0b01111011) | 0b00100011; break; + case 13: PORTD = (PORTD & ~0b01111011) | 0b01111000; break; + case 14: PORTD = (PORTD & ~0b01111011) | 0b00010011; break; + case 15: PORTD = (PORTD & ~0b01111011) | 0b01101001; break; + case 16: PORTD = (PORTD & ~0b01111011) | 0b00001011; break; + case 17: PORTD = (PORTD & ~0b01111011) | 0b00111011; break; + } +} + +void matrix_init(void) { + /* Row output pins */ + DDRD |= 0b01111011; + /* Column input pins */ + DDRC &= ~0b10000000; + DDRB &= ~0b01111111; + PORTC |= 0b10000000; + PORTB |= 0b01111111; + + for (uint8_t i=0; i < MATRIX_ROWS; i++) + matrix[i] = matrix_debouncing[i] = 0; + + matrix_init_quantum(); +} + +uint8_t matrix_scan(void) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); + _delay_us(3); + matrix_row_t col_scan = scan_col(); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<