mirror of
https://github.com/qmk/qmk_userspace.git
synced 2026-07-25 03:03:36 -04:00
DOIO Rev 2 Customization
This commit is contained in:
parent
b4fdcf7eb3
commit
794ab13a93
5 changed files with 76 additions and 227 deletions
|
|
@ -4,8 +4,12 @@
|
||||||
"maintainer": "HorrorTroll",
|
"maintainer": "HorrorTroll",
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0xD010",
|
"vid": "0xD010",
|
||||||
"pid": "0x1601",
|
"pid": "0x1601"
|
||||||
"force_nkro": true
|
},
|
||||||
|
"host": {
|
||||||
|
"default": {
|
||||||
|
"nkro": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"diode_direction": "COL2ROW",
|
"diode_direction": "COL2ROW",
|
||||||
"build": {
|
"build": {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,72 @@ enum layer_names {
|
||||||
_FN2
|
_FN2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
DEFAULT = SAFE_RANGE,
|
||||||
|
KC_JIGG
|
||||||
|
};
|
||||||
|
|
||||||
|
__attribute__((weak))
|
||||||
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||||
|
|
||||||
|
__attribute__((weak))
|
||||||
|
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||||
|
|
||||||
|
/*declare boolean for jiggler*/
|
||||||
|
bool is_jiggling = false;
|
||||||
|
|
||||||
|
/*timers*/
|
||||||
|
uint32_t idle_timeout = 30000; // (after 30s)
|
||||||
|
uint32_t mouse_interval = 10000; // (every 10s)
|
||||||
|
|
||||||
|
static uint32_t idle_callback(uint32_t trigger_time, void* cb_arg) {
|
||||||
|
// now idle
|
||||||
|
if(is_jiggling) {
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
dprintf("sending: %s\n", "X_F15");
|
||||||
|
#endif
|
||||||
|
SEND_STRING(SS_TAP(X_F15));
|
||||||
|
}
|
||||||
|
return mouse_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
|
// on every key event start or extend `idle_callback()` deferred execution after IDLE_TIMEOUT_MS
|
||||||
|
static deferred_token idle_token = INVALID_DEFERRED_TOKEN;
|
||||||
|
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
dprintf("deferred_exec: %s\n", !extend_deferred_exec(idle_token, idle_timeout) ? "true" : "false");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!extend_deferred_exec(idle_token, idle_timeout)) {
|
||||||
|
idle_token = defer_exec(idle_timeout, idle_callback, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
// uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %u, time: %5u, int: %u, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (keycode) {
|
||||||
|
case KC_JIGG:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
is_jiggling = !is_jiggling; /*flip boolean to true*/
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
dprintf("is_jiggling: %s\n", is_jiggling ? "true" : "false");
|
||||||
|
#endif
|
||||||
|
if(is_jiggling) {
|
||||||
|
layer_on(_FN);
|
||||||
|
} else {
|
||||||
|
layer_off(_FN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// return true;
|
||||||
|
return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
|
||||||
|
}
|
||||||
|
|
||||||
// enum layer_keycodes { };
|
// enum layer_keycodes { };
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
@ -77,7 +143,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
*/
|
*/
|
||||||
/* Row: 0 1 2 3 4 */
|
/* Row: 0 1 2 3 4 */
|
||||||
[_FN] = LAYOUT(
|
[_FN] = LAYOUT(
|
||||||
_______, _______, _______, _______, _______,
|
_______, _______, _______, KC_JIGG, _______,
|
||||||
_______, _______, _______, _______, TO(_FN1),
|
_______, _______, _______, _______, TO(_FN1),
|
||||||
_______, _______, _______, _______, _______,
|
_______, _______, _______, _______, _______,
|
||||||
_______, _______, _______, _______
|
_______, _______, _______, _______
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,5 @@
|
||||||
# Encoder enabled
|
# Encoder enabled
|
||||||
ENCODER_MAP_ENABLE = yes
|
ENCODER_MAP_ENABLE = yes
|
||||||
|
CONSOLE_ENABLE = yes
|
||||||
|
DEFERRED_EXEC_ENABLE = yes
|
||||||
|
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
||||||
|
|
|
||||||
|
|
@ -1,218 +0,0 @@
|
||||||
/* Copyright 2022 DOIO
|
|
||||||
* Copyright 2022 HorrorTroll <https://github.com/HorrorTroll>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
#include "print.h"
|
|
||||||
|
|
||||||
// OLED animation
|
|
||||||
#include "lib/layer_status/layer_status.h"
|
|
||||||
|
|
||||||
void keyboard_post_init_user(void) {
|
|
||||||
debug_enable=true;
|
|
||||||
debug_matrix=true;
|
|
||||||
debug_keyboard=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _BASE 0
|
|
||||||
#define _FN 1
|
|
||||||
#define _FN1 2
|
|
||||||
#define _FN2 3
|
|
||||||
|
|
||||||
enum custom_keycodes {
|
|
||||||
DEFAULT = SAFE_RANGE,
|
|
||||||
KC_JIGG
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak))
|
|
||||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
|
|
||||||
|
|
||||||
__attribute__((weak))
|
|
||||||
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
|
|
||||||
|
|
||||||
/*declare boolean for jiggler*/
|
|
||||||
bool is_jiggling = false;
|
|
||||||
|
|
||||||
/*timers*/
|
|
||||||
uint32_t idle_timeout = 30000; // (after 30s)
|
|
||||||
uint32_t mouse_interval = 10000; // (every 10s)
|
|
||||||
|
|
||||||
static uint32_t idle_callback(uint32_t trigger_time, void* cb_arg) {
|
|
||||||
// now idle
|
|
||||||
if(is_jiggling) {
|
|
||||||
#ifdef CONSOLE_ENABLE
|
|
||||||
dprintf("sending: %s\n", "X_F15");
|
|
||||||
#endif
|
|
||||||
SEND_STRING(SS_TAP(X_F15));
|
|
||||||
}
|
|
||||||
return mouse_interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
|
|
||||||
// on every key event start or extend `idle_callback()` deferred execution after IDLE_TIMEOUT_MS
|
|
||||||
static deferred_token idle_token = INVALID_DEFERRED_TOKEN;
|
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
|
||||||
dprintf("deferred_exec: %s\n", !extend_deferred_exec(idle_token, idle_timeout) ? "true" : "false");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!extend_deferred_exec(idle_token, idle_timeout)) {
|
|
||||||
idle_token = defer_exec(idle_timeout, idle_callback, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONSOLE_ENABLE
|
|
||||||
// uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %u, time: %5u, int: %u, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (keycode) {
|
|
||||||
case KC_JIGG:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
is_jiggling = !is_jiggling; /*flip boolean to true*/
|
|
||||||
#ifdef CONSOLE_ENABLE
|
|
||||||
dprintf("is_jiggling: %s\n", is_jiggling ? "true" : "false");
|
|
||||||
#endif
|
|
||||||
if(is_jiggling) {
|
|
||||||
layer_on(_FN);
|
|
||||||
} else {
|
|
||||||
layer_off(_FN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// return true;
|
|
||||||
return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
// enum layer_names {
|
|
||||||
// _BASE,
|
|
||||||
// _FN,
|
|
||||||
// _FN1,
|
|
||||||
// _FN2
|
|
||||||
// };
|
|
||||||
|
|
||||||
// enum layer_keycodes { };
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
|
|
||||||
/*
|
|
||||||
┌───┬───┬───┬───┐ ┌───┐ ┌───┐
|
|
||||||
│ 1 │ 2 │ 3 │ 4 │ │Ply│ │TO1│
|
|
||||||
├───┼───┼───┼───┤ └───┘ └───┘
|
|
||||||
│ 5 │ 6 │ 7 │ 8 │
|
|
||||||
├───┼───┼───┼───┤
|
|
||||||
│ 9 │ 0 │ ↑ │Ent│ ┌───┐
|
|
||||||
├───┼───┼───┼───┤ │Mut│
|
|
||||||
│Fn2│ ← │ ↓ │ → │ └───┘
|
|
||||||
└───┴───┴───┴───┘
|
|
||||||
┌───┬───┬───┬───┐ ┌───┐ ┌───┐
|
|
||||||
│ ! │ @ │ # │ $ │ │ │ │ │
|
|
||||||
├───┼───┼───┼───┤ └───┘ └───┘
|
|
||||||
│ % │ ^ │ & │ * │
|
|
||||||
├───┼───┼───┼───┤
|
|
||||||
│ ( │ ) │ │ │ ┌───┐
|
|
||||||
├───┼───┼───┼───┤ │ │
|
|
||||||
│ │ │ │ │ └───┘
|
|
||||||
└───┴───┴───┴───┘
|
|
||||||
*/
|
|
||||||
/* Row: 0 1 2 3 4 */
|
|
||||||
[_BASE] = LAYOUT(
|
|
||||||
KC_1, KC_2, KC_3, KC_4, KC_MPLY,
|
|
||||||
KC_5, KC_6, KC_7, KC_8, TO(_FN),
|
|
||||||
KC_9, KC_0, KC_UP, KC_ENT, KC_MUTE,
|
|
||||||
MO(_FN2), KC_LEFT, KC_DOWN, KC_RIGHT
|
|
||||||
),
|
|
||||||
|
|
||||||
/*
|
|
||||||
┌───┬───┬───┬───┐ ┌───┐ ┌───┐
|
|
||||||
│ │ │ │ │ │ │ │ │
|
|
||||||
├───┼───┼───┼───┤ └───┘ └───┘
|
|
||||||
│ │ │ │ │
|
|
||||||
├───┼───┼───┼───┤
|
|
||||||
│ │ │ │ │ ┌───┐
|
|
||||||
├───┼───┼───┼───┤ │ │
|
|
||||||
│ │ │ │ │ └───┘
|
|
||||||
└───┴───┴───┴───┘
|
|
||||||
*/
|
|
||||||
/* Row: 0 1 2 3 4 */
|
|
||||||
[_FN] = LAYOUT(
|
|
||||||
_______, _______, _______, KC_JIGG, _______,
|
|
||||||
_______, _______, _______, _______, TO(_FN1),
|
|
||||||
_______, _______, _______, _______, _______,
|
|
||||||
_______, _______, _______, _______
|
|
||||||
),
|
|
||||||
|
|
||||||
/*
|
|
||||||
┌───┬───┬───┬───┐ ┌───┐ ┌───┐
|
|
||||||
│ │ │ │ │ │ │ │ │
|
|
||||||
├───┼───┼───┼───┤ └───┘ └───┘
|
|
||||||
│ │ │ │ │
|
|
||||||
├───┼───┼───┼───┤
|
|
||||||
│ │ │ │ │ ┌───┐
|
|
||||||
├───┼───┼───┼───┤ │ │
|
|
||||||
│ │ │ │ │ └───┘
|
|
||||||
└───┴───┴───┴───┘
|
|
||||||
*/
|
|
||||||
/* Row: 0 1 2 3 4 */
|
|
||||||
[_FN1] = LAYOUT(
|
|
||||||
_______, _______, _______, _______, _______,
|
|
||||||
_______, _______, _______, _______, TO(_FN2),
|
|
||||||
_______, _______, _______, _______, _______,
|
|
||||||
_______, _______, _______, _______
|
|
||||||
),
|
|
||||||
|
|
||||||
/*
|
|
||||||
┌───┬───┬───┬───┐ ┌───┐ ┌───┐
|
|
||||||
│Spi│Spd│ │ │ │ │ │TO0│
|
|
||||||
├───┼───┼───┼───┤ └───┘ └───┘
|
|
||||||
│Sai│Sad│ │ │
|
|
||||||
├───┼───┼───┼───┤
|
|
||||||
│Tog│Mod│Hui│ │ ┌───┐
|
|
||||||
├───┼───┼───┼───┤ │ │
|
|
||||||
│ │Vai│Hud│Vad│ └───┘
|
|
||||||
└───┴───┴───┴───┘
|
|
||||||
*/
|
|
||||||
/* Row: 0 1 2 3 4 */
|
|
||||||
[_FN2] = LAYOUT(
|
|
||||||
RM_SPDU, RM_SPDD, _______, QK_BOOT, _______,
|
|
||||||
RM_SATU, RM_SATD, _______, _______, TO(_BASE),
|
|
||||||
RM_TOGG, RM_NEXT, RM_HUEU, _______, _______,
|
|
||||||
_______, RM_VALU, RM_HUED, RM_VALD
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
|
||||||
bool oled_task_user(void) {
|
|
||||||
render_layer_status();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENCODER_MAP_ENABLE
|
|
||||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
|
||||||
[_BASE] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
|
||||||
[_FN] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
|
|
||||||
[_FN1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
|
|
||||||
[_FN2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# Encoder enabled
|
|
||||||
ENCODER_MAP_ENABLE = yes
|
|
||||||
CONSOLE_ENABLE = yes
|
|
||||||
COMMAND_ENABLE = no
|
|
||||||
DEFERRED_EXEC_ENABLE = yes
|
|
||||||
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
|
||||||
Loading…
Reference in a new issue