~ruther/qmk_firmware

b008a9afe6f216cebe4c664d5ce59cd6bfe755c3 — James Young 5 years ago d8e3294
HID Liberation Device Refactor and Configurator layout support (#9394)

9 files changed, 143 insertions(+), 84 deletions(-)

M keyboards/hid_liber/hid_liber.c
M keyboards/hid_liber/hid_liber.h
A keyboards/hid_liber/info.json
D keyboards/hid_liber/keymaps/default/config.h
M keyboards/hid_liber/keymaps/default/keymap.c
M keyboards/hid_liber/keymaps/default/readme.md
D keyboards/hid_liber/keymaps/default/rules.mk
M keyboards/hid_liber/readme.md
M keyboards/hid_liber/rules.mk
M keyboards/hid_liber/hid_liber.c => keyboards/hid_liber/hid_liber.c +9 -27
@@ 24,34 24,16 @@ void matrix_init_kb(void) {
    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
    setPinOutput(B5);
    setPinOutput(B6);
}

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);
bool led_update_kb(led_t led_state) {
    bool res = led_update_user(led_state);
    if(res) {
        writePin(B5, !led_state.caps_lock);
        writePin(B6, !led_state.scroll_lock);
    }
    return res;
}

M keyboards/hid_liber/hid_liber.h => keyboards/hid_liber/hid_liber.h +1 -6
@@ 14,8 14,7 @@
 * 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
#pragma once

#include "quantum.h"



@@ 69,7 68,3 @@
/* Q */   { ___ , ___ , KQ2 , ___ , ___ , ___ , ___ , KQ7 }, \
/* R */   { ___ , ___ , ___ , ___ , KR4 , ___ , ___ , ___ }  \
}



#endif

