From 350df140faf8d0c2995647fd48dfe1e2e8c37e44 Mon Sep 17 00:00:00 2001 From: jakobkg Date: Sat, 29 Oct 2022 03:28:55 +0200 Subject: [PATCH] Add firmware for the Libra Mini (#270) * Initial support, no joystick functionality * remove vscode settings file * Add non-vial default keymap * Implement joystick mouse control for default and vial keymaps * Add backslash to default keymap * Add separate layout for stick-as-keys * Remove references to unused layout * Remove reference to unused custom matrix impl --- keyboards/libra_mini/config.h | 24 ++ keyboards/libra_mini/info.json | 64 ++++++ keyboards/libra_mini/keymaps/default/config.h | 12 + keyboards/libra_mini/keymaps/default/keymap.c | 38 ++++ keyboards/libra_mini/keymaps/default/rules.mk | 6 + keyboards/libra_mini/keymaps/vial/config.h | 16 ++ keyboards/libra_mini/keymaps/vial/keymap.c | 38 ++++ keyboards/libra_mini/keymaps/vial/rules.mk | 8 + keyboards/libra_mini/keymaps/vial/vial.json | 209 ++++++++++++++++++ keyboards/libra_mini/rules.mk | 2 + 10 files changed, 417 insertions(+) create mode 100644 keyboards/libra_mini/config.h create mode 100644 keyboards/libra_mini/info.json create mode 100644 keyboards/libra_mini/keymaps/default/config.h create mode 100644 keyboards/libra_mini/keymaps/default/keymap.c create mode 100644 keyboards/libra_mini/keymaps/default/rules.mk create mode 100644 keyboards/libra_mini/keymaps/vial/config.h create mode 100644 keyboards/libra_mini/keymaps/vial/keymap.c create mode 100644 keyboards/libra_mini/keymaps/vial/rules.mk create mode 100644 keyboards/libra_mini/keymaps/vial/vial.json create mode 100644 keyboards/libra_mini/rules.mk diff --git a/keyboards/libra_mini/config.h b/keyboards/libra_mini/config.h new file mode 100644 index 0000000000..ae0fde6298 --- /dev/null +++ b/keyboards/libra_mini/config.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +/* Matrix config */ + +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +#define MATRIX_ROW_PINS { E6, B4, B5, B2 } +#define MATRIX_COL_PINS { B3, B1, F7, F6, F5, F4, C6, D4, D0, D1, D2, D3 } + +#define DIODE_DIRECTION ROW2COL + +/* Joystick config */ + +#define ANALOG_JOYSTICK_Y_AXIS_PIN B6 +#define ANALOG_JOYSTICK_X_AXIS_PIN D7 + +#define POINTING_DEVICE_INVERT_X +#define POINTING_DEVICE_INVERT_Y + +/* Use 1000hz polling */ +#define USB_POLLING_INTERVAL_MS 1 diff --git a/keyboards/libra_mini/info.json b/keyboards/libra_mini/info.json new file mode 100644 index 0000000000..4b07d6666a --- /dev/null +++ b/keyboards/libra_mini/info.json @@ -0,0 +1,64 @@ +{ + + "manufacturer": "KAISER", + "keyboard_name": "Libra Mini", + "maintainer": "jakobkg", + "usb": { + "vid": "0x4C4D", + "pid": "0x4C24", + "device_version": "2.0.0" + }, + "development_board": "promicro", + "layouts": { + "LAYOUT": { + "layout": [ + { "matrix": [0, 0], "x": 0.25, "y": 0.0 }, + { "matrix": [0, 1], "x": 1.25, "y": 0.0 }, + { "matrix": [0, 2], "x": 2.25, "y": 0.0 }, + { "matrix": [0, 3], "x": 3.25, "y": 0.0 }, + { "matrix": [0, 4], "x": 4.25, "y": 0.0 }, + { "matrix": [0, 5], "x": 5.25, "y": 0.0 }, + { "matrix": [0, 6], "x": 7.5, "y": 0.0 }, + { "matrix": [0, 7], "x": 8.5, "y": 0.0 }, + { "matrix": [0, 8], "x": 9.5, "y": 0.0 }, + { "matrix": [0, 9], "x": 10.5, "y": 0.0 }, + { "matrix": [0, 10], "x": 11.5, "y": 0.0 }, + { "matrix": [0, 11], "x": 12.5, "y": 0.0 }, + { "matrix": [3, 11], "x": 13.5, "y": 0.0 }, + { "matrix": [1, 0], "w": 1.25, "x": 0.125, "y": 1.0 }, + { "matrix": [1, 1], "x": 1.375, "y": 1.0 }, + { "matrix": [1, 2], "x": 2.375, "y": 1.0 }, + { "matrix": [1, 3], "x": 3.375, "y": 1.0 }, + { "matrix": [1, 4], "x": 4.375, "y": 1.0 }, + { "matrix": [1, 5], "x": 5.375, "y": 1.0 }, + { "matrix": [1, 6], "x": 7.875, "y": 1.0 }, + { "matrix": [1, 7], "x": 8.875, "y": 1.0 }, + { "matrix": [1, 8], "x": 9.875, "y": 1.0 }, + { "matrix": [1, 9], "x": 10.875, "y": 1.0 }, + { "matrix": [1, 10], "x": 11.875, "y": 1.0 }, + { "matrix": [1, 11], "w": 1.75, "x": 12.875, "y": 1.0 }, + { "matrix": [2, 0], "w": 1.75, "x": 0.0, "y": 2.0 }, + { "matrix": [2, 1], "x": 1.75, "y": 2.0 }, + { "matrix": [2, 2], "x": 2.75, "y": 2.0 }, + { "matrix": [2, 3], "x": 3.75, "y": 2.0 }, + { "matrix": [2, 4], "x": 4.75, "y": 2.0 }, + { "matrix": [2, 5], "x": 5.75, "y": 2.0 }, + { "matrix": [2, 6], "x": 7.5, "y": 2.0 }, + { "matrix": [2, 7], "x": 8.5, "y": 2.0 }, + { "matrix": [2, 8], "x": 9.5, "y": 2.0 }, + { "matrix": [2, 9], "x": 10.5, "y": 2.0 }, + { "matrix": [2, 10], "x": 11.5, "y": 2.0 }, + { "matrix": [2, 11], "x": 12.5, "y": 2.0 }, + { "matrix": [3, 10], "w": 1.25, "x": 13.5, "y": 2.0 }, + { "matrix": [3, 0], "w": 1.25, "x": 0.125, "y": 3.0 }, + { "matrix": [3, 1], "w": 1.25, "x": 1.375, "y": 3.0 }, + { "matrix": [3, 3], "w": 1.25, "x": 3.375, "y": 3.0 }, + { "matrix": [3, 4], "w": 2.0, "x": 4.75, "y": 3.0 }, + { "matrix": [3, 6], "w": 2.25, "x": 7.625, "y": 3.0 }, + { "matrix": [3, 7], "w": 1.25, "x": 9.875, "y": 3.0 }, + { "matrix": [3, 8], "w": 1.25, "x": 12.125, "y": 3.0 }, + { "matrix": [3, 9], "w": 1.25, "x": 13.375, "y": 3.0 } + ] + } + } +} \ No newline at end of file diff --git a/keyboards/libra_mini/keymaps/default/config.h b/keyboards/libra_mini/keymaps/default/config.h new file mode 100644 index 0000000000..cf26ca1058 --- /dev/null +++ b/keyboards/libra_mini/keymaps/default/config.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +/* Mouse control configuration */ + +/* Cursor speed */ +#define ANALOG_JOYSTICK_SPEED_MAX 5 +#define ANALOG_JOYSTICK_SPEED_REGULATOR 10 + +/* Mouse inertia (keeps sliding after a flick) */ +// #define POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE diff --git a/keyboards/libra_mini/keymaps/default/keymap.c b/keyboards/libra_mini/keymaps/default/keymap.c new file mode 100644 index 0000000000..4bb8715ab3 --- /dev/null +++ b/keyboards/libra_mini/keymaps/default/keymap.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#define KC_LSQB S(KC_LBRC) // Left square bracket +#define KC_RSQB S(KC_RBRC) // Right square bracket + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, /**/ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, /**/ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENTER, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, /**/ KC_NO, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LGUI, KC_LCTL, KC_LALT, LT(1, KC_SPC), /**/ MO(2), KC_RALT, KC_RCTL, KC_RGUI + ), + + [1] = LAYOUT( + 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_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS, KC_QUOT, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, MO(3), /**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_LBRC, KC_LSQB, KC_RSQB, KC_RBRC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, /**/ MO(3), KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, /**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + +}; diff --git a/keyboards/libra_mini/keymaps/default/rules.mk b/keyboards/libra_mini/keymaps/default/rules.mk new file mode 100644 index 0000000000..b566f809f3 --- /dev/null +++ b/keyboards/libra_mini/keymaps/default/rules.mk @@ -0,0 +1,6 @@ +LTO_ENABLE = yes + +# Enable joystick as mouse + +POINTING_DEVICE_ENABLE = yes +POINTING_DEVICE_DRIVER = analog_joystick \ No newline at end of file diff --git a/keyboards/libra_mini/keymaps/vial/config.h b/keyboards/libra_mini/keymaps/vial/config.h new file mode 100644 index 0000000000..feaf11dfef --- /dev/null +++ b/keyboards/libra_mini/keymaps/vial/config.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#define VIAL_KEYBOARD_UID {0xEA, 0xE3, 0x29, 0x4F, 0x79, 0xFF, 0x86, 0xC6} +#define VIAL_UNLOCK_COMBO_ROWS {0, 1} +#define VIAL_UNLOCK_COMBO_COLS {0, 11} + +/* Mouse control configuration */ + +/* Cursor speed */ +#define ANALOG_JOYSTICK_SPEED_MAX 5 +#define ANALOG_JOYSTICK_SPEED_REGULATOR 10 + +/* Mouse inertia (keeps sliding after a flick) */ +// #define POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE diff --git a/keyboards/libra_mini/keymaps/vial/keymap.c b/keyboards/libra_mini/keymaps/vial/keymap.c new file mode 100644 index 0000000000..4bb8715ab3 --- /dev/null +++ b/keyboards/libra_mini/keymaps/vial/keymap.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#define KC_LSQB S(KC_LBRC) // Left square bracket +#define KC_RSQB S(KC_RBRC) // Right square bracket + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, /**/ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, /**/ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENTER, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, /**/ KC_NO, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LGUI, KC_LCTL, KC_LALT, LT(1, KC_SPC), /**/ MO(2), KC_RALT, KC_RCTL, KC_RGUI + ), + + [1] = LAYOUT( + 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_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS, KC_QUOT, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, MO(3), /**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [2] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_LBRC, KC_LSQB, KC_RSQB, KC_RBRC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, /**/ MO(3), KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT( + KC_TRNS, 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,/**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, /**/ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + +}; diff --git a/keyboards/libra_mini/keymaps/vial/rules.mk b/keyboards/libra_mini/keymaps/vial/rules.mk new file mode 100644 index 0000000000..41e811c2dd --- /dev/null +++ b/keyboards/libra_mini/keymaps/vial/rules.mk @@ -0,0 +1,8 @@ +VIA_ENABLE = yes +VIAL_ENABLE = yes +LTO_ENABLE = yes + +# Enable joystick as mouse + +POINTING_DEVICE_ENABLE = yes +POINTING_DEVICE_DRIVER = analog_joystick \ No newline at end of file diff --git a/keyboards/libra_mini/keymaps/vial/vial.json b/keyboards/libra_mini/keymaps/vial/vial.json new file mode 100644 index 0000000000..fce249a11d --- /dev/null +++ b/keyboards/libra_mini/keymaps/vial/vial.json @@ -0,0 +1,209 @@ +{ + "name": "Libra Mini", + "vendorId": "0x4C4D", + "productId": "0x4C24", + "lighting": "none", + "matrix": { + "rows": 4, + "cols": 12 + }, + "layouts": { + "labels": [ + "Split Backspace", + "Joystick" + ], + "keymap": [ + [ + { + "x": 12.5 + }, + "0,11\n\n\n0,1", + "3,11\n\n\n0,1" + ], + [ + { + "y": 0.25, + "x": 0.25 + }, + "0,0", + "0,1", + { + "x": 9.25 + }, + "0,10", + { + "w": 2 + }, + "0,11\n\n\n0,0" + ], + [ + { + "x": 0.125, + "w": 1.25 + }, + "1,0", + "1,1", + { + "x": 9.5 + }, + "1,10", + { + "w": 1.75 + }, + "1,11" + ], + [ + { + "w": 1.75 + }, + "2,0", + "2,1", + { + "x": 8.75 + }, + "2,10", + "2,11", + { + "w": 1.25 + }, + "3,10" + ], + [ + { + "y": 1.25, + "x": 12.625 + }, + "3,8\n\n\n1,1", + "3,9\n\n\n1,1" + ], + [ + { + "ry": 4.5, + "y": -0.25, + "x": 0.125, + "w": 1.25 + }, + "3,0", + { + "w": 1.25 + }, + "3,1", + { + "x": 9.5, + "w": 1.25 + }, + "3,8\n\n\n1,0", + { + "w": 1.25 + }, + "3,9\n\n\n1,0" + ], + [ + { + "r": 8, + "rx": 3, + "ry": 2.25, + "y": -1, + "x": -0.75 + }, + "0,2", + "0,3", + "0,4", + "0,5" + ], + [ + { + "ry": 3.25, + "y": -1, + "x": -0.625 + }, + "1,2", + "1,3", + "1,4", + "1,5" + ], + [ + { + "ry": 4.25, + "y": -1, + "x": -0.25 + }, + "2,2", + "2,3", + "2,4", + "2,5" + ], + [ + { + "x": 1.75, + "w": 2 + }, + "3,4" + ], + [ + { + "ry": 5.25, + "y": -1, + "x": 0.375, + "w": 1.25 + }, + "3,3" + ], + [ + { + "r": -8, + "rx": 11.5, + "ry": 2.25, + "y": -1, + "x": -4 + }, + "0,6", + "0,7", + "0,8", + "0,9" + ], + [ + { + "ry": 3.25, + "y": -1, + "x": -3.625 + }, + "1,6", + "1,7", + "1,8", + "1,9" + ], + [ + { + "ry": 4.25, + "y": -1, + "x": -4 + }, + "2,6", + "2,7", + "2,8", + "2,9" + ], + [ + { + "ry": 5.25, + "y": -1, + "x": -3.875, + "w": 2.25 + }, + "3,6", + { + "w": 1.25 + }, + "3,7\n\n\n1,0" + ], + [ + { + "y": 0.25, + "x": -1.625 + }, + "3,7\n\n\n1,1" + ] + ] + } +} \ No newline at end of file diff --git a/keyboards/libra_mini/rules.mk b/keyboards/libra_mini/rules.mk new file mode 100644 index 0000000000..69e2e6cc46 --- /dev/null +++ b/keyboards/libra_mini/rules.mk @@ -0,0 +1,2 @@ +# Add analog functionality to the source tree +SRC += analog.c