Merge branch 'dev_branch' of https://github.com/jmwtsn/qmk_firmware into dev_branch

This commit is contained in:
2023-07-07 15:06:24 -03:00
7 changed files with 347 additions and 2 deletions
@@ -0,0 +1,112 @@
// Copyright 2022 Google LLC, Copyright 2022 Jay Watson jmwtsn@gmail.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// Addapted from Pascal Getreuer's Mouse Turbo Click
// For full documentation of Pascal Getreuer's original project, see
// https://getreuer.info/posts/keyboards/mouse-turbo-click
#include "bel_air/mr_smith.h"
// This library relies on that mouse keys and the deferred execution API are
// enabled, which we check for here. Enable them in you rules.mk by setting:
// MOUSEKEY_ENABLE = yes
// DEFERRED_EXEC_ENABLE = yes
#if !defined(MOUSEKEY_ENABLE)
#error "get_jiggy_with_it: Please set `MOUSEKEY_ENABLE = yes` in rules.mk."
#elif !defined(DEFERRED_EXEC_ENABLE)
#error "get_jiggy_with_it: Please set `DEFERRED_EXEC_ENABLE = yes` in rules.mk."
#else
// The click period in milliseconds. For instance a period of 200 ms would be 5
// clicks per second. Smaller period implies faster clicking.
//
// WARNING: The keyboard might become unresponsive if the period is too small.
// I suggest setting this no smaller than 50.
#define JIGGY_PERIOD_MS 120000
static deferred_token click_token = INVALID_DEFERRED_TOKEN;
static bool click_registered = false;
// Callback used with deferred execution. It alternates between tapping left
// and right mouse keys.
static uint32_t get_jiggy_callback(uint32_t trigger_time, void *cb_arg) {
if (click_registered) {
tap_code16(KC_MS_L);
click_registered = false;
} else {
click_registered = true;
tap_code16(KC_MS_R);
}
return JIGGY_PERIOD_MS / 2; // Execute callback again in half a period.
}
// Starts Turbo Click, begins the callback.
static void get_jiggy_start(void) {
if (click_token == INVALID_DEFERRED_TOKEN) {
uint32_t next_delay_ms = get_jiggy_callback(0, NULL);
click_token = defer_exec(next_delay_ms, get_jiggy_callback, NULL);
}
}
// Stops Turbo Click, cancels the callback.
static void get_jiggy_stop(void) {
if (click_token != INVALID_DEFERRED_TOKEN) {
cancel_deferred_exec(click_token);
click_token = INVALID_DEFERRED_TOKEN;
/* if (click_registered) {
// If mouse button is currently registered, release it.
unregister_code16(KC_MS_BTN1);
click_registered = false;
} */
}
}
bool process_get_jiggy_with_it(uint16_t keycode, keyrecord_t* record,
uint16_t get_jiggy_keycode) {
static bool locked = false;
static bool tapped = false;
static uint16_t tap_timer = 0;
if (keycode == get_jiggy_keycode) {
if (record->event.pressed) { // Turbo Click key was pressed.
if (tapped && !timer_expired(record->event.time, tap_timer)) {
// If the key was recently tapped, lock turbo click.
locked = true;
} else if (locked) {
// Otherwise if currently locked, unlock and stop.
locked = false;
tapped = false;
get_jiggy_stop();
return false;
}
// Set that the first tap occurred in a potential double tap.
tapped = true;
tap_timer = record->event.time + TAPPING_TERM;
get_jiggy_start();
} else if (!locked) {
// If not currently locked, stop on key release.
get_jiggy_stop();
}
return false;
} else {
// On an event with any other key, reset the double tap state.
tapped = false;
return true;
}
}
#endif
@@ -0,0 +1,53 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// Mouse jiggler - move the mouse once in a while to prevent screen time-out
// Addapted from Pascal Getreuer's Mouse Turbo Click.
//
// This library implements a "Turbo Click" button that clicks the mouse rapidly,
// implemented using mouse keys and a periodic callback function:
//
// * Pressing and holding the Turbo Click button sends rapid mouse clicks, about
// 12 clicks per second.
//
// * Quickly double tapping the Turbo Click button "locks" it. Rapid mouse
// clicks are sent until the Turbo Click button is tapped again.
//
// NOTE: Mouse keys and deferred execution must be enabled; in rules.mk set
// MOUSEKEY_ENABLE = yes, DEFERRED_EXEC_ENABLE = yes.
//
//
// For full documentation of Pascal Getreuer's original project, see
// https://getreuer.info/posts/keyboards/mouse-turbo-click
#pragma once
#include QMK_KEYBOARD_H
// In your keymap, define a custom keycode to use for Turbo Click. Then handle
// Turbo Click from your `process_record_user` function by calling
// `process_mouse_turbo_click`, passing your custom keycode for the
// `turbo_click_keycode` arg:
//
// #include "features/mouse_turbo_click.h"
//
// bool process_record_user(uint16_t keycode, keyrecord_t* record) {
// if (!process_mouse_turbo_click(keycode, record, TURBO)) { return false; }
// // Your macros ...
//
// return true;
// }
bool process_get_jiggy_with_it(uint16_t keycode, keyrecord_t* record,
uint16_t get_jiggy_keycode);
+164
View File
@@ -0,0 +1,164 @@
/* Copyright 2020 gtips
* Copyright (C) 2022 Jay Watson jmwtsn@gmail.com
*
* 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 "bel_air/mr_smith.h"
// Left-hand home row mods for Qwerty
#define HRM_A LGUI_T(KC_A)
#define HRM_S LALT_T(KC_S)
#define HRM_D LSFT_T(KC_D)
#define HRM_F LCTL_T(KC_F)
// Right-hand home row mods for Qwerty
#define HRM_J RCTL_T(KC_J)
#define HRM_K RSFT_T(KC_K)
#define HRM_L LALT_T(KC_L)
#define HRM_SCLN RGUI_T(KC_SCLN)
// Left-hand home row mods for Colemak
#define CLHRM_A LGUI_T(KC_A)
#define CLHRM_R LALT_T(KC_R)
#define CLHRM_S LSFT_T(KC_S)
#define CLHRM_T LCTL_T(KC_T)
// Right-hand home row mods for Colemak
#define CLHRM_N RCTL_T(KC_N)
#define CLHRM_E RSFT_T(KC_E)
#define CLHRM_I LALT_T(KC_I)
#define CLHRM_O RGUI_T(KC_O)
enum custom_keycodes {
EMAIL = SAFE_RANGE,
SLSAST,
ASTSLS,
JIGGY
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_get_jiggy_with_it(keycode, record, JIGGY)) { return false; }
switch (keycode) {
case EMAIL:
if (record->event.pressed) {
SEND_STRING("jmwtsn@gmail");
} else {
}
break;
case SLSAST:
if (record->event.pressed) {
SEND_STRING("/*");
} else {
}
break;
case ASTSLS:
if (record->event.pressed) {
SEND_STRING("*/");
} else {
}
break;
}
return true;
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_reviung41( //QWERTY
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_BSPC, HRM_A, HRM_S, HRM_D, HRM_F, KC_G, KC_H, HRM_J, HRM_K, HRM_L, HRM_SCLN, KC_QUOT,
RGB_TOG, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT),
KC_LALT, LT(2,KC_ENT), KC_TAB, LT(3,KC_SPC), KC_PSCR),
[1] = LAYOUT_reviung41( //Colemak
_______, _______, _______, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, _______,
_______, CLHRM_A, CLHRM_R, CLHRM_S, CLHRM_T, KC_D, KC_H, CLHRM_N, CLHRM_E, CLHRM_I, CLHRM_O, _______,
_______, _______, _______, _______, _______, _______, KC_K, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______),
[2] = LAYOUT_reviung41( //SYMB & NAV
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
KC_DEL, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_GRV, KC_TILD,
_______, _______, _______, _______, KC_CAPS, KC_DQUO, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, RSFT_T(KC_SPC),
_______, _______, KC_ENT, _______, _______),
[3] = LAYOUT_reviung41( //NUM & FUNC
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
_______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
_______, KC_ESC, _______, _______, KC_CAPS, KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
_______, _______, KC_BSPC, _______, _______),
[4] = LAYOUT_reviung41( //RGB & MOUSE
RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, JIGGY, KC_NUM, XXXXXXX, XXXXXXX, RGB_M_P, RGB_M_B,
RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, KC_WH_U, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, RGB_M_SW, RGB_M_G,
KC_ACL0, KC_ACL1, KC_ACL2, KC_BTN1, KC_BTN2, KC_WH_D, DT_PRNT, DT_DOWN, DT_UP, XXXXXXX, RGB_M_T, RGB_M_K,
TG(1), _______, EMAIL, _______, _______),
/* [#] = LAYOUT_reviung41(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______),
*/
};
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, 2, 3, 4);
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; }
#ifdef OLED_ENABLE
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR(""), false);
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_ln_P(PSTR("Whatner hell?!"), false);
break;
case 1:
oled_write_ln_P(PSTR("Don't Panic! "), false);
break;
case 3:
oled_write_ln_P(PSTR("-=[]\\ "), false);
break;
case 4:
oled_write_ln_P(PSTR("RGB & MOUSE "), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR("Undefined "), false);
}
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return false;
}
#endif
+2 -2
View File
@@ -47,7 +47,7 @@
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
// #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
// #define LOCKING_RESYNC_ENABLE*/
@@ -17,7 +17,11 @@
// For full documentation of Pascal Getreuer's original project, see
// https://getreuer.info/posts/keyboards/mouse-turbo-click
<<<<<<< HEAD
#include "bel_air/mr_smith.h"
=======
#include "bel_air/mister_smith.h"
>>>>>>> 1312beac920949dcb7ac04e70637b1a032d2bf91
// This library relies on that mouse keys and the deferred execution API are
// enabled, which we check for here. Enable them in you rules.mk by setting:
+8
View File
@@ -16,7 +16,11 @@
*/
#include QMK_KEYBOARD_H
<<<<<<< HEAD
//#include "bel_air/mr_smith.h"
=======
#include "features/mister_smith.h"
>>>>>>> 1312beac920949dcb7ac04e70637b1a032d2bf91
enum custom_keycodes {
@@ -40,7 +44,11 @@ enum custom_keycodes {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
<<<<<<< HEAD
// if (!process_get_jiggy_with_it(keycode, record, JIGGY)) { return false; }
=======
if (!process_get_jiggy_with_it(keycode, record, JIGGY)) { return false; }
>>>>>>> 1312beac920949dcb7ac04e70637b1a032d2bf91
switch (keycode) {
+4
View File
@@ -1,3 +1,7 @@
<<<<<<< HEAD
SRC += bel_air/mr_smith.c
=======
SRC += features/mister_smith.c
>>>>>>> 1312beac920949dcb7ac04e70637b1a032d2bf91
DEFERRED_EXEC_ENABLE = yes