Skip to content

Commit

Permalink
Add vial to keyboard omkbd runner3680 5x6_5x8 (vial-kb#795)
Browse files Browse the repository at this point in the history
* my runner

* Add converter to rules.mk

* RGBLIGHT_TIMEOUT adjust to 10 minutes

* re-org rules
  • Loading branch information
zachliu authored Oct 6, 2024
1 parent bd93d9c commit 27f0980
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 deletions.
36 changes: 36 additions & 0 deletions keyboards/omkbd/runner3680/5x6_5x8/keymaps/vial/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Copyright 2021 omkbd
*
* 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/>.
*/

#pragma once

#define VIAL_KEYBOARD_UID {0x0F, 0x8A, 0x08, 0x8B, 0x22, 0x25, 0xAA, 0xA8}

#define DYNAMIC_KEYMAP_LAYER_COUNT 4

// ~ + BACKSPACE = UNLOCK
#define VIAL_UNLOCK_COMBO_ROWS { 0, 5 }
#define VIAL_UNLOCK_COMBO_COLS { 2, 0 }

//#define USE_MATRIX_I2C

/* Select hand configuration */

#define MASTER_LEFT
// #define MASTER_RIGHT
// #define EE_HANDS

#define RGBLIGHT_SLEEP // enable rgblight_suspend() and rgblight_wakeup() in keymap.c
#define RGBLIGHT_TIMEOUT 600000 // ms to wait until rgblight time out, 600K ms is 10min.
112 changes: 112 additions & 0 deletions keyboards/omkbd/runner3680/5x6_5x8/keymaps/vial/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/* Copyright 2021 omkbd
*
* 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 QMK_KEYBOARD_H

enum layer_number {
_QWERTY = 0,
_ADJUST
};

// Fillers to make layering more clear
#define EISU LALT(KC_GRV)
#define ADJUST MO(_ADJUST)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* QWERTY
* ,-----------------------------------------. ,--------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - | = | Bksp |
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | [ | ] | \ |
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | Ctrl | A | S | D | F | G | | H | J | K | L | ; | " | Enter| Enter|
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | | N | M | , | . | / | Shift| Up | Shift|
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | EISU | Space| Space| | Space| Space| Alt |Adjust| Ctrl | Left | Down | Right|
* `-----------------------------------------' `-------------------------------------------------------'
*/
[_QWERTY] = 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_BSPC,
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_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_ENT,
KC_LSFT, 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_RSFT,
KC_LCTL, KC_LGUI, KC_LALT, ADJUST, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_RALT, ADJUST, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),

/* Adjust
* ,-----------------------------------------. ,--------------------------------------------------------.
* | ESC | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | F12 | |
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | | TOG | HUI | SAI | VAI | | | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | | MOD | HUD | SAD | VAD | | | | | | | | | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------+------+------|
* | | | | | | | | | | | | | | | |
* `-----------------------------------------' `-------------------------------------------------------'
*/
[_ADJUST] = 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, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};

static uint32_t key_timer; // timer for last keyboard activity, use 32bit value and function to make longer idle time possible
static void refresh_rgb(void); // refreshes the activity timer and RGB, invoke whenever any activity happens
static void check_rgb_timeout(void); // checks if enough time has passed for RGB to timeout
bool is_rgb_timeout = false; // store if RGB has timed out or not in a boolean

void refresh_rgb(void) {
key_timer = timer_read32(); // store time of last refresh
if (is_rgb_timeout)
{
is_rgb_timeout = false;
rgblight_wakeup();
}
}
void check_rgb_timeout(void) {
if (!is_rgb_timeout && timer_elapsed32(key_timer) > RGBLIGHT_TIMEOUT) // check if RGB has already timeout and if enough time has passed
{
rgblight_suspend();
is_rgb_timeout = true;
}
}
/* Then, call the above functions from QMK's built in post processing functions like so */
/* Runs at the end of each scan loop, check if RGB timeout has occured or not */
void housekeeping_task_user(void) {
#ifdef RGBLIGHT_TIMEOUT
check_rgb_timeout();
#endif
}
/* Runs after each key press, check if activity occurred */
void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGBLIGHT_TIMEOUT
if (record->event.pressed)
refresh_rgb();
#endif
}
/* Runs after each encoder tick, check if activity occurred */
void post_encoder_update_user(uint8_t index, bool clockwise) {
#ifdef RGBLIGHT_TIMEOUT
refresh_rgb();
#endif
}
13 changes: 13 additions & 0 deletions keyboards/omkbd/runner3680/5x6_5x8/keymaps/vial/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes

RGBLIGHT_ENABLE = yes

CONSOLE_ENABLE = yes
QMK_SETTINGS = yes

TAP_DANCE_ENABLE = yes
COMBO_ENABLE = yes
KEY_OVERRIDE_ENABLE = yes

CONVERT_TO = promicro_rp2040
20 changes: 20 additions & 0 deletions keyboards/omkbd/runner3680/5x6_5x8/keymaps/vial/vial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "runner3680 5x6+5x8",
"vendorId": "0x3680",
"productId": "0x5658",
"firmwareVersion": "0.0.5",
"lighting": "qmk_rgblight",
"matrix": {
"rows": 10,
"cols": 8
},
"layouts": {
"keymap": [
[{"c":"#777777"},"0,2",{"c":"#cccccc"},"0,3","0,4","0,5","0,6","0,7",{"x":0.75},"5,7","5,6","5,5","5,4","5,3",{"c":"#aaaaaa"},"5,2","5,1","5,0"],
["1,2","1,3",{"c":"#cccccc"},"1,4","1,5","1,6","1,7",{"x":0.75},"6,7","6,6","6,5","6,4","6,3",{"c":"#aaaaaa"},"6,2","6,1","6,0"],
["2,2","2,3",{"c":"#cccccc"},"2,4","2,5","2,6","2,7",{"x":0.75},"7,7","7,6","7,5","7,4",{"c":"#aaaaaa"},"7,3","7,2",{"c":"#777777"},"7,1","7,0"],
[{"c":"#aaaaaa"},"3,2","3,3",{"c":"#cccccc"},"3,4","3,5","3,6","3,7",{"x":0.75},"8,7","8,6",{"c":"#aaaaaa"},"8,5","8,4","8,3","8,2","8,1","8,0"],
["4,2","4,3","4,4","4,5","4,6","4,7",{"x":0.75},"9,7","9,6","9,5","9,4","9,3","9,2","9,1","9,0"]
]
}
}

0 comments on commit 27f0980

Please sign in to comment.