diff options
Diffstat (limited to 'keyboards')
-rwxr-xr-x | keyboards/hid_liber/config.h | 170 | ||||
-rwxr-xr-x | keyboards/hid_liber/hid_liber.c | 57 | ||||
-rwxr-xr-x | keyboards/hid_liber/hid_liber.h | 75 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/bakageta/config.h | 3 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/bakageta/keymap.c | 89 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/bakageta/readme.md | 58 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/bakageta/rules.mk | 33 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/default/config.h | 1 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/default/keymap.c | 79 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/default/readme.md | 41 | ||||
-rwxr-xr-x | keyboards/hid_liber/keymaps/default/rules.mk | 33 | ||||
-rwxr-xr-x | keyboards/hid_liber/matrix.c | 269 | ||||
-rwxr-xr-x | keyboards/hid_liber/readme.md | 15 | ||||
-rwxr-xr-x | keyboards/hid_liber/rules.mk | 73 |
14 files changed, 996 insertions, 0 deletions
diff --git a/keyboards/hid_liber/config.h b/keyboards/hid_liber/config.h new file mode 100755 index 0000000000..0817db0012 --- /dev/null +++ b/keyboards/hid_liber/config.h @@ -0,0 +1,170 @@ +/* Copyright 2012 Jun Wako <wakojun@gmail.com>: Original Configuration + * Copyright 2018 bakageta <amo@bakageta.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 0xB919 +#define DEVICE_VER 0x0001 +#define MANUFACTURER "bpiphany" +#define USBSTR_MANUFACTURER 'b', '\x00', 'p', '\x00', 'i', '\x00', 'p', '\x00', 'h', '\x00', 'a', '\x00', 'n', '\x00', 'y', '\x00' +#define PRODUCT "HIDLiberation" +#define USBSTR_PRODUCT 'H', '\x00', 'I', '\x00', 'D', '\x00', ' ', '\x00', 'L', '\x00', 'i', '\x00', 'b', '\x00', 'e', '\x00', 'r', '\x00', 'a', '\x00', 't', '\x00', 'i', '\x00', 'o', '\x00', 'n', '\x00' +#define DESCRIPTION "HID Liberation powered by QMK" + +/* key matrix size */ +#define MATRIX_ROWS 18 +#define MATRIX_COLS 8 + +// HID Liberation Device uses custom matrix code to accomodate a 74HC238 3 to 8 decoder on pins B1, B2 and B3. +#define DIODE_DIRECTION CUSTOM_MATRIX + +// #define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +// #define BACKLIGHT_LEVELS 3 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't 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 + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +#endif diff --git a/keyboards/hid_liber/hid_liber.c b/keyboards/hid_liber/hid_liber.c new file mode 100755 index 0000000000..6517c92062 --- /dev/null +++ b/keyboards/hid_liber/hid_liber.c @@ -0,0 +1,57 @@ +/* Copyright 2012 Jun Wako <wakojun@gmail.com>: LED init + * Copyright 2017 Mathias Andersson <wraul@dbox.se>: Phantom config + * Copyright 2018 bakageta <amo@bakageta.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 "hid_liber.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + led_init_ports(); + 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_init_ports(void) { + DDRB |= (1<<5) | (1<<6); // OUT +} + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1<<USB_LED_CAPS_LOCK)) + PORTB &= ~(1<<5); + else + PORTB |= (1<<5); + + if (usb_led & (1<<USB_LED_SCROLL_LOCK)) + PORTB &= ~(1<<6); + else + PORTB |= (1<<6); + + led_set_user(usb_led); +} diff --git a/keyboards/hid_liber/hid_liber.h b/keyboards/hid_liber/hid_liber.h new file mode 100755 index 0000000000..f36152b646 --- /dev/null +++ b/keyboards/hid_liber/hid_liber.h @@ -0,0 +1,75 @@ +/* Copyright 2011 Jun Wako <wakojun@gmail.com>: Original TMK layout + * Copyright 2018 bakageta <amo@bakageta.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 HID_LIBER_H +#define HID_LIBER_H + +#include "quantum.h" + +#define ___ KC_NO + +/* Tenkeyless keyboard default layout, ISO & ANSI (ISO is between Left Shift + * and Z, and the ANSI \ key above Return/Enter is used for the additional ISO + * switch in the ASD row next to enter. Use NUBS as keycode for the first and + * NUHS as the keycode for the second. + * + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. + * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU| + * |-----------------------------------------------------------| |-----------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| + * |-----------------------------------------------------------| `-----------' + * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| ,---. + * |Shft|ISO| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | + * |-----------------------------------------------------------| ,-----------. + * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| + * `-----------------------------------------------------------' `-----------' + */ +#define LAYOUT( \ + KG1, KH7, KJ7, KJ6, KJ1, KO5, KL1, KA6, KA7, KD7, KD5, KD1, KD2, KB5, KB3, KO3, \ + KG7, KG5, KH5, KJ5, KI5, KI7, KK7, KK5, KL5, KA5, KC5, KC7, KL7, KD6, KQ7, KN7, KM7, \ + KG6, KG3, KH3, KJ3, KI3, KI6, KK6, KK3, KL3, KA3, KC3, KC6, KL6, KD4, KP7, KN5, KM5, \ + KH6, KG4, KH4, KJ4, KI4, KI1, KK1, KK4, KL4, KA4, KC4, KC1, KD0, \ + KF6, KH1, KG0, KH0, KJ0, KI0, KI2, KK2, KK0, KL0, KA0, KC2, KF4, KN1, \ + KO7, KE6, KB1, KP1, KB2, KR4, KA2, KO0, KN2, KP2, KQ2 \ +) { \ +/* 0 1 2 3 4 5 6 7 */ \ +/* A */ { KA0 , ___ , KA2 , KA3 , KA4 , KA5 , KA6 , KA7 }, \ +/* B */ { ___ , KB1 , KB2 , KB3 , ___ , KB5 , ___ , ___ }, \ +/* C */ { ___ , KC1 , KC2 , KC3 , KC4 , KC5 , KC6 , KC7 }, \ +/* D */ { KD0 , KD1 , KD2 , ___ , KD4 , KD5 , KD6 , KD7 }, \ +/* E */ { ___ , ___ , ___ , ___ , ___ , ___ , KE6 , ___ }, \ +/* F */ { ___ , ___ , ___ , ___ , KF4 , ___ , KF6 , ___ }, \ +/* G */ { KG0 , KG1 , ___ , KG3 , KG4 , KG5 , KG6 , KG7 }, \ +/* H */ { KH0 , KH1 , ___ , KH3 , KH4 , KH5 , KH6 , KH7 }, \ +/* I */ { KI0 , KI1 , KI2 , KI3 , KI4 , KI5 , KI6 , KI7 }, \ +/* J */ { KJ0 , KJ1 , ___ , KJ3 , KJ4 , KJ5 , KJ6 , KJ7 }, \ +/* K */ { KK0 , KK1 , KK2 , KK3 , KK4 , KK5 , KK6 , KK7 }, \ +/* L */ { KL0 , KL1 , ___ , KL3 , KL4 , KL5 , KL6 , KL7 }, \ +/* M */ { ___ , ___ , ___ , ___ , ___ , KM5 , ___ , KM7 }, \ +/* N */ { ___ , KN1 , KN2 , ___ , ___ , KN5 , ___ , KN7 }, \ +/* O */ { KO0 , ___ , ___ , KO3 , ___ , KO5 , ___ , KO7 }, \ +/* P */ { ___ , KP1 , KP2 , ___ , ___ , ___ , ___ , KP7 }, \ +/* Q */ { ___ , ___ , KQ2 , ___ , ___ , ___ , ___ , KQ7 }, \ +/* R */ { ___ , ___ , ___ , ___ , KR4 , ___ , ___ , ___ } \ +} + + + +#endif diff --git a/keyboards/hid_liber/keymaps/bakageta/config.h b/keyboards/hid_liber/keymaps/bakageta/config.h new file mode 100755 index 0000000000..b158e2d5a2 --- /dev/null +++ b/keyboards/hid_liber/keymaps/bakageta/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define PERMISSIVE_HOLD diff --git a/keyboards/hid_liber/keymaps/bakageta/keymap.c b/keyboards/hid_liber/keymaps/bakageta/keymap.c new file mode 100755 index 0000000000..9754a70dfc --- /dev/null +++ b/keyboards/hid_liber/keymaps/bakageta/keymap.c @@ -0,0 +1,89 @@ +/* Copyright 2017 Mathias Andersson <wraul@dbox.se>: Phantom Layout + * Copyright 2018 bakageta <amo@bakageta.com>: HID Liberation layouts + * + * 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 "hid_liber.h" + +// Helpful defines +#define _______ KC_TRNS +#define FN_CAPS LT(_FL, KC_CAPSLOCK) + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +#define _BL 0 // Base Layer +#define _GL 1 // Gaming Layer +#define _FL 2 // Function Layer + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BL] = LAYOUT( \ + 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_BRK, \ + 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, \ + FN_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_NO, 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, TT(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [_GL] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + [_FL] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, TO(_BL), TO(_GL), _______, _______, _______, _______, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, _______, KC_VOLD, KC_MSTP, KC_VOLU, \ + _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, _______, KC_MNXT, KC_MPLY, KC_MNXT, \ + _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______, _______, \ + _______, _______, _______, KC_P0, KC_PDOT, KC_PENT, _______, _______, _______, _______, _______ \ + ), +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/hid_liber/keymaps/bakageta/readme.md b/keyboards/hid_liber/keymaps/bakageta/readme.md new file mode 100755 index 0000000000..2b13586c0f --- /dev/null +++ b/keyboards/hid_liber/keymaps/bakageta/readme.md @@ -0,0 +1,58 @@ +# bakageta's Keymap for the HID Liberation Device + +A personal keymap intended for the HID Liberation Device. + +See [keymap.c](keymap.c) for details. + +## Layers + +This keymap has a base layer with combined Fn/Caps, Fn replacing APP, and an otherwise standard ANSI layout. The gaming layer blocks LGUI, and reverts caps back to a regular key for games that bind something to it. The function layer adds media keys to the nav cluster and a virtual numpad, with 1 and 2 selecting between Base and Gaming respectively. + +### Layer 1: Base Layer + ,---. ,---------------. ,---------------. ,---------------. ,-----------. + |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + `---' `---------------' `---------------' `---------------' `-----------' + ,-----------------------------------------------------------. ,-----------. + |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU| + |-----------------------------------------------------------| |-----------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| + |-----------------------------------------------------------| '-----------' + |Fn/Cps| A| S| D| F| G| H| J| K| L| ;| '|Return | + |-----------------------------------------------------------| ,---. + |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | + |-----------------------------------------------------------| ,-----------. + |Ctl|Gui|Alt| Space |Alt|Gui|Fn |Ctl| |Lef|Dow|Rig| + `-----------------------------------------------------------' `-----------' + +### Layer 2: Gaming Layer + ,---. ,---------------. ,---------------. ,---------------. ,-----------. + | | | | | | | | | | | | | | | | | | | | | + `---' `---------------' `---------------' `---------------' `-----------' + ,-----------------------------------------------------------. ,-----------. + | | | | | | | | | | | | | | | | | | | + |-----------------------------------------------------------| |-----------| + | | | | | | | | | | | | | | | | | | | + |-----------------------------------------------------------| '-----------' + | Caps | | | | | | | | | | | | | + |-----------------------------------------------------------| ,---. + | | | | | | | | | | | | | | | + |-----------------------------------------------------------| ,-----------. + | |XXX| | | | | | | | | | | + `-----------------------------------------------------------' `-----------' + + +### Layer 3: Function Layer + ,---. ,---------------. ,---------------. ,---------------. ,-----------. + | | | | | | | | | | | | | | | | | | | | | + `---' `---------------' `---------------' `---------------' `-----------' + ,-----------------------------------------------------------. ,-----------. + | | BL| GL| | | | | | | | | | | | |Vo-|Stp|Vo+| + |-----------------------------------------------------------| |-----------| + | | | | | | | | | | | | | | | |Prv|Ply|Nxt| + |-----------------------------------------------------------| '-----------' + | | | | | | | | | | | | | | + |-----------------------------------------------------------| ,---. + | | | | | | | | | | | | | | | + |-----------------------------------------------------------| ,-----------. + | | | | | | | | | | | | | + `-----------------------------------------------------------' `-----------' diff --git a/keyboards/hid_liber/keymaps/bakageta/rules.mk b/keyboards/hid_liber/keymaps/bakageta/rules.mk new file mode 100755 index 0000000000..0f131bce9b --- /dev/null +++ b/keyboards/hid_liber/keymaps/bakageta/rules.mk @@ -0,0 +1,33 @@ +# Copyright 2013 Jun Wako <wakojun@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# QMK 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 +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 support (+2400 to 4200, depending on config) +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
\ No newline at end of file diff --git a/keyboards/hid_liber/keymaps/default/config.h b/keyboards/hid_liber/keymaps/default/config.h new file mode 100755 index 0000000000..7b9637ef9c --- /dev/null +++ b/keyboards/hid_liber/keymaps/default/config.h @@ -0,0 +1 @@ +#pragma once
\ No newline at end of file diff --git a/keyboards/hid_liber/keymaps/default/keymap.c b/keyboards/hid_liber/keymaps/default/keymap.c new file mode 100755 index 0000000000..337b4829d2 --- /dev/null +++ b/keyboards/hid_liber/keymaps/default/keymap.c @@ -0,0 +1,79 @@ +/* Copyright 2017 Mathias Andersson <wraul@dbox.se>: Phantom Layout + * Copyright 2018 bakageta <amo@bakageta.com>: HID Liberation layouts + * + * 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 "hid_liber.h" + +// Helpful defines +#define _______ KC_TRNS + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +#define _BL 0 // Base Layer +#define _FL 1 // Media Layer + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BL] = LAYOUT( \ + 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_BRK, \ + 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, MO(_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [_FL] = LAYOUT( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_MSTP, KC_VOLU, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_MPLY, KC_MNXT, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/hid_liber/keymaps/default/readme.md b/keyboards/hid_liber/keymaps/default/readme.md new file mode 100755 index 0000000000..963524389e --- /dev/null +++ b/keyboards/hid_liber/keymaps/default/readme.md @@ -0,0 +1,41 @@ +# ANSI Keymap for the HID Liberation Device + +A basic keymap intended for the HID Liberation Device using the standard ANSI layout. + +See [keymap.c](keymap.c) for details. + +## Layers + +This keymap has two layers. To access the functions on the second layer, hold down `Fn` and press the corresponding key. + +### Layer 1: Base Layer + ,---. ,---------------. ,---------------. ,---------------. ,-----------. + |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + `---' `---------------' `---------------' `---------------' `-----------' + ,-----------------------------------------------------------. ,-----------. + |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU| + |-----------------------------------------------------------| |-----------| + |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| + |-----------------------------------------------------------| '-----------' + |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | + |-----------------------------------------------------------| ,---. + |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | + |-----------------------------------------------------------| ,-----------. + |Ctl|Gui|Alt| Space |Alt|Gui|Fn |Ctl| |Lef|Dow|Rig| + `-----------------------------------------------------------' `-----------' + +### Layer 2: Media Layer + ,---. ,---------------. ,---------------. ,---------------. ,-----------. + | | | | | | | | | | | | | | | | | | | | | + `---' `---------------' `---------------' `---------------' `-----------' + ,-----------------------------------------------------------. ,-----------. + | | | | | | | | | | | | | | | |Vo-|Stp|Vo+| + |-----------------------------------------------------------| |-----------| + | | | | | | | | | | | | | | | |Prv|Ply|Nxt| + |-----------------------------------------------------------| '-----------' + | | | | | | | | | | | | | | + |-----------------------------------------------------------| ,---. + | | | | | | | | | | | | | | | + |-----------------------------------------------------------| ,-----------. + | | | | | | | | | | | | | + `-----------------------------------------------------------' `-----------' diff --git a/keyboards/hid_liber/keymaps/default/rules.mk b/keyboards/hid_liber/keymaps/default/rules.mk new file mode 100755 index 0000000000..0f131bce9b --- /dev/null +++ b/keyboards/hid_liber/keymaps/default/rules.mk @@ -0,0 +1,33 @@ +# Copyright 2013 Jun Wako <wakojun@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# QMK 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 +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 support (+2400 to 4200, depending on config) +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
\ No newline at end of file diff --git a/keyboards/hid_liber/matrix.c b/keyboards/hid_liber/matrix.c new file mode 100755 index 0000000000..de154890d5 --- /dev/null +++ b/keyboards/hid_liber/matrix.c @@ -0,0 +1,269 @@ +/* Copyright 2012 Jun Wako <wakojun@gmail.com>: TMK Matrix + * Copyright 2018 bakageta <amo@bakageta.com> + * + * This is heavily based on hid_liber/board.{c|h}. + * https://github.com/BathroomEpiphanies/AVR-Keyboard + * + * Copyright (c) 2012 Fredrik Atmer, Bathroom Epiphanies Inc + * http://bathroomepiphanies.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> +#if defined(__AVR__) +#include <avr/io.h> +#endif +#include <util/delay.h> +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" + + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif +static uint8_t debouncing = DEBOUNCE; + +// bit array of key state(1:on, 0:off) +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + + +#define _DDRA (uint8_t *const)&DDRA +#define _DDRB (uint8_t *const)&DDRB +#define _DDRC (uint8_t *const)&DDRC +#define _DDRD (uint8_t *const)&DDRD +#define _DDRE (uint8_t *const)&DDRE +#define _DDRF (uint8_t *const)&DDRF + +#define _PINA (uint8_t *const)&PINA +#define _PINB (uint8_t *const)&PINB +#define _PINC (uint8_t *const)&PINC +#define _PIND (uint8_t *const)&PIND +#define _PINE (uint8_t *const)&PINE +#define _PINF (uint8_t *const)&PINF + +#define _PORTA (uint8_t *const)&PORTA +#define _PORTB (uint8_t *const)&PORTB +#define _PORTC (uint8_t *const)&PORTC +#define _PORTD (uint8_t *const)&PORTD +#define _PORTE (uint8_t *const)&PORTE +#define _PORTF (uint8_t *const)&PORTF + +#define _BIT0 0x01 +#define _BIT1 0x02 +#define _BIT2 0x04 +#define _BIT3 0x08 +#define _BIT4 0x10 +#define _BIT5 0x20 +#define _BIT6 0x40 +#define _BIT7 0x80 + +/* Specifies the ports and pin numbers for the rows */ +static +uint8_t *const row_ddr[MATRIX_ROWS] = { + _DDRB, _DDRB, + _DDRC, _DDRC, + _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, + _DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF}; + +static +uint8_t *const row_port[MATRIX_ROWS] = { + _PORTB, _PORTB, + _PORTC, _PORTC, + _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, + _PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF}; + +static +uint8_t *const row_pin[MATRIX_ROWS] = { + _PINB, _PINB, + _PINC, _PINC, + _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, + _PINF, _PINF, _PINF, _PINF, _PINF, _PINF}; + +static +const uint8_t row_bit[MATRIX_ROWS] = { + _BIT4, _BIT7, + _BIT6, _BIT7, + _BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5, _BIT6, _BIT7, + _BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7}; + +static +const uint8_t mask = 0x0E; + +/* Specifies the ports and pin numbers for the columns */ +static +const uint8_t col_bit[MATRIX_COLS] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E}; + +__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 +inline void pull_column(int col) { + PORTB = col_bit[col] | (PORTB & ~mask); +} + +static +inline void release_column(int col) { +} + +/* PORTB is set as input with pull-up resistors + PORTC,D,E,F are set to high output */ +static +void setup_io_pins(void) { + uint8_t row; + DDRB |= 0x0E; + PORTB &= ~0x0E; + for(row = 0; row < MATRIX_ROWS; row++) { + *row_ddr[row] &= ~row_bit[row]; + *row_port[row] &= ~row_bit[row]; + } +} + +static +void setup_leds(void) { + DDRB |= 0x60; + PORTB |= 0x60; +} + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + // To use PORTF disable JTAG with writing JTD bit twice within four cycles. + MCUCR |= (1<<JTD); + MCUCR |= (1<<JTD); + + // initialize row and col + setup_io_pins(); + setup_leds(); + + // initialize matrix state: all keys off + 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++) { // 0-7 + pull_column(col); // output hi on theline + _delay_us(5); // without this wait it won't read stable value. + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17 + bool prev_bit = matrix_debouncing[row] & (1<<col); + bool curr_bit = *row_pin[row] & row_bit[row]; + if (prev_bit != curr_bit) { + matrix_debouncing[row] ^= ((matrix_row_t)1<<col); + if (debouncing) { + dprintf("bounce!: %02X\n", debouncing); + } + debouncing = DEBOUNCE; + } + } + release_column(col); + } + + if (debouncing) { + if (--debouncing) { + _delay_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) +{ + // NOTE: no longer used + return true; +} + +inline +bool matrix_has_ghost(void) +{ + return false; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<<col)); +} + +inline +matrix_row_t matrix_get_row(uint8_t row) +{ + return matrix[row]; +} + +void matrix_print(void) +{ + print("\nr/c 01234567\n"); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + phex(row); print(": "); + pbin_reverse(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++) { + for (uint8_t j = 0; j < MATRIX_COLS; j++) { + if (matrix_is_on(i, j)) + count++; + } + } + return count; +} diff --git a/keyboards/hid_liber/readme.md b/keyboards/hid_liber/readme.md new file mode 100755 index 0000000000..77ea1babb1 --- /dev/null +++ b/keyboards/hid_liber/readme.md @@ -0,0 +1,15 @@ +HID Liberation Device +===================== +DIY daughterboard for Filco Majestouch TKL developed by Geekhack and Deskthority communities. +The PCB was engineered by bpiphany. + +## Wiki on Deskthority.net +- [Instructions](http://deskthority.net/wiki/HID_Liberation_Device_-_Instructions) +- [Assembly Instructions](http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions) + +## Build +Make example for this keyboard (after setting up your build environment): + + make hid_liber:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/hid_liber/rules.mk b/keyboards/hid_liber/rules.mk new file mode 100755 index 0000000000..f28a4c6ae5 --- /dev/null +++ b/keyboards/hid_liber/rules.mk @@ -0,0 +1,73 @@ +# Project specific files +SRC = matrix.c + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change 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 = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +CUSTOM_MATRIX = yes # Custom matrix file +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches |