From b8c7cf87fe36c1557f56021be70990327b209529 Mon Sep 17 00:00:00 2001 From: OTLabs Date: Sun, 12 Nov 2023 03:37:36 -0600 Subject: [PATCH] Add Vial support for Moonlander Mark I keyboard (#596) Vial port for Moonlander Mark I keyboard, https://www.zsa.io/moonlander/ --- keyboards/moonlander/keymaps/vial/config.h | 11 + keyboards/moonlander/keymaps/vial/keymap.c | 73 +++++ keyboards/moonlander/keymaps/vial/rules.mk | 3 + keyboards/moonlander/keymaps/vial/vial.json | 320 ++++++++++++++++++++ 4 files changed, 407 insertions(+) create mode 100644 keyboards/moonlander/keymaps/vial/config.h create mode 100644 keyboards/moonlander/keymaps/vial/keymap.c create mode 100644 keyboards/moonlander/keymaps/vial/rules.mk create mode 100644 keyboards/moonlander/keymaps/vial/vial.json diff --git a/keyboards/moonlander/keymaps/vial/config.h b/keyboards/moonlander/keymaps/vial/config.h new file mode 100644 index 0000000000..53c6f0398b --- /dev/null +++ b/keyboards/moonlander/keymaps/vial/config.h @@ -0,0 +1,11 @@ +// Copyright 2023 Oleg Titov +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// Unique keyboard id +#define VIAL_KEYBOARD_UID {0x20, 0xF2, 0xD5, 0xEA, 0xD8, 0x72, 0x04, 0xA6} + +// Unlock with keys "2" and "4" +#define VIAL_UNLOCK_COMBO_ROWS { 0, 0 } +#define VIAL_UNLOCK_COMBO_COLS { 2, 4 } diff --git a/keyboards/moonlander/keymaps/vial/keymap.c b/keyboards/moonlander/keymaps/vial/keymap.c new file mode 100644 index 0000000000..bf437f3ca8 --- /dev/null +++ b/keyboards/moonlander/keymaps/vial/keymap.c @@ -0,0 +1,73 @@ +/* Copyright 2020 ZSA Technology Labs, Inc <@zsa> + * Copyright 2020 Jack Humbert + * Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 QMK_KEYBOARD_H +#include "version.h" + +enum layers { + BASE, // default layer + SYMB, // symbols + MDIA, // media keys +}; + +enum custom_keycodes { + VRSN = SAFE_RANGE, +}; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT_moonlander( + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_HYPR, KC_MEH, KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), LGUI_T(KC_QUOT), + KC_LSFT, LCTL_T(KC_Z),KC_X,KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), KC_RSFT, + LT(SYMB,KC_GRV), KC_NO, A(KC_LSFT), KC_LEFT, KC_RGHT, LALT_T(KC_APP), RCTL_T(KC_ESC), KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, MO(SYMB), + KC_SPC, KC_BSPC, KC_LGUI, KC_LALT, KC_TAB, KC_ENT + ), + + [SYMB] = LAYOUT_moonlander( + VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, _______, _______, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + _______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, _______, _______, KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, _______, + _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, _______, + EE_CLR, _______, _______, _______, _______, RGB_VAI, RGB_TOG, _______, KC_DOT, KC_0, KC_EQL, _______, + RGB_HUD, RGB_VAD, RGB_HUI, TOGGLE_LAYER_COLOR,_______, _______ + ), + + [MDIA] = LAYOUT_moonlander( + LED_LEVEL,_______,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, + _______, _______, _______, KC_MS_U, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, _______, _______, + _______, _______, _______, KC_BTN1, KC_BTN2, _______, _______, KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, + _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case VRSN: + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + return false; + } + } + return true; +} diff --git a/keyboards/moonlander/keymaps/vial/rules.mk b/keyboards/moonlander/keymaps/vial/rules.mk new file mode 100644 index 0000000000..6689dd363b --- /dev/null +++ b/keyboards/moonlander/keymaps/vial/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes # Enable VIA +VIAL_ENABLE = yes # Enable VIAL +VIALRGB_ENABLE = yes # Enable VIALRGB diff --git a/keyboards/moonlander/keymaps/vial/vial.json b/keyboards/moonlander/keymaps/vial/vial.json new file mode 100644 index 0000000000..a04e2a9c4f --- /dev/null +++ b/keyboards/moonlander/keymaps/vial/vial.json @@ -0,0 +1,320 @@ +{ + "lighting": "vialrgb", + "matrix": { + "rows": 12, + "cols": 7 + }, + "layouts": { + "keymap": [ + [ + { + "x": 3.5 + }, + "0,3", + { + "x": 10.5 + }, + "6,3" + ], + [ + { + "y": -0.875, + "x": 2.5 + }, + "0,2", + { + "x": 1 + }, + "0,4", + { + "x": 8.5 + }, + "6,2", + { + "x": 1 + }, + "6,4" + ], + [ + { + "y": -0.875, + "x": 5.5 + }, + "0,5", + "0,6", + { + "x": 4.5 + }, + "6,0", + "6,1" + ], + [ + { + "y": -0.875, + "x": 0.5 + }, + "0,0", + "0,1", + { + "x": 14.5 + }, + "6,5", + "6,6" + ], + [ + { + "y": -0.375, + "x": 3.5 + }, + "1,3", + { + "x": 10.5 + }, + "7,3" + ], + [ + { + "y": -0.875, + "x": 2.5 + }, + "1,2", + { + "x": 1 + }, + "1,4", + { + "x": 8.5 + }, + "7,2", + { + "x": 1 + }, + "7,4" + ], + [ + { + "y": -0.875, + "x": 5.5 + }, + "1,5", + "1,6", + { + "x": 4.5 + }, + "7,0", + "7,1" + ], + [ + { + "y": -0.875, + "x": 0.5 + }, + "1,0", + "1,1", + { + "x": 14.5 + }, + "7,5", + "7,6" + ], + [ + { + "y": -0.375, + "x": 3.5 + }, + "2,3", + { + "x": 10.5 + }, + "8,3" + ], + [ + { + "y": -0.875, + "x": 2.5 + }, + "2,2", + { + "x": 1 + }, + "2,4", + { + "x": 8.5 + }, + "8,2", + { + "x": 1 + }, + "8,4" + ], + [ + { + "y": -0.875, + "x": 5.5 + }, + "2,5", + "2,6", + { + "x": 4.5 + }, + "8,0", + "8,1" + ], + [ + { + "y": -0.875, + "x": 0.5 + }, + "2,0", + "2,1", + { + "x": 14.5 + }, + "8,5", + "8,6" + ], + [ + { + "y": -0.375, + "x": 3.5 + }, + "3,3", + { + "x": 10.5 + }, + "9,3" + ], + [ + { + "y": -0.875, + "x": 2.5 + }, + "3,2", + { + "x": 1 + }, + "3,4", + { + "x": 8.5 + }, + "9,2", + { + "x": 1 + }, + "9,4" + ], + [ + { + "y": -0.875, + "x": 5.5 + }, + "3,5", + { + "x": 1, + "c": "#777777", + "w": 2 + }, + "5,3", + { + "x": 0.5, + "w": 2 + }, + "11,3", + { + "x": 1, + "c": "#cccccc" + }, + "9,1" + ], + [ + { + "y": -0.875, + "x": 0.5 + }, + "3,0", + "3,1", + { + "x": 14.5 + }, + "9,5", + "9,6" + ], + [ + { + "y": -0.375, + "x": 3.5, + "c": "#777777" + }, + "4,3", + { + "x": 10.5 + }, + "10,3" + ], + [ + { + "y": -0.875, + "x": 2.5, + "c": "#cccccc" + }, + "4,2", + { + "x": 1, + "c": "#777777" + }, + "4,4", + { + "x": 8.5 + }, + "10,2", + { + "x": 1, + "c": "#cccccc" + }, + "10,4" + ], + [ + { + "y": -0.875, + "x": 6.5, + "h": 2 + }, + "5,0", + { + "h": 2 + }, + "5,1", + { + "h": 2 + }, + "5,2", + { + "x": 0.5, + "h": 2 + }, + "11,4", + { + "h": 2 + }, + "11,5", + { + "h": 2 + }, + "11,6" + ], + [ + { + "y": -0.875, + "x": 0.5 + }, + "4,0", + "4,1", + { + "x": 14.5 + }, + "10,5", + "10,6" + ] + ] + } +}