A keyboards/hid_liber/info.json => keyboards/hid_liber/info.json +101 -0
@@ 0,0 1,101 @@
{
    "keyboard_name": "bpiphany HIDLiberation",
    "url": "",
    "maintainer": "qmk",
    "width": 18.25,
    "height": 6.5,
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"label":"KG1", "x":0, "y":0},
                {"label":"KH7", "x":2, "y":0},
                {"label":"KJ7", "x":3, "y":0},
                {"label":"KJ6", "x":4, "y":0},
                {"label":"KJ1", "x":5, "y":0},
                {"label":"KO5", "x":6.5, "y":0},
                {"label":"KL1", "x":7.5, "y":0},
                {"label":"KA6", "x":8.5, "y":0},
                {"label":"KA7", "x":9.5, "y":0},
                {"label":"KD7", "x":11, "y":0},
                {"label":"KD5", "x":12, "y":0},
                {"label":"KD1", "x":13, "y":0},
                {"label":"KD2", "x":14, "y":0},
                {"label":"KB5", "x":15.25, "y":0},
                {"label":"KB3", "x":16.25, "y":0},
                {"label":"KO3", "x":17.25, "y":0},
                {"label":"KG7", "x":0, "y":1.5},
                {"label":"KG5", "x":1, "y":1.5},
                {"label":"KH5", "x":2, "y":1.5},
                {"label":"KJ5", "x":3, "y":1.5},
                {"label":"KI5", "x":4, "y":1.5},
                {"label":"KI7", "x":5, "y":1.5},
                {"label":"KK7", "x":6, "y":1.5},
                {"label":"KK5", "x":7, "y":1.5},
                {"label":"KL5", "x":8, "y":1.5},
                {"label":"KA5", "x":9, "y":1.5},
                {"label":"KC5", "x":10, "y":1.5},
                {"label":"KC7", "x":11, "y":1.5},
                {"label":"KL7", "x":12, "y":1.5},
                {"label":"KD6", "x":13, "y":1.5, "w":2},
                {"label":"KQ7", "x":15.25, "y":1.5},
                {"label":"KN7", "x":16.25, "y":1.5},
                {"label":"KM7", "x":17.25, "y":1.5},
                {"label":"KG6", "x":0, "y":2.5, "w":1.5},
                {"label":"KG3", "x":1.5, "y":2.5},
                {"label":"KH3", "x":2.5, "y":2.5},
                {"label":"KJ3", "x":3.5, "y":2.5},
                {"label":"KI3", "x":4.5, "y":2.5},
                {"label":"KI6", "x":5.5, "y":2.5},
                {"label":"KK6", "x":6.5, "y":2.5},
                {"label":"KK3", "x":7.5, "y":2.5},
                {"label":"KL3", "x":8.5, "y":2.5},
                {"label":"KA3", "x":9.5, "y":2.5},
                {"label":"KC3", "x":10.5, "y":2.5},
                {"label":"KC6", "x":11.5, "y":2.5},
                {"label":"KL6", "x":12.5, "y":2.5},
                {"label":"KD4", "x":13.5, "y":2.5, "w":1.5},
                {"label":"KP7", "x":15.25, "y":2.5},
                {"label":"KN5", "x":16.25, "y":2.5},
                {"label":"KM5", "x":17.25, "y":2.5},
                {"label":"KH6", "x":0, "y":3.5, "w":1.75},
                {"label":"KG4", "x":1.75, "y":3.5},
                {"label":"KH4", "x":2.75, "y":3.5},
                {"label":"KJ4", "x":3.75, "y":3.5},
                {"label":"KI4", "x":4.75, "y":3.5},
                {"label":"KI1", "x":5.75, "y":3.5},
                {"label":"KK1", "x":6.75, "y":3.5},
                {"label":"KK4", "x":7.75, "y":3.5},
                {"label":"KL4", "x":8.75, "y":3.5},
                {"label":"KA4", "x":9.75, "y":3.5},
                {"label":"KC4", "x":10.75, "y":3.5},
                {"label":"KC1", "x":11.75, "y":3.5},
                {"label":"KD0", "x":12.75, "y":3.5, "w":2.25},
                {"label":"KF6", "x":0, "y":4.5, "w":1.25},
                {"label":"KH1", "x":1.25, "y":4.5},
                {"label":"KG0", "x":2.25, "y":4.5},
                {"label":"KH0", "x":3.25, "y":4.5},
                {"label":"KJ0", "x":4.25, "y":4.5},
                {"label":"KI0", "x":5.25, "y":4.5},
                {"label":"KI2", "x":6.25, "y":4.5},
                {"label":"KK2", "x":7.25, "y":4.5},
                {"label":"KK0", "x":8.25, "y":4.5},
                {"label":"KL0", "x":9.25, "y":4.5},
                {"label":"KA0", "x":10.25, "y":4.5},
                {"label":"KC2", "x":11.25, "y":4.5},
                {"label":"KF4", "x":12.25, "y":4.5, "w":2.75},
                {"label":"KN1", "x":16.25, "y":4.5},
                {"label":"KO7", "x":0, "y":5.5, "w":1.25},
                {"label":"KE6", "x":1.25, "y":5.5, "w":1.25},
                {"label":"KB1", "x":2.5, "y":5.5, "w":1.25},
                {"label":"KP1", "x":3.75, "y":5.5, "w":6.25},
                {"label":"KB2", "x":10, "y":5.5, "w":1.25},
                {"label":"KR4", "x":11.25, "y":5.5, "w":1.25},
                {"label":"KA2", "x":12.5, "y":5.5, "w":1.25},
                {"label":"KO0", "x":13.75, "y":5.5, "w":1.25},
                {"label":"KN2", "x":15.25, "y":5.5},
                {"label":"KP2", "x":16.25, "y":5.5},
                {"label":"KQ2", "x":17.25, "y":5.5}
            ]
        }
    }
}

D keyboards/hid_liber/keymaps/default/config.h => keyboards/hid_liber/keymaps/default/config.h +0 -1
@@ 1,1 0,0 @@
#pragma once
\ No newline at end of file

M keyboards/hid_liber/keymaps/default/keymap.c => keyboards/hid_liber/keymaps/default/keymap.c +18 -37
@@ 16,45 16,26 @@
 */
#include QMK_KEYBOARD_H

// 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
enum layer_names {
    _BL, // Base Layer
    _FL, // 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  \
    [_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, \
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,                                 \
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,               _______,          \
        _______, _______, _______,                            _______,                            _______, _______, _______, _______,      _______, _______, _______  \
    [_FL] = LAYOUT(
        _______,          _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,      _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,      KC_VOLD, KC_MSTP, KC_VOLU,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,      KC_MNXT, KC_MPLY, KC_MNXT,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______,               _______,
        _______, _______, _______,                            _______,                            _______, _______, _______, _______,      _______, _______, _______
    ),
};

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) {

}

M keyboards/hid_liber/keymaps/default/readme.md => keyboards/hid_liber/keymaps/default/readme.md +5 -5
@@ 1,4 1,4 @@
# ANSI Keymap for the HID Liberation Device
# The default keymap for the HID Liberation Device

A basic keymap intended for the HID Liberation Device using the standard ANSI layout.



@@ 19,9 19,9 @@ This keymap has two layers. To access the functions on the second layer, hold do
     |-----------------------------------------------------------| '-----------'
     |Caps  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |
     |-----------------------------------------------------------|     ,---.
     |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift     |     |Up |
     |Sft |ISO|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift     |     |Up |
     |-----------------------------------------------------------| ,-----------.
     |Ctl|Gui|Alt|             Space             |Alt|Gui|Fn |Ctl| |Lef|Dow|Rig|
     |Ctl |Gui |Alt |         Space          |Alt |Gui |Fn  |Ctl | |Lef|Dow|Rig|
     `-----------------------------------------------------------' `-----------'

### Layer 2: Media Layer


@@ 35,7 35,7 @@ This keymap has two layers. To access the functions on the second layer, hold do
     |-----------------------------------------------------------| '-----------'
     |      |   |   |   |   |   |   |   |   |   |   |   |        |
     |-----------------------------------------------------------|     ,---.
     |        |   |   |   |   |   |   |   |   |   |   |          |     |   |
     |    |   |   |   |   |   |   |   |   |   |   |   |          |     |   |
     |-----------------------------------------------------------| ,-----------.
     |   |   |   |                               |   |   |   |   | |   |   |   |
     |    |    |    |                        |    |    |    |    | |   |   |   |
     `-----------------------------------------------------------' `-----------'

D keyboards/hid_liber/keymaps/default/rules.mk => keyboards/hid_liber/keymaps/default/rules.mk +0 -1
@@ 1,1 0,0 @@
CONSOLE_ENABLE = yes

M keyboards/hid_liber/readme.md => keyboards/hid_liber/readme.md +8 -6
@@ 1,15 1,17 @@
HID Liberation Device
=====================
DIY daughterboard for Filco Majestouch TKL developed by Geekhack and Deskthority communities.
The PCB was engineered by bpiphany.
# 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
* Keyboard Maintainer: [The QMK Community](https://github.com/qmk)
* Hardware Supported: HID Liberation Device (ATmega32U4)
* Hardware Availability: Discontinued

Make example for this keyboard (after setting up your build environment):

    make hid_liber:default

See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

M keyboards/hid_liber/rules.mk => keyboards/hid_liber/rules.mk +1 -1
@@ 17,7 17,7 @@ BOOTLOADER = atmel-dfu
BOOTMAGIC_ENABLE = yes      # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes       # Mouse keys
EXTRAKEY_ENABLE = yes       # Audio control and System control
CONSOLE_ENABLE = no         # Console for debug
CONSOLE_ENABLE = yes        # Console for debug
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