mirror of
https://github.com/qmk/qmk_userspace.git
synced 2026-03-07 00:01:09 -05:00
Added old files
This commit is contained in:
parent
caa715695d
commit
a608b1de29
51 changed files with 23889 additions and 0 deletions
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"makefile.configureOnOpen": true
|
||||
}
|
||||
3
users/freznel/.gitignore
vendored
Normal file
3
users/freznel/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
secrets.c
|
||||
secrets.h
|
||||
drashna_song_list.h
|
||||
6201
users/freznel/autocorrect_data.h
Normal file
6201
users/freznel/autocorrect_data.h
Normal file
File diff suppressed because it is too large
Load diff
3076
users/freznel/autocorrect_dictionary.txt
Normal file
3076
users/freznel/autocorrect_dictionary.txt
Normal file
File diff suppressed because it is too large
Load diff
3077
users/freznel/autocorrect_dictionary_1.h
Normal file
3077
users/freznel/autocorrect_dictionary_1.h
Normal file
File diff suppressed because it is too large
Load diff
3077
users/freznel/autocorrect_dictionary_1.txt
Normal file
3077
users/freznel/autocorrect_dictionary_1.txt
Normal file
File diff suppressed because it is too large
Load diff
540
users/freznel/backup/pointing_device.c
Normal file
540
users/freznel/backup/pointing_device.c
Normal file
|
|
@ -0,0 +1,540 @@
|
|||
/* Copyright 2017 Joshua Broekhuijsen <snipeye+qmk@gmail.com>
|
||||
* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
* Copyright 2021 Dasky (@daskygit)
|
||||
*
|
||||
* 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 "pointing_device.h"
|
||||
#include <string.h>
|
||||
#include "timer.h"
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
# include "mousekey.h"
|
||||
#endif
|
||||
|
||||
#if (defined(POINTING_DEVICE_ROTATION_90) + defined(POINTING_DEVICE_ROTATION_180) + defined(POINTING_DEVICE_ROTATION_270)) > 1
|
||||
# error More than one rotation selected. This is not supported.
|
||||
#endif
|
||||
|
||||
#if defined(POINTING_DEVICE_LEFT) || defined(POINTING_DEVICE_RIGHT) || defined(POINTING_DEVICE_COMBINED)
|
||||
# ifndef SPLIT_POINTING_ENABLE
|
||||
# error "Using POINTING_DEVICE_LEFT or POINTING_DEVICE_RIGHT or POINTING_DEVICE_COMBINED, then SPLIT_POINTING_ENABLE is required but has not been defined"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
# include "transactions.h"
|
||||
# include "keyboard.h"
|
||||
|
||||
report_mouse_t shared_mouse_report = {};
|
||||
uint16_t shared_cpi = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the shared mouse report used be pointing device task
|
||||
*
|
||||
* NOTE : Only available when using SPLIT_POINTING_ENABLE
|
||||
*
|
||||
* @param[in] new_mouse_report report_mouse_t
|
||||
*/
|
||||
void pointing_device_set_shared_report(report_mouse_t new_mouse_report) {
|
||||
shared_mouse_report = new_mouse_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets current pointing device CPI if supported
|
||||
*
|
||||
* Gets current cpi of the shared report and returns it as uint16_t
|
||||
*
|
||||
* NOTE : Only available when using SPLIT_POINTING_ENABLE
|
||||
*
|
||||
* @return cpi value as uint16_t
|
||||
*/
|
||||
uint16_t pointing_device_get_shared_cpi(void) {
|
||||
return shared_cpi;
|
||||
}
|
||||
|
||||
# if defined(POINTING_DEVICE_LEFT)
|
||||
# define POINTING_DEVICE_THIS_SIDE is_keyboard_left()
|
||||
# elif defined(POINTING_DEVICE_RIGHT)
|
||||
# define POINTING_DEVICE_THIS_SIDE !is_keyboard_left()
|
||||
# elif defined(POINTING_DEVICE_COMBINED)
|
||||
# define POINTING_DEVICE_THIS_SIDE true
|
||||
# endif
|
||||
|
||||
#endif // defined(SPLIT_POINTING_ENABLE)
|
||||
|
||||
static report_mouse_t local_mouse_report = {};
|
||||
static bool pointing_device_force_send = false;
|
||||
|
||||
extern const pointing_device_driver_t pointing_device_driver;
|
||||
|
||||
/**
|
||||
* @brief Keyboard level code pointing device initialisation
|
||||
*
|
||||
*/
|
||||
__attribute__((weak)) void pointing_device_init_kb(void) {}
|
||||
|
||||
/**
|
||||
* @brief User level code pointing device initialisation
|
||||
*
|
||||
*/
|
||||
__attribute__((weak)) void pointing_device_init_user(void) {}
|
||||
|
||||
/**
|
||||
* @brief Weak function allowing for keyboard level mouse report modification
|
||||
*
|
||||
* Takes report_mouse_t struct allowing modification at keyboard level then returns report_mouse_t.
|
||||
*
|
||||
* @param[in] mouse_report report_mouse_t
|
||||
* @return report_mouse_t
|
||||
*/
|
||||
__attribute__((weak)) report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
|
||||
return pointing_device_task_user(mouse_report);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Weak function allowing for user level mouse report modification
|
||||
*
|
||||
* Takes report_mouse_t struct allowing modification at user level then returns report_mouse_t.
|
||||
*
|
||||
* @param[in] mouse_report report_mouse_t
|
||||
* @return report_mouse_t
|
||||
*/
|
||||
__attribute__((weak)) report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles pointing device buttons
|
||||
*
|
||||
* Returns modified button bitmask using bool pressed and selected pointing_device_buttons_t button in uint8_t buttons bitmask.
|
||||
*
|
||||
* @param buttons[in] uint8_t bitmask
|
||||
* @param pressed[in] bool
|
||||
* @param button[in] pointing_device_buttons_t value
|
||||
* @return Modified uint8_t bitmask buttons
|
||||
*/
|
||||
__attribute__((weak)) uint8_t pointing_device_handle_buttons(uint8_t buttons, bool pressed, pointing_device_buttons_t button) {
|
||||
if (pressed) {
|
||||
buttons |= 1 << (button);
|
||||
} else {
|
||||
buttons &= ~(1 << (button));
|
||||
}
|
||||
return buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialises pointing device
|
||||
*
|
||||
* Initialises pointing device, perform driver init and optional keyboard/user level code.
|
||||
*/
|
||||
__attribute__((weak)) void pointing_device_init(void) {
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
if ((POINTING_DEVICE_THIS_SIDE))
|
||||
#endif
|
||||
{
|
||||
pointing_device_driver.init();
|
||||
#ifdef POINTING_DEVICE_MOTION_PIN
|
||||
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
setPinInputHigh(POINTING_DEVICE_MOTION_PIN);
|
||||
# else
|
||||
setPinInput(POINTING_DEVICE_MOTION_PIN);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
pointing_device_init_kb();
|
||||
pointing_device_init_user();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sends processed mouse report to host
|
||||
*
|
||||
* This sends the mouse report generated by pointing_device_task if changed since the last report. Once send zeros mouse report except buttons.
|
||||
*
|
||||
*/
|
||||
__attribute__((weak)) bool pointing_device_send(void) {
|
||||
static report_mouse_t old_report = {};
|
||||
bool should_send_report = has_mouse_report_changed(&local_mouse_report, &old_report);
|
||||
|
||||
if (should_send_report) {
|
||||
host_mouse_send(&local_mouse_report);
|
||||
}
|
||||
// send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
|
||||
uint8_t buttons = local_mouse_report.buttons;
|
||||
memset(&local_mouse_report, 0, sizeof(local_mouse_report));
|
||||
local_mouse_report.buttons = buttons;
|
||||
|
||||
memcpy(&old_report, &local_mouse_report, sizeof(local_mouse_report));
|
||||
|
||||
return should_send_report || buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adjust mouse report by any optional common pointing configuration defines
|
||||
*
|
||||
* This applies rotation or inversion to the mouse report as selected by the pointing device common configuration defines.
|
||||
*
|
||||
* @param mouse_report[in] takes a report_mouse_t to be adjusted
|
||||
* @return report_mouse_t with adjusted values
|
||||
*/
|
||||
report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report) {
|
||||
// Support rotation of the sensor data
|
||||
#if defined(POINTING_DEVICE_ROTATION_90) || defined(POINTING_DEVICE_ROTATION_180) || defined(POINTING_DEVICE_ROTATION_270)
|
||||
mouse_xy_report_t x = mouse_report.x;
|
||||
mouse_xy_report_t y = mouse_report.y;
|
||||
# if defined(POINTING_DEVICE_ROTATION_90)
|
||||
mouse_report.x = y;
|
||||
mouse_report.y = -x;
|
||||
# elif defined(POINTING_DEVICE_ROTATION_180)
|
||||
mouse_report.x = -x;
|
||||
mouse_report.y = -y;
|
||||
# elif defined(POINTING_DEVICE_ROTATION_270)
|
||||
mouse_report.x = -y;
|
||||
mouse_report.y = x;
|
||||
# else
|
||||
# error "How the heck did you get here?!"
|
||||
# endif
|
||||
#endif
|
||||
// Support Inverting the X and Y Axises
|
||||
#if defined(POINTING_DEVICE_INVERT_X)
|
||||
mouse_report.x = -mouse_report.x;
|
||||
#endif
|
||||
#if defined(POINTING_DEVICE_INVERT_Y)
|
||||
mouse_report.y = -mouse_report.y;
|
||||
#endif
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieves and processes pointing device data.
|
||||
*
|
||||
* This function is part of the keyboard loop and retrieves the mouse report from the pointing device driver.
|
||||
* It applies any optional configuration e.g. rotation or axis inversion and then initiates a send.
|
||||
*
|
||||
*/
|
||||
__attribute__((weak)) bool pointing_device_task(void) {
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
// Don't poll the target side pointing device.
|
||||
if (!is_keyboard_master()) {
|
||||
return false;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (POINTING_DEVICE_TASK_THROTTLE_MS > 0)
|
||||
static uint32_t last_exec = 0;
|
||||
if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) {
|
||||
return false;
|
||||
}
|
||||
last_exec = timer_read32();
|
||||
#endif
|
||||
|
||||
// Gather report info
|
||||
#ifdef POINTING_DEVICE_MOTION_PIN
|
||||
# if defined(SPLIT_POINTING_ENABLE)
|
||||
# error POINTING_DEVICE_MOTION_PIN not supported when sharing the pointing device report between sides.
|
||||
# endif
|
||||
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
if (!readPin(POINTING_DEVICE_MOTION_PIN))
|
||||
# else
|
||||
if (readPin(POINTING_DEVICE_MOTION_PIN))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
# if defined(POINTING_DEVICE_COMBINED)
|
||||
static uint8_t old_buttons = 0;
|
||||
local_mouse_report.buttons = old_buttons;
|
||||
local_mouse_report = pointing_device_driver.get_report(local_mouse_report);
|
||||
old_buttons = local_mouse_report.buttons;
|
||||
# elif defined(POINTING_DEVICE_LEFT) || defined(POINTING_DEVICE_RIGHT)
|
||||
local_mouse_report = POINTING_DEVICE_THIS_SIDE ? pointing_device_driver.get_report(local_mouse_report) : shared_mouse_report;
|
||||
# else
|
||||
# error "You need to define the side(s) the pointing device is on. POINTING_DEVICE_COMBINED / POINTING_DEVICE_LEFT / POINTING_DEVICE_RIGHT"
|
||||
# endif
|
||||
#else
|
||||
local_mouse_report = pointing_device_driver.get_report(local_mouse_report);
|
||||
#endif // defined(SPLIT_POINTING_ENABLE)
|
||||
|
||||
// allow kb to intercept and modify report
|
||||
#if defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
if (is_keyboard_left()) {
|
||||
local_mouse_report = pointing_device_adjust_by_defines(local_mouse_report);
|
||||
shared_mouse_report = pointing_device_adjust_by_defines_right(shared_mouse_report);
|
||||
} else {
|
||||
local_mouse_report = pointing_device_adjust_by_defines_right(local_mouse_report);
|
||||
shared_mouse_report = pointing_device_adjust_by_defines(shared_mouse_report);
|
||||
}
|
||||
local_mouse_report = is_keyboard_left() ? pointing_device_task_combined(local_mouse_report, shared_mouse_report) : pointing_device_task_combined(shared_mouse_report, local_mouse_report);
|
||||
#else
|
||||
local_mouse_report = pointing_device_adjust_by_defines(local_mouse_report);
|
||||
local_mouse_report = pointing_device_task_kb(local_mouse_report);
|
||||
#endif
|
||||
// automatic mouse layer function
|
||||
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
pointing_device_task_auto_mouse(local_mouse_report);
|
||||
#endif
|
||||
// pointing device modes handling for single pointing device
|
||||
#if defined(POINTING_DEVICE_MODES_ENABLE) && !(defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED))
|
||||
local_mouse_report = pointing_device_modes_task(local_mouse_report);
|
||||
#endif
|
||||
// combine with mouse report to ensure that the combined is sent correctly
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
report_mouse_t mousekey_report = mousekey_get_report();
|
||||
local_mouse_report.buttons = local_mouse_report.buttons | mousekey_report.buttons;
|
||||
#endif
|
||||
|
||||
const bool send_report = pointing_device_send() || pointing_device_force_send;
|
||||
pointing_device_force_send = false;
|
||||
|
||||
return send_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets current mouse report used by pointing device task
|
||||
*
|
||||
* @return report_mouse_t
|
||||
*/
|
||||
report_mouse_t pointing_device_get_report(void) {
|
||||
return local_mouse_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets mouse report used be pointing device task
|
||||
*
|
||||
* @param[in] mouse_report
|
||||
*/
|
||||
void pointing_device_set_report(report_mouse_t mouse_report) {
|
||||
pointing_device_force_send = has_mouse_report_changed(&local_mouse_report, &mouse_report);
|
||||
memcpy(&local_mouse_report, &mouse_report, sizeof(local_mouse_report));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets current pointing device CPI if supported
|
||||
*
|
||||
* Gets current cpi from pointing device driver if supported and returns it as uint16_t
|
||||
*
|
||||
* @return cpi value as uint16_t
|
||||
*/
|
||||
uint16_t pointing_device_get_cpi(void) {
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
return POINTING_DEVICE_THIS_SIDE ? pointing_device_driver.get_cpi() : shared_cpi;
|
||||
#else
|
||||
return pointing_device_driver.get_cpi();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set pointing device CPI if supported
|
||||
*
|
||||
* Takes a uint16_t value to set pointing device cpi if supported by driver.
|
||||
*
|
||||
* @param[in] cpi uint16_t value.
|
||||
*/
|
||||
void pointing_device_set_cpi(uint16_t cpi) {
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
if (POINTING_DEVICE_THIS_SIDE) {
|
||||
pointing_device_driver.set_cpi(cpi);
|
||||
} else {
|
||||
shared_cpi = cpi;
|
||||
}
|
||||
#else
|
||||
pointing_device_driver.set_cpi(cpi);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
/**
|
||||
* @brief Set pointing device CPI if supported
|
||||
*
|
||||
* Takes a bool and uint16_t and allows setting cpi for a single side when using 2 pointing devices with a split keyboard.
|
||||
*
|
||||
* NOTE: Only available when using SPLIT_POINTING_ENABLE and POINTING_DEVICE_COMBINED
|
||||
*
|
||||
* @param[in] left true = left, false = right.
|
||||
* @param[in] cpi uint16_t value.
|
||||
*/
|
||||
void pointing_device_set_cpi_on_side(bool left, uint16_t cpi) {
|
||||
bool local = (is_keyboard_left() & left) ? true : false;
|
||||
if (local) {
|
||||
pointing_device_driver.set_cpi(cpi);
|
||||
} else {
|
||||
shared_cpi = cpi;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief clamps input to mouse_hv_report_t range
|
||||
*
|
||||
* @param[in] clamp_hv_range_t value
|
||||
* @return mouse_hv_report_t clamped value
|
||||
*/
|
||||
static inline mouse_hv_report_t pointing_device_hv_clamp(clamp_hv_range_t value) {
|
||||
if (value < HV_REPORT_MIN) {
|
||||
return HV_REPORT_MIN;
|
||||
} else if (value > HV_REPORT_MAX) {
|
||||
return HV_REPORT_MAX;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief clamps clamp_range_t to mouse_xy_report_t
|
||||
*
|
||||
* @param[in] clamp_xy_range_t value
|
||||
* @return mouse_xy_report_t clamped value
|
||||
*/
|
||||
static inline mouse_xy_report_t pointing_device_xy_clamp(clamp_xy_range_t value) {
|
||||
if (value < XY_REPORT_MIN) {
|
||||
return XY_REPORT_MIN;
|
||||
} else if (value > XY_REPORT_MAX) {
|
||||
return XY_REPORT_MAX;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @brief combines 2 mouse reports and returns 2
|
||||
*
|
||||
* Combines 2 report_mouse_t structs, clamping movement values to int8_t and ignores report_id then returns the resulting report_mouse_t struct.
|
||||
*
|
||||
* NOTE: Only available when using SPLIT_POINTING_ENABLE and POINTING_DEVICE_COMBINED
|
||||
*
|
||||
* @param[in] left_report left report_mouse_t
|
||||
* @param[in] right_report right report_mouse_t
|
||||
* @return combined report_mouse_t of left_report and right_report
|
||||
*/
|
||||
report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, report_mouse_t right_report) {
|
||||
left_report.x = pointing_device_xy_clamp((clamp_xy_range_t)left_report.x + right_report.x);
|
||||
left_report.y = pointing_device_xy_clamp((clamp_xy_range_t)left_report.y + right_report.y);
|
||||
left_report.h = pointing_device_hv_clamp((clamp_hv_range_t)left_report.h + right_report.h);
|
||||
left_report.v = pointing_device_hv_clamp((clamp_hv_range_t)left_report.v + right_report.v);
|
||||
left_report.buttons |= right_report.buttons;
|
||||
return left_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adjust mouse report by any optional right pointing configuration defines
|
||||
*
|
||||
* This applies rotation or inversion to the mouse report as selected by the pointing device common configuration defines.
|
||||
*
|
||||
* NOTE: Only available when using SPLIT_POINTING_ENABLE and POINTING_DEVICE_COMBINED
|
||||
*
|
||||
* @param[in] mouse_report report_mouse_t to be adjusted
|
||||
* @return report_mouse_t with adjusted values
|
||||
*/
|
||||
report_mouse_t pointing_device_adjust_by_defines_right(report_mouse_t mouse_report) {
|
||||
// Support rotation of the sensor data
|
||||
# if defined(POINTING_DEVICE_ROTATION_90_RIGHT) || defined(POINTING_DEVICE_ROTATION_180_RIGHT) || defined(POINTING_DEVICE_ROTATION_270_RIGHT)
|
||||
mouse_xy_report_t x = mouse_report.x;
|
||||
mouse_xy_report_t y = mouse_report.y;
|
||||
# if defined(POINTING_DEVICE_ROTATION_90_RIGHT)
|
||||
mouse_report.x = y;
|
||||
mouse_report.y = -x;
|
||||
# elif defined(POINTING_DEVICE_ROTATION_180_RIGHT)
|
||||
mouse_report.x = -x;
|
||||
mouse_report.y = -y;
|
||||
# elif defined(POINTING_DEVICE_ROTATION_270_RIGHT)
|
||||
mouse_report.x = -y;
|
||||
mouse_report.y = x;
|
||||
# else
|
||||
# error "How the heck did you get here?!"
|
||||
# endif
|
||||
# endif
|
||||
// Support Inverting the X and Y Axises
|
||||
# if defined(POINTING_DEVICE_INVERT_X_RIGHT)
|
||||
mouse_report.x = -mouse_report.x;
|
||||
# endif
|
||||
# if defined(POINTING_DEVICE_INVERT_Y_RIGHT)
|
||||
mouse_report.y = -mouse_report.y;
|
||||
# endif
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handle core combined pointing device tasks
|
||||
*
|
||||
* Takes 2 report_mouse_t structs allowing individual modification of either side and then returns pointing_device_task_combined_kb.
|
||||
*
|
||||
* NOTE: Only available when using both SPLIT_POINTING_ENABLE and POINTING_DEVICE_COMBINED
|
||||
*
|
||||
* @param[in] left_report report_mouse_t
|
||||
* @param[in] right_report report_mouse_t
|
||||
* @return pointing_device_task_combined_kb(left_report, right_report) by default
|
||||
*/
|
||||
report_mouse_t pointing_device_task_combined(report_mouse_t left_report, report_mouse_t right_report) {
|
||||
# ifdef POINTING_DEVICE_MODES_ENABLE
|
||||
# ifdef POINTING_MODES_SINGLE_CONTROL
|
||||
// only one side controlled at any one time
|
||||
switch (get_pointing_mode_device()) {
|
||||
case PM_RIGHT_DEVICE:
|
||||
right_report = pointing_device_modes_task(right_report);
|
||||
break;
|
||||
default:
|
||||
left_report = pointing_device_modes_task(left_report);
|
||||
}
|
||||
# else
|
||||
// both sides controlled independently
|
||||
// save current device id
|
||||
uint8_t current_device = get_pointing_mode_device();
|
||||
set_pointing_mode_device(PM_RIGHT_DEVICE);
|
||||
right_report = pointing_device_modes_task(right_report);
|
||||
|
||||
set_pointing_mode_device(PM_LEFT_DEVICE);
|
||||
left_report = pointing_device_modes_task(left_report);
|
||||
// set device id back
|
||||
set_pointing_mode_device(current_device);
|
||||
# endif
|
||||
# endif
|
||||
return pointing_device_task_combined_kb(left_report, right_report);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Weak function allowing for keyboard level mouse report modification
|
||||
*
|
||||
* Takes 2 report_mouse_t structs allowing individual modification of sides at keyboard level then returns pointing_device_task_combined_user.
|
||||
*
|
||||
* NOTE: Only available when using SPLIT_POINTING_ENABLE and POINTING_DEVICE_COMBINED
|
||||
*
|
||||
* @param[in] left_report report_mouse_t
|
||||
* @param[in] right_report report_mouse_t
|
||||
* @return pointing_device_task_combined_user(left_report, right_report) by default
|
||||
*/
|
||||
__attribute__((weak)) report_mouse_t pointing_device_task_combined_kb(report_mouse_t left_report, report_mouse_t right_report) {
|
||||
return pointing_device_task_combined_user(left_report, right_report);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Weak function allowing for user level mouse report modification
|
||||
*
|
||||
* Takes 2 report_mouse_t structs allowing individual modification of sides at user level then returns pointing_device_combine_reports.
|
||||
*
|
||||
* NOTE: Only available when using SPLIT_POINTING_ENABLE and POINTING_DEVICE_COMBINED
|
||||
*
|
||||
* @param[in] left_report report_mouse_t
|
||||
* @param[in] right_report report_mouse_t
|
||||
* @return pointing_device_combine_reports(left_report, right_report) by default
|
||||
*/
|
||||
__attribute__((weak)) report_mouse_t pointing_device_task_combined_user(report_mouse_t left_report, report_mouse_t right_report) {
|
||||
return pointing_device_combine_reports(left_report, right_report);
|
||||
}
|
||||
#endif // defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
|
||||
__attribute__((weak)) void pointing_device_keycode_handler(uint16_t keycode, bool pressed) {
|
||||
if IS_MOUSEKEY_BUTTON (keycode) {
|
||||
local_mouse_report.buttons = pointing_device_handle_buttons(local_mouse_report.buttons, pressed, keycode - KC_MS_BTN1);
|
||||
pointing_device_send();
|
||||
}
|
||||
}
|
||||
148
users/freznel/backup/pointing_device.h
Normal file
148
users/freznel/backup/pointing_device.h
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
Copyright 2017 Joshua Broekhuijsen <snipeye+qmk@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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "host.h"
|
||||
#include "report.h"
|
||||
|
||||
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
# include "pointing_device_auto_mouse.h"
|
||||
#endif
|
||||
#ifdef POINTING_DEVICE_MODES_ENABLE
|
||||
# include "pointing_device_modes.h"
|
||||
#endif
|
||||
|
||||
#if defined(POINTING_DEVICE_DRIVER_adns5050)
|
||||
# include "drivers/sensors/adns5050.h"
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#elif defined(POINTING_DEVICE_DRIVER_pmw3320)
|
||||
# include "drivers/sensors/pmw3320.h"
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#elif defined(POINTING_DEVICE_DRIVER_adns9800)
|
||||
# include "spi_master.h"
|
||||
# include "drivers/sensors/adns9800.h"
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#elif defined(POINTING_DEVICE_DRIVER_analog_joystick)
|
||||
# include "analog.h"
|
||||
# include "drivers/sensors/analog_joystick.h"
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#elif defined(POINTING_DEVICE_DRIVER_ps2_trackpoint)
|
||||
# include "drivers/ps2/ps2.h"
|
||||
# include "drivers/ps2/ps2_mouse.h"
|
||||
#elif defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_i2c) || defined(POINTING_DEVICE_DRIVER_cirque_pinnacle_spi)
|
||||
# include "drivers/sensors/cirque_pinnacle.h"
|
||||
# include "drivers/sensors/cirque_pinnacle_gestures.h"
|
||||
# include "pointing_device_gestures.h"
|
||||
#elif defined(POINTING_DEVICE_DRIVER_paw3204)
|
||||
# include "drivers/sensors/paw3204.h"
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#elif defined(POINTING_DEVICE_DRIVER_pimoroni_trackball)
|
||||
# include "i2c_master.h"
|
||||
# include "drivers/sensors/pimoroni_trackball.h"
|
||||
// support for legacy pimoroni defines
|
||||
# ifdef PIMORONI_TRACKBALL_INVERT_X
|
||||
# define POINTING_DEVICE_INVERT_X
|
||||
# endif
|
||||
# ifdef PIMORONI_TRACKBALL_INVERT_Y
|
||||
# define POINTING_DEVICE_INVERT_Y
|
||||
# endif
|
||||
# ifdef PIMORONI_TRACKBALL_ROTATE
|
||||
# define POINTING_DEVICE_ROTATION_90
|
||||
# endif
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#elif defined(POINTING_DEVICE_DRIVER_pmw3360) || defined(POINTING_DEVICE_DRIVER_pmw3389)
|
||||
# include "spi_master.h"
|
||||
# include "drivers/sensors/pmw33xx_common.h"
|
||||
# define POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
#else
|
||||
void pointing_device_driver_init(void);
|
||||
report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report);
|
||||
uint16_t pointing_device_driver_get_cpi(void);
|
||||
void pointing_device_driver_set_cpi(uint16_t cpi);
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
void (*init)(void);
|
||||
report_mouse_t (*get_report)(report_mouse_t mouse_report);
|
||||
void (*set_cpi)(uint16_t);
|
||||
uint16_t (*get_cpi)(void);
|
||||
} pointing_device_driver_t;
|
||||
|
||||
typedef enum {
|
||||
POINTING_DEVICE_BUTTON1,
|
||||
POINTING_DEVICE_BUTTON2,
|
||||
POINTING_DEVICE_BUTTON3,
|
||||
POINTING_DEVICE_BUTTON4,
|
||||
POINTING_DEVICE_BUTTON5,
|
||||
POINTING_DEVICE_BUTTON6,
|
||||
POINTING_DEVICE_BUTTON7,
|
||||
POINTING_DEVICE_BUTTON8,
|
||||
} pointing_device_buttons_t;
|
||||
|
||||
#ifdef MOUSE_EXTENDED_REPORT
|
||||
# define XY_REPORT_MIN INT16_MIN
|
||||
# define XY_REPORT_MAX INT16_MAX
|
||||
typedef int32_t clamp_xy_range_t;
|
||||
#else
|
||||
# define XY_REPORT_MIN INT8_MIN
|
||||
# define XY_REPORT_MAX INT8_MAX
|
||||
typedef int16_t clamp_xy_range_t;
|
||||
#endif
|
||||
|
||||
#ifdef MOUSE_SCROLL_EXTENDED_REPORT
|
||||
# define HV_REPORT_MIN INT16_MIN
|
||||
# define HV_REPORT_MAX INT16_MAX
|
||||
typedef int32_t clamp_hv_range_t;
|
||||
#else
|
||||
# define HV_REPORT_MIN INT8_MIN
|
||||
# define HV_REPORT_MAX INT8_MAX
|
||||
typedef int16_t clamp_hv_range_t;
|
||||
#endif
|
||||
|
||||
void pointing_device_init(void);
|
||||
bool pointing_device_task(void);
|
||||
bool pointing_device_send(void);
|
||||
report_mouse_t pointing_device_get_report(void);
|
||||
void pointing_device_set_report(report_mouse_t mouse_report);
|
||||
uint16_t pointing_device_get_cpi(void);
|
||||
void pointing_device_set_cpi(uint16_t cpi);
|
||||
|
||||
void pointing_device_init_kb(void);
|
||||
void pointing_device_init_user(void);
|
||||
report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report);
|
||||
report_mouse_t pointing_device_task_user(report_mouse_t mouse_report);
|
||||
uint8_t pointing_device_handle_buttons(uint8_t buttons, bool pressed, pointing_device_buttons_t button);
|
||||
report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report);
|
||||
void pointing_device_keycode_handler(uint16_t keycode, bool pressed);
|
||||
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
void pointing_device_set_shared_report(report_mouse_t report);
|
||||
uint16_t pointing_device_get_shared_cpi(void);
|
||||
# if !defined(POINTING_DEVICE_TASK_THROTTLE_MS)
|
||||
# define POINTING_DEVICE_TASK_THROTTLE_MS 1
|
||||
# endif
|
||||
# if defined(POINTING_DEVICE_COMBINED)
|
||||
void pointing_device_set_cpi_on_side(bool left, uint16_t cpi);
|
||||
report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, report_mouse_t right_report);
|
||||
report_mouse_t pointing_device_task_combined(report_mouse_t left_report, report_mouse_t right_report);
|
||||
report_mouse_t pointing_device_task_combined_kb(report_mouse_t left_report, report_mouse_t right_report);
|
||||
report_mouse_t pointing_device_task_combined_user(report_mouse_t left_report, report_mouse_t right_report);
|
||||
report_mouse_t pointing_device_adjust_by_defines_right(report_mouse_t mouse_report);
|
||||
# endif // defined(POINTING_DEVICE_COMBINED)
|
||||
#endif // defined(SPLIT_POINTING_ENABLE)
|
||||
221
users/freznel/callbacks.c
Normal file
221
users/freznel/callbacks.c
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
|
||||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
# include "keyrecords/dynamic_macros.h"
|
||||
#endif
|
||||
|
||||
#ifdef I2C_SCANNER_ENABLE
|
||||
void matrix_scan_i2c(void);
|
||||
void keyboard_post_init_i2c(void);
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
|
||||
void keyboard_pre_init_user(void) {
|
||||
userspace_config.raw = eeconfig_read_user();
|
||||
keyboard_pre_init_keymap();
|
||||
}
|
||||
// Add reconfigurable functions here, for keymap customization
|
||||
// This allows for a global, userspace functions, and continued
|
||||
// customization of the keymap. Use _keymap instead of _user
|
||||
// functions in the keymaps
|
||||
// Call user matrix init, set default RGB colors and then
|
||||
// call the keymap's init function
|
||||
|
||||
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
|
||||
void keyboard_post_init_user(void) {
|
||||
#if defined(CUSTOM_RGBLIGHT)
|
||||
keyboard_post_init_rgb_light();
|
||||
#endif
|
||||
#if defined(CUSTOM_RGB_MATRIX)
|
||||
keyboard_post_init_rgb_matrix();
|
||||
#endif
|
||||
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER)
|
||||
keyboard_post_init_transport_sync();
|
||||
#endif
|
||||
#ifdef I2C_SCANNER_ENABLE
|
||||
keyboard_post_init_i2c();
|
||||
#endif
|
||||
#ifdef CUSTOM_UNICODE_ENABLE
|
||||
keyboard_post_init_unicode();
|
||||
#endif
|
||||
|
||||
#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) && defined(__AVR_ATmega32U4__)
|
||||
DDRD &= ~(1 << 5);
|
||||
PORTD &= ~(1 << 5);
|
||||
|
||||
DDRB &= ~(1 << 0);
|
||||
PORTB &= ~(1 << 0);
|
||||
#endif
|
||||
|
||||
keyboard_post_init_keymap();
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void rgb_matrix_update_pwm_buffers(void);
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) void shutdown_keymap(void) {}
|
||||
void shutdown_user(void) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
rgblight_enable_noeeprom();
|
||||
rgblight_mode_noeeprom(1);
|
||||
rgblight_setrgb(rgblight_get_val(), 0x00, 0x00);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00);
|
||||
rgb_matrix_update_pwm_buffers();
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
#ifdef OLED_ENABLE
|
||||
oled_off();
|
||||
#endif
|
||||
|
||||
shutdown_keymap();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void suspend_power_down_keymap(void) {}
|
||||
|
||||
void suspend_power_down_user(void) {
|
||||
if (layer_state_is(_GAMEPAD)) {
|
||||
layer_off(_GAMEPAD);
|
||||
}
|
||||
// if (layer_state_is(_DIABLO)) {
|
||||
// layer_off(_DIABLO);
|
||||
// }
|
||||
// if (layer_state_is(_DIABLOII)) {
|
||||
// layer_off(_DIABLOII);
|
||||
// }
|
||||
#ifdef OLED_ENABLE
|
||||
oled_off();
|
||||
#endif
|
||||
suspend_power_down_keymap();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
|
||||
void suspend_wakeup_init_user(void) {
|
||||
#ifdef OLED_ENABLE
|
||||
oled_timer_reset();
|
||||
#endif
|
||||
suspend_wakeup_init_keymap();
|
||||
}
|
||||
|
||||
// No global matrix scan code, so just run keymap's matrix
|
||||
// scan function
|
||||
__attribute__((weak)) void matrix_scan_keymap(void) {}
|
||||
void matrix_scan_user(void) {
|
||||
// matrix_scan_super_alt_tab();
|
||||
matrix_scan_keymap();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
float doom_song[][2] = SONG(E1M1_DOOM);
|
||||
#endif
|
||||
|
||||
// on layer change, no matter where the change was initiated
|
||||
// Then runs keymap's layer change check
|
||||
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
|
||||
// #if defined(CUSTOM_POINTING_DEVICE)
|
||||
// state = layer_state_set_pointing(state);
|
||||
// #endif
|
||||
#if defined(CUSTOM_RGBLIGHT)
|
||||
state = layer_state_set_rgb_light(state);
|
||||
#endif // CUSTOM_RGBLIGHT
|
||||
state = layer_state_set_keymap(state);
|
||||
|
||||
// #ifdef CONSOLE_ENABLE
|
||||
// char layer_buffer[16 + 5];
|
||||
// format_layer_bitmap_string(layer_buffer, state, default_layer_state);
|
||||
// dprintf("layer state: %s\n", layer_buffer);
|
||||
// #endif
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
// Runs state check and changes underglow color and animation
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
if (!is_keyboard_master()) {
|
||||
return state;
|
||||
}
|
||||
|
||||
state = default_layer_state_set_keymap(state);
|
||||
#if defined(CUSTOM_RGBLIGHT)
|
||||
state = default_layer_state_set_rgb_light(state);
|
||||
#endif
|
||||
return state;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
led_set_keymap(usb_led);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void eeconfig_init_keymap(void) {}
|
||||
void eeconfig_init_user(void) {
|
||||
userspace_config.raw = 0;
|
||||
userspace_config.rgb_layer_change = true;
|
||||
userspace_config.autocorrection = true;
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
eeconfig_init_keymap();
|
||||
}
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
__attribute__((weak)) void matrix_slave_scan_keymap(void) {}
|
||||
void matrix_slave_scan_user(void) {
|
||||
# if defined(AUDIO_ENABLE)
|
||||
# if !defined(NO_MUSIC_MODE)
|
||||
music_task();
|
||||
# endif
|
||||
# ifdef AUDIO_INIT_DELAY
|
||||
if (!is_keyboard_master()) {
|
||||
static bool delayed_tasks_run = false;
|
||||
static uint16_t delayed_task_timer = 0;
|
||||
if (!delayed_tasks_run) {
|
||||
if (!delayed_task_timer) {
|
||||
delayed_task_timer = timer_read();
|
||||
} else if (timer_elapsed(delayed_task_timer) > 300) {
|
||||
audio_startup();
|
||||
delayed_tasks_run = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
# ifdef SEQUENCER_ENABLE
|
||||
sequencer_task();
|
||||
# endif
|
||||
# ifdef LED_MATRIX_ENABLE
|
||||
led_matrix_task();
|
||||
# endif
|
||||
# ifdef HAPTIC_ENABLE
|
||||
haptic_task();
|
||||
# endif
|
||||
|
||||
matrix_slave_scan_keymap();
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) void housekeeping_task_keymap(void) {}
|
||||
void housekeeping_task_user(void) {
|
||||
static bool has_ran_yet;
|
||||
if (!has_ran_yet) {
|
||||
has_ran_yet = true;
|
||||
startup_user();
|
||||
}
|
||||
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER)
|
||||
housekeeping_task_transport_sync();
|
||||
#endif
|
||||
#if defined(CUSTOM_RGB_MATRIX)
|
||||
housekeeping_task_rgb_matrix();
|
||||
#endif
|
||||
housekeeping_task_keymap();
|
||||
}
|
||||
26
users/freznel/callbacks.h
Normal file
26
users/freznel/callbacks.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
void keyboard_post_init_keymap(void);
|
||||
void matrix_init_secret(void);
|
||||
void shutdown_keymap(void);
|
||||
void suspend_power_down_keymap(void);
|
||||
void suspend_wakeup_init_keymap(void);
|
||||
void matrix_scan_keymap(void);
|
||||
void matrix_scan_secret(void);
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state);
|
||||
layer_state_t default_layer_state_set_keymap(layer_state_t state);
|
||||
void led_set_keymap(uint8_t usb_led);
|
||||
void eeconfig_init_keymap(void);
|
||||
void housekeeping_task_keymap(void);
|
||||
|
||||
#ifdef CUSTOM_UNICODE_ENABLE
|
||||
void keyboard_post_init_unicode(void);
|
||||
#endif
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
void matrix_slave_scan_keymap(void);
|
||||
#endif
|
||||
228
users/freznel/config.h
Normal file
228
users/freznel/config.h
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// Use custom magic number so that when switching branches, EEPROM always gets reset
|
||||
#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339
|
||||
|
||||
#ifdef IS_COMMAND
|
||||
#undef IS_COMMAND
|
||||
#endif
|
||||
#define IS_COMMAND() (((get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) == MOD_MASK_CTRL)
|
||||
|
||||
/* Set Polling rate to 1000Hz */
|
||||
// #define USB_POLLING_INTERVAL_MS 1
|
||||
|
||||
|
||||
#if defined(SPLIT_KEYBOARD)
|
||||
# include "split/split_config.h"
|
||||
#endif
|
||||
|
||||
#if defined(WPM_ENABLE)
|
||||
// # define WPM_LAUNCH_CONTROL
|
||||
// # define WPM_ALLOW_COUNT_REGRESSOIN
|
||||
# define WPM_UNFILTERED
|
||||
# define WPM_SAMPLE_SECONDS 10
|
||||
# define WPM_SAMPLE_PERIODS 50
|
||||
# define WPM_ESTIMATED_WORD_SIZE 5
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
# define AUDIO_CLICKY
|
||||
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
|
||||
|
||||
# ifdef USER_SONG_LIST
|
||||
// # define STARTUP_SONG SONG(IMPERIAL_MARCH)
|
||||
# define GOODBYE_SONG SONG(SONIC_RING)
|
||||
# define DEFAULT_LAYER_SONGS \
|
||||
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
|
||||
# define UNICODE_SONG_MAC SONG(MARIO_THEME)
|
||||
# define UNICODE_SONG_LNX SONG(MARIO_POWERUP)
|
||||
# define UNICODE_SONG_WIN SONG(MARIO_ONEUP)
|
||||
# define UNICODE_SONG_BSD SONG(RICK_ROLL)
|
||||
# define UNICODE_SONG_WINC SONG(RICK_ROLL)
|
||||
# else
|
||||
# define STARTUP_SONG SONG(STARTUP_SOUND)
|
||||
# define GOODBYE_SONG SONG(GOODBYE_SOUND)
|
||||
# define DEFAULT_LAYER_SONGS \
|
||||
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) }
|
||||
# define UNICODE_SONG_MAC SONG(QWERTY_SOUND)
|
||||
# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND)
|
||||
# define UNICODE_SONG_WIN SONG(DVORAK_SOUND)
|
||||
# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND)
|
||||
# define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND)
|
||||
# endif
|
||||
#endif // !AUDIO_ENABLE
|
||||
|
||||
#define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# define RGBLIGHT_SLEEP
|
||||
# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250
|
||||
# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# include "rgb/rgb_matrix_config.h"
|
||||
#endif // RGB_MATRIX_ENABLE
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
# ifdef SPLIT_KEYBOARD
|
||||
# define OLED_UPDATE_INTERVAL 60
|
||||
# else
|
||||
# define OLED_UPDATE_INTERVAL 15
|
||||
# endif
|
||||
# define OLED_DISABLE_TIMEOUT
|
||||
# ifdef OLED_FONT_H
|
||||
# undef OLED_FONT_H
|
||||
# endif
|
||||
# define OLED_FONT_H "oled/freznel_font.h"
|
||||
# define OLED_FONT_END 255
|
||||
// # define OLED_FONT_5X5
|
||||
# define OLED_FONT_AZTECH
|
||||
// # define OLED_FONT_BMPLAIN
|
||||
// # define OLED_FONT_CRACKERS
|
||||
// # define OLED_FONT_DEAD_MEAL
|
||||
// # define OLED_FONT_EIN
|
||||
// # define OLED_FONT_HISKYF21
|
||||
// # define OLED_FONT_SQUASH
|
||||
// # define OLED_FONT_ZXPIX
|
||||
// # define OLED_FONT_SUPER_DIGG
|
||||
|
||||
# define OLED_LOGO_BEBOP
|
||||
// # define OLED_LOGO_CORNE
|
||||
// # define OLED_LOGO_GMK_BAD
|
||||
// # define OLED_LOGO_GOTHAM
|
||||
// # define OLED_LOGO_HUE_MANITEE
|
||||
// # define OLED_LOGO_LOOSE
|
||||
// # define OLED_LOGO_SCIFI
|
||||
// # define OLED_LOGO_SETS3N
|
||||
// # define OLED_LOGO_SKEEB
|
||||
//# define OLED_LOGO_FREZNEL
|
||||
#endif
|
||||
|
||||
// #define WPM_ESTIMATED_WORD_SIZE 5
|
||||
#define WPM_ALLOW_COUNT_REGRESSION
|
||||
// #define WPM_UNFILTERED
|
||||
// #define WPM_SAMPLE_SECONDS 5
|
||||
// #define WPM_SAMPLE_PERIODS 50
|
||||
// #define WPM_LAUNCH_CONTROL
|
||||
|
||||
|
||||
#ifndef ONESHOT_TAP_TOGGLE
|
||||
# define ONESHOT_TAP_TOGGLE 2
|
||||
#endif // !ONESHOT_TAP_TOGGLE
|
||||
|
||||
#ifndef ONESHOT_TIMEOUT
|
||||
# define ONESHOT_TIMEOUT 3000
|
||||
#endif // !ONESHOT_TIMEOUT
|
||||
|
||||
#if defined(PER_KEY_TAPPING)
|
||||
# define PERMISSIVE_HOLD_PER_KEY
|
||||
# define QUICK_TAP_TERM_PER_KEY
|
||||
# define HOLD_ON_OTHER_KEY
|
||||
# define RETRO_TAPPING_PER_KEY
|
||||
# define HOLD_ON_OTHER_KEY_PRESS_PER_KEY
|
||||
# define TAPPING_TERM_PER_KEY
|
||||
#else
|
||||
# define PERMISSIVE_HOLD
|
||||
#endif
|
||||
#define AUTO_MOUSE_DEFAULT_LAYER 4
|
||||
#ifndef TAPPING_TOGGLE
|
||||
# define TAPPING_TOGGLE 1
|
||||
#endif
|
||||
|
||||
#define TAP_CODE_DELAY 5
|
||||
|
||||
/* Disable unused and unneeded features to reduce on firmware size */
|
||||
#ifdef LOCKING_SUPPORT_ENABLE
|
||||
# undef LOCKING_SUPPORT_ENABLE
|
||||
#endif
|
||||
#ifdef LOCKING_RESYNC_ENABLE
|
||||
# undef LOCKING_RESYNC_ENABLE
|
||||
#endif
|
||||
|
||||
#ifdef CONVERT_TO_PROTON_C
|
||||
// pins that are available but not present on Pro Micro
|
||||
# define A3 PAL_LINE(GPIOA, 3)
|
||||
# define A4 PAL_LINE(GPIOA, 4)
|
||||
# define A5 PAL_LINE(GPIOA, 5)
|
||||
# define A6 PAL_LINE(GPIOA, 6)
|
||||
# define A7 PAL_LINE(GPIOA, 7)
|
||||
# define A8 PAL_LINE(GPIOA, 8)
|
||||
# define A13 PAL_LINE(GPIOA, 13)
|
||||
# define A14 PAL_LINE(GPIOA, 14)
|
||||
# define A15 PAL_LINE(GPIOA, 15)
|
||||
# define B10 PAL_LINE(GPIOB, 10)
|
||||
# define B11 PAL_LINE(GPIOB, 11)
|
||||
# define B12 PAL_LINE(GPIOB, 12)
|
||||
# define C13 PAL_LINE(GPIOC, 13)
|
||||
# define C14 PAL_LINE(GPIOC, 14)
|
||||
# define C15 PAL_LINE(GPIOC, 15)
|
||||
#endif
|
||||
|
||||
#ifdef OLED_DRIVER_SH1107
|
||||
# define OLED_DISPLAY_CUSTOM
|
||||
# define OLED_IC_SH1107 2
|
||||
# define OLED_DISPLAY_128X128
|
||||
# define OLED_DISPLAY_WIDTH 128
|
||||
# define OLED_DISPLAY_HEIGHT 128
|
||||
# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)
|
||||
# define OLED_BLOCK_TYPE uint32_t
|
||||
# define OLED_SOURCE_MAP \
|
||||
{ 0, 8, 16, 24, 32, 40, 48, 56 }
|
||||
# define OLED_TARGET_MAP \
|
||||
{ 56, 48, 40, 32, 24, 16, 8, 0 }
|
||||
# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8)
|
||||
# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)
|
||||
# define OLED_COM_PINS COM_PINS_ALT
|
||||
# define OLED_IC OLED_IC_SH1107
|
||||
# ifndef OLED_BRIGHTNESS
|
||||
# define OLED_BRIGHTNESS 50
|
||||
# endif
|
||||
# if !defined(STM32F4XX)
|
||||
# undef OLED_UPDATE_INTERVAL
|
||||
# define OLED_UPDATE_INTERVAL 75
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define ENABLE_COMPILE_KEYCODE
|
||||
|
||||
#define AUTOCORRECT_DATA_H "users/freznel/autocorrect_dictionary.h"
|
||||
|
||||
#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD
|
||||
|
||||
|
||||
// Fall-back defines to prevent compile errors if user_song_list is missing
|
||||
#ifndef ZELDA_PUZZLE2
|
||||
# define ZELDA_PUZZLE2 Q__NOTE(_G5)
|
||||
#endif
|
||||
#ifndef SONIC_RING2
|
||||
# define SONIC_RING2 E__NOTE(_E6)
|
||||
#endif
|
||||
#ifndef ZELDA_CHEST2
|
||||
# define ZELDA_CHEST2 Q__NOTE(_G5)
|
||||
#endif
|
||||
#ifndef COIN_SOUND2
|
||||
# define COIN_SOUND2 E__NOTE(_A5)
|
||||
#endif
|
||||
#ifndef ONE_UP_SOUND2
|
||||
# define ONE_UP_SOUND2 Q__NOTE(_E6)
|
||||
#endif
|
||||
#ifndef IMPERIAL_MARCH
|
||||
# define IMPERIAL_MARCH HD_NOTE(_A4)
|
||||
#endif
|
||||
#ifndef MARIO_GAMEOVER
|
||||
# define MARIO_GAMEOVER HD_NOTE(_C5)
|
||||
#endif
|
||||
#ifndef LEAD_START_SOUND
|
||||
# define LEAD_START_SOUND E__NOTE(_C5)
|
||||
#endif
|
||||
#ifndef LEAD_SUCCESS_SOUND
|
||||
# define LEAD_SUCCESS_SOUND E__NOTE(_A5), HD_NOTE(_E6),
|
||||
#endif
|
||||
#ifndef LEAD_FAIL_SOUND
|
||||
# define LEAD_FAIL_SOUND E__NOTE(_A5), HD_NOTE(_E4),
|
||||
#endif
|
||||
132
users/freznel/freznel.c
Normal file
132
users/freznel/freznel.c
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
|
||||
userspace_config_t userspace_config;
|
||||
|
||||
/**
|
||||
* @brief Handle registering a keycode, with optional modifer based on timed event
|
||||
*
|
||||
* @param code keycode to send to host
|
||||
* @param mod_code modifier to send with code, if held for tapping term or longer
|
||||
* @param pressed the press/release event (can use "record->event.pressed" for this)
|
||||
* @return true exits function
|
||||
* @return false exits function
|
||||
*/
|
||||
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
|
||||
static uint16_t this_timer;
|
||||
mod_key_press(code, mod_code, pressed, this_timer);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handle registation of keycode, with optional modifier based on custom timer
|
||||
*
|
||||
* @param code keycode to send to host
|
||||
* @param mod_code modifier keycode to send with code, if held for tapping term or longer
|
||||
* @param pressed the press/release event
|
||||
* @param this_timer custom timer to use
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
|
||||
if (pressed) {
|
||||
this_timer = timer_read();
|
||||
} else {
|
||||
if (timer_elapsed(this_timer) < TAPPING_TERM) {
|
||||
tap_code(code);
|
||||
} else {
|
||||
register_code(mod_code);
|
||||
tap_code(code);
|
||||
unregister_code(mod_code);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs exact match for modifier values
|
||||
*
|
||||
* @param value the modifer varible (get_mods/get_oneshot_mods/get_weak_mods)
|
||||
* @param mask the modifier mask to check for
|
||||
* @return true Has the exact modifiers specifed
|
||||
* @return false Does not have the exact modifiers specified
|
||||
*/
|
||||
bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
|
||||
value &= 0xF;
|
||||
mask &= 0xF;
|
||||
|
||||
return (value & mask) == mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Tap keycode, with no mods
|
||||
*
|
||||
* @param kc keycode to use
|
||||
*/
|
||||
void tap_code16_nomods(uint16_t kc) {
|
||||
uint8_t temp_mod = get_mods();
|
||||
clear_mods();
|
||||
clear_oneshot_mods();
|
||||
tap_code16(kc);
|
||||
set_mods(temp_mod);
|
||||
}
|
||||
|
||||
#ifdef I2C_SCANNER_ENABLE
|
||||
# include "i2c_master.h"
|
||||
# include "debug.h"
|
||||
|
||||
# ifndef I2C_SCANNER_TIMEOUT
|
||||
# define I2C_SCANNER_TIMEOUT 50
|
||||
# endif
|
||||
|
||||
i2c_status_t i2c_start_bodge(uint8_t address, uint16_t timeout) {
|
||||
i2c_start(address);
|
||||
|
||||
// except on ChibiOS where the only way is do do "something"
|
||||
uint8_t data = 0;
|
||||
return i2c_readReg(address, 0, &data, sizeof(data), I2C_SCANNER_TIMEOUT);
|
||||
}
|
||||
|
||||
# define i2c_start i2c_start_bodge
|
||||
|
||||
void do_scan(void) {
|
||||
uint8_t nDevices = 0;
|
||||
|
||||
dprintf("Scanning...\n");
|
||||
|
||||
for (uint8_t address = 1; address < 127; address++) {
|
||||
// The i2c_scanner uses the return value of
|
||||
// i2c_start to see if a device did acknowledge to the address.
|
||||
i2c_status_t error = i2c_start(address << 1, I2C_SCANNER_TIMEOUT);
|
||||
if (error == I2C_STATUS_SUCCESS) {
|
||||
i2c_stop();
|
||||
xprintf(" I2C device found at address 0x%02X\n", I2C_SCANNER_TIMEOUT);
|
||||
nDevices++;
|
||||
} else {
|
||||
// dprintf(" Unknown error (%u) at address 0x%02X\n", error, address);
|
||||
}
|
||||
}
|
||||
|
||||
if (nDevices == 0)
|
||||
xprintf("No I2C devices found\n");
|
||||
else
|
||||
xprintf("done\n");
|
||||
}
|
||||
|
||||
uint16_t scan_timer = 0;
|
||||
|
||||
void matrix_scan_i2c(void) {
|
||||
if (timer_elapsed(scan_timer) > 5000) {
|
||||
do_scan();
|
||||
scan_timer = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
void keyboard_post_init_i2c(void) {
|
||||
i2c_init();
|
||||
scan_timer = timer_read();
|
||||
}
|
||||
#endif
|
||||
126
users/freznel/freznel.h
Normal file
126
users/freznel/freznel.h
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "eeprom.h"
|
||||
#include "keyrecords/wrappers.h"
|
||||
#include "keyrecords/process_records.h"
|
||||
#include "callbacks.h"
|
||||
#include "super_alt_tab.h"
|
||||
#include "autocorrect_data.h"
|
||||
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
# include "keyrecords/tap_dances.h"
|
||||
#endif // TAP_DANCE_ENABLE
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
# include "rgb/rgb_stuff.h"
|
||||
#endif
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
# include "rgb/rgb_matrix_stuff.h"
|
||||
#endif
|
||||
#if defined(OLED_ENABLE)
|
||||
# include "oled/oled_stuff.h"
|
||||
#endif
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
# include "split/transport_sync.h"
|
||||
#endif
|
||||
#ifdef POINTING_DEVICE_ENABLE
|
||||
# include "pointing/pointing.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAPTIC_ENABLE
|
||||
#include "drivers/haptic/drv2605l.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Define layer names */
|
||||
enum userspace_layers {
|
||||
_COLEMAK_DH = 0,
|
||||
_NUMLOCK = 0,
|
||||
FIRST_DEFAULT_LAYER = 0,
|
||||
_QWERTY,
|
||||
_COLEMAK,
|
||||
_DVORAK,
|
||||
LAST_DEFAULT_LAYER = _DVORAK,
|
||||
_MOUSE,
|
||||
// _MEDIA,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST,
|
||||
_GAMEPAD,
|
||||
_BG,
|
||||
_KEYPAD
|
||||
};
|
||||
|
||||
#define _DEFAULT_LAYER_1 FIRST_DEFAULT_LAYER
|
||||
#define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 1)
|
||||
#define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 2)
|
||||
#define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 3)
|
||||
#if LAST_DEFAULT_LAYER > (FIRST_DEFAULT_LAYER + 3)
|
||||
# define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 4)
|
||||
# define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 5)
|
||||
# define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 6)
|
||||
# define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 7)
|
||||
# if LAST_DEFAULT_LAYER > (FIRST_DEFAULT_LAYER + 7)
|
||||
# define _DEFAULT_LAYER_2 (FIRST_DEFAULT_LAYER + 8)
|
||||
# define _DEFAULT_LAYER_3 (FIRST_DEFAULT_LAYER + 9)
|
||||
# define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 10)
|
||||
# define _DEFAULT_LAYER_4 (FIRST_DEFAULT_LAYER + 11)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define DEFAULT_LAYER_1_HSV HSV_CYAN
|
||||
#define DEFAULT_LAYER_2_HSV HSV_CHARTREUSE
|
||||
#define DEFAULT_LAYER_3_HSV HSV_MAGENTA
|
||||
#define DEFAULT_LAYER_4_HSV HSV_GOLDENROD
|
||||
|
||||
#define DEFAULT_LAYER_1_RGB RGB_CYAN
|
||||
#define DEFAULT_LAYER_2_RGB RGB_CHARTREUSE
|
||||
#define DEFAULT_LAYER_3_RGB RGB_MAGENTA
|
||||
#define DEFAULT_LAYER_4_RGB RGB_GOLDENROD
|
||||
|
||||
#define MODS_SHIFT ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT)
|
||||
#define MODS_CTRL ((get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL)
|
||||
#define MODS_ALT ((get_mods() | get_oneshot_mods()) & MOD_MASK_ALT)
|
||||
#define MODS_GUI ((get_mods() | get_oneshot_mods()) & MOD_MASK_GUI)
|
||||
#define MODS_LSHIFT ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LSFT))
|
||||
#define MODS_LCTRL ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LCTL))
|
||||
#define MODS_LALT ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LALT))
|
||||
#define MODS_LGUI ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LGUI))
|
||||
#define MODS_RSHIFT ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LRFT))
|
||||
#define MODS_RCTRL ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_RCTL))
|
||||
#define MODS_RALT ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_RALT))
|
||||
#define MODS_RGUI ((get_mods() | get_oneshot_mods()) & MOD_BIT(KC_RGUI))
|
||||
|
||||
#define OSMLFT OSM(MOD_LSFT)
|
||||
|
||||
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
|
||||
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
|
||||
bool hasAllBitsInMask(uint8_t value, uint8_t mask);
|
||||
void tap_code16_nomods(uint16_t kc);
|
||||
|
||||
// clang-format off
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool rgb_layer_change :1;
|
||||
bool is_overwatch :1;
|
||||
bool nuke_switch :1;
|
||||
bool swapped_numbers :1;
|
||||
bool rgb_matrix_idle_anim :1;
|
||||
bool autocorrection :1;
|
||||
};
|
||||
} userspace_config_t;
|
||||
// clang-format on
|
||||
|
||||
extern userspace_config_t userspace_config;
|
||||
|
||||
void press_super_tab (bool shift);
|
||||
void press_super_ctrl_tab (bool shift);
|
||||
void unregister_super_tab(void);
|
||||
void unregister_super_ctrl_tab(void);
|
||||
|
||||
|
||||
36
users/freznel/keyrecords/capwords.md
Normal file
36
users/freznel/keyrecords/capwords.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Cap Words
|
||||
|
||||
This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/caps-word/index.html), with a number of modifications.
|
||||
|
||||
To enable Caps Word, add `CAPS_WORD_ENABLE = yes` to your `rules.mk`.
|
||||
|
||||
This is mostly a reproduction of Pascal's docs:
|
||||
|
||||
## Overview
|
||||
|
||||
All-caps identifiers like “MOD_MASK_ALT” are awkward to type.
|
||||
|
||||
Caps Lock would be the standard solution to this problem, but it is awkward: it needs a dedicated key to toggle it (an imposition on smaller keyboards), and we need to remember to toggle it off after typing the word. Or with normal shifting, we either perform finger gymnastics or need to stop typing in the middle of the word to release shift with one hand to switch to holding shift with the other hand. In my experience, this is a nuisance especially if your shift keys are mod-taps, as in home row mods.
|
||||
|
||||
Caps Word, implemented here, is a modern alternative to Caps Lock:
|
||||
|
||||
* Caps Word is activated by pressing the left and right shift keys at the same time. This way you don’t need a dedicated key for using Caps Word.
|
||||
* Caps Word automatically disables itself at the end of the word.
|
||||
|
||||
**Compatibility**: I’ve tested that this implementation works with one-shot mods and Space Cadet Shift, and it predictably handles key repeating.
|
||||
|
||||
Unlike some other QMK Caps Word implementations, this library does not use the Caps Lock (KC_CAPS) keycode. It works even if the OS remaps Caps Lock to Ctrl or something else, as Emacs and Vim users often do.
|
||||
|
||||
## Using Caps Word
|
||||
With the above flashed to your keyboard:
|
||||
|
||||
1. **Activating**: Press and release both left and right shift keys at the same time. If your shift keys are mod-taps, activate Caps Word by holding both shift mod-tap keys until the tapping term, then release them.
|
||||
2. Then begin typing to get capitalized letters.
|
||||
3. **Disabling**: Caps Word disables itself when the next word breaking key is typed.
|
||||
|
||||
If you want to explicitly stop Caps Word, press and release Ctrl or another non-shift modifier or layer key. This also disables Caps Word.
|
||||
|
||||
## Explanation
|
||||
The code checks the mod bits on each key event, enabling Caps Word when both left and right shifts are active.
|
||||
|
||||
While enabled, Caps Word automatically presses and releases left shift (KC_LSFT) as needed so that letters are shifted and other keys are not. The word continues while typing a–z, 0–9, -, _, and backspace. Any other key is considered “word breaking” and disables Caps Word. You can edit the switch statement at the end of the process_caps_word() function to adjust which keys count as word breaking.
|
||||
259
users/freznel/keyrecords/dynamic_macros.c
Normal file
259
users/freznel/keyrecords/dynamic_macros.c
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
#include "keyrecords/dynamic_macros.h"
|
||||
#include "keyrecords/process_records.h"
|
||||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "eeprom.h"
|
||||
#include "eeconfig.h"
|
||||
#include <string.h>
|
||||
|
||||
#define DYNAMIC_MACRO_EEPROM_MAGIC_ADDR (uint16_t*)EECONFIG_SIZE
|
||||
#define DYNAMIC_MACRO_EEPROM_BLOCK0_ADDR (uint8_t*)(EECONFIG_SIZE + 2)
|
||||
|
||||
dynamic_macro_t dynamic_macros[DYNAMIC_MACRO_COUNT];
|
||||
|
||||
/* Blink the LEDs to notify the user about some event. */
|
||||
__attribute__((weak)) void dynamic_macro_led_blink(void) {}
|
||||
|
||||
/**
|
||||
* Start recording of the dynamic macro.
|
||||
*
|
||||
* @param macro_id[in] The id of macro to be recorded
|
||||
*/
|
||||
void dynamic_macro_record_start(uint8_t macro_id) {
|
||||
dprintf("dynamic macro recording: started for slot %d\n", macro_id);
|
||||
|
||||
dynamic_macro_led_blink();
|
||||
|
||||
clear_keyboard();
|
||||
layer_clear();
|
||||
|
||||
dynamic_macros[macro_id].length = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Play the dynamic macro.
|
||||
*
|
||||
* @param macro_id[in] The id of macro to be played
|
||||
*/
|
||||
void dynamic_macro_play(uint8_t macro_id) {
|
||||
dprintf("dynamic macro: slot %d playback, length %d\n", macro_id, dynamic_macros[macro_id].length);
|
||||
|
||||
uint32_t saved_layer_state = layer_state;
|
||||
|
||||
clear_keyboard();
|
||||
layer_clear();
|
||||
|
||||
for (uint8_t i = 0; i < dynamic_macros[macro_id].length; ++i) {
|
||||
process_record(&dynamic_macros[macro_id].events[i]);
|
||||
}
|
||||
|
||||
clear_keyboard();
|
||||
|
||||
layer_state = saved_layer_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a single key in a dynamic macro.
|
||||
*
|
||||
* @param macro_id[in] The start of the used macro buffer.
|
||||
* @param record[in] The current keypress.
|
||||
*/
|
||||
void dynamic_macro_record_key(uint8_t macro_id, keyrecord_t* record) {
|
||||
dynamic_macro_t* macro = &dynamic_macros[macro_id];
|
||||
uint8_t length = macro->length;
|
||||
|
||||
/* If we've just started recording, ignore all the key releases. */
|
||||
if (!record->event.pressed && length == 0) {
|
||||
dprintln("dynamic macro: ignoring a leading key-up event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (length < DYNAMIC_MACRO_SIZE) {
|
||||
macro->events[length] = *record;
|
||||
macro->length = ++length;
|
||||
} else {
|
||||
dynamic_macro_led_blink();
|
||||
}
|
||||
|
||||
dprintf("dynamic macro: slot %d length: %d/%d\n", macro_id, length, DYNAMIC_MACRO_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* End recording of the dynamic macro. Essentially just update the
|
||||
* pointer to the end of the macro.
|
||||
*/
|
||||
void dynamic_macro_record_end(uint8_t macro_id) {
|
||||
dynamic_macro_led_blink();
|
||||
|
||||
dynamic_macro_t* macro = &dynamic_macros[macro_id];
|
||||
uint8_t length = macro->length;
|
||||
|
||||
keyrecord_t* events_begin = &(macro->events[0]);
|
||||
keyrecord_t* events_pointer = &(macro->events[length - 1]);
|
||||
|
||||
dprintf("dynamic_macro: macro length before trimming: %d\n", macro->length);
|
||||
while (events_pointer != events_begin && (events_pointer)->event.pressed) {
|
||||
dprintln("dynamic macro: trimming a trailing key-down event");
|
||||
--(macro->length);
|
||||
--events_pointer;
|
||||
}
|
||||
|
||||
macro->checksum = dynamic_macro_calc_crc(macro);
|
||||
dynamic_macro_save_eeprom(macro_id);
|
||||
|
||||
dprintf("dynamic macro: slot %d saved, length: %d\n", macro_id, length);
|
||||
}
|
||||
|
||||
/* Handle the key events related to the dynamic macros. Should be
|
||||
* called from process_record_user() like this:
|
||||
*
|
||||
* bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
* if (!process_record_dynamic_macro(keycode, record)) {
|
||||
* return false;
|
||||
* }
|
||||
* <...THE REST OF THE FUNCTION...>
|
||||
* }
|
||||
*/
|
||||
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t* record) {
|
||||
/* 0 to DYNAMIC_MACRO_COUNT -1 - macro macro_id is being recorded */
|
||||
static uint8_t macro_id = 255;
|
||||
static uint8_t recording_state = STATE_NOT_RECORDING;
|
||||
|
||||
if (STATE_NOT_RECORDING == recording_state) {
|
||||
/* Program key pressed to request programming mode */
|
||||
if (keycode == DYN_MACRO_PROG && record->event.pressed) {
|
||||
dynamic_macro_led_blink();
|
||||
|
||||
recording_state = STATE_RECORD_KEY_PRESSED;
|
||||
dprintf("dynamic macro: programming key pressed, waiting for macro slot selection. %d\n", recording_state);
|
||||
|
||||
return false;
|
||||
}
|
||||
/* Macro key pressed to request macro playback */
|
||||
if (IS_DYN_KEYCODE(keycode) && record->event.pressed) {
|
||||
dynamic_macro_play(keycode - DYN_MACRO_KEY00);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Non-dynamic macro key, process it elsewhere. */
|
||||
return true;
|
||||
} else if (STATE_RECORD_KEY_PRESSED == recording_state) {
|
||||
/* Program key pressed again before a macro selector key, cancel macro recording.
|
||||
Blink leds to indicate cancelation. */
|
||||
if (keycode == DYN_MACRO_PROG && record->event.pressed) {
|
||||
dynamic_macro_led_blink();
|
||||
|
||||
recording_state = STATE_NOT_RECORDING;
|
||||
dprintf("dynamic macro: programming key pressed, programming mode canceled. %d\n", recording_state);
|
||||
|
||||
return false;
|
||||
} else if (IS_DYN_KEYCODE(keycode) && record->event.pressed) {
|
||||
macro_id = keycode - DYN_MACRO_KEY00;
|
||||
|
||||
/* Macro slot selected, enter recording state. */
|
||||
recording_state = STATE_CURRENTLY_RECORDING;
|
||||
dynamic_macro_record_start(macro_id);
|
||||
|
||||
return false;
|
||||
}
|
||||
/* Ignore any non-macro key press while in RECORD_KEY_PRESSED state. */
|
||||
return false;
|
||||
} else if (STATE_CURRENTLY_RECORDING == recording_state) {
|
||||
/* Program key pressed to request end of macro recording. */
|
||||
if (keycode == DYN_MACRO_PROG && record->event.pressed) {
|
||||
dynamic_macro_record_end(macro_id);
|
||||
recording_state = STATE_NOT_RECORDING;
|
||||
|
||||
return false;
|
||||
}
|
||||
/* Don't record other macro key presses. */
|
||||
else if (IS_DYN_KEYCODE(keycode) && record->event.pressed) {
|
||||
dprintln("dynamic macro: playback key ignored in programming mode.");
|
||||
return false;
|
||||
}
|
||||
/* Non-macro keypress that should be recorded */
|
||||
else {
|
||||
dynamic_macro_record_key(macro_id, record);
|
||||
|
||||
/* Don't output recorded keypress. */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint16_t crc16_update(uint16_t crc, uint8_t a) {
|
||||
crc ^= a;
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
if (crc & 1)
|
||||
crc = (crc >> 1) ^ 0xA001;
|
||||
else
|
||||
crc = (crc >> 1);
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
uint16_t dynamic_macro_calc_crc(dynamic_macro_t* macro) {
|
||||
uint16_t crc = 0;
|
||||
uint8_t* data = (uint8_t*)macro;
|
||||
|
||||
for (uint16_t i = 0; i < DYNAMIC_MACRO_CRC_LENGTH; ++i) {
|
||||
crc = crc16_update(crc, *(data++));
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
inline void* dynamic_macro_eeprom_macro_addr(uint8_t macro_id) {
|
||||
return DYNAMIC_MACRO_EEPROM_BLOCK0_ADDR + sizeof(dynamic_macro_t) * macro_id;
|
||||
}
|
||||
|
||||
bool dynamic_macro_header_correct(void) {
|
||||
return eeprom_read_word(DYNAMIC_MACRO_EEPROM_MAGIC_ADDR) == DYNAMIC_MACRO_EEPROM_MAGIC;
|
||||
}
|
||||
|
||||
void dynamic_macro_load_eeprom_all(void) {
|
||||
if (!dynamic_macro_header_correct()) {
|
||||
dprintf("dynamic_macro: eeprom header not valid, not restoring macros.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < DYNAMIC_MACRO_COUNT; ++i) {
|
||||
dynamic_macro_load_eeprom(i);
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_macro_load_eeprom(uint8_t macro_id) {
|
||||
dynamic_macro_t* dst = &dynamic_macros[macro_id];
|
||||
|
||||
eeprom_read_block(dst, dynamic_macro_eeprom_macro_addr(macro_id), sizeof(dynamic_macro_t));
|
||||
|
||||
/* Validate checksum, ifchecksum is NOT valid for macro, set its length to 0 to prevent its use. */
|
||||
if (dynamic_macro_calc_crc(dst) != dst->checksum) {
|
||||
dprintf("dynamic macro: slot %d not loaded, checksum mismatch\n", macro_id);
|
||||
dst->length = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf("dynamic macro: slot %d loaded from eeprom, checksum okay\n", macro_id);
|
||||
}
|
||||
|
||||
void dynamic_macro_save_eeprom(uint8_t macro_id) {
|
||||
if (!dynamic_macro_header_correct()) {
|
||||
eeprom_write_word(DYNAMIC_MACRO_EEPROM_MAGIC_ADDR, DYNAMIC_MACRO_EEPROM_MAGIC);
|
||||
dprintf("dynamic macro: writing magic eeprom header\n");
|
||||
}
|
||||
|
||||
dynamic_macro_t* src = &dynamic_macros[macro_id];
|
||||
|
||||
eeprom_update_block(src, dynamic_macro_eeprom_macro_addr(macro_id), sizeof(dynamic_macro_t));
|
||||
dprintf("dynamic macro: slot %d saved to eeprom\n", macro_id);
|
||||
}
|
||||
|
||||
void dynamic_macro_init(void) {
|
||||
/* zero out macro blocks */
|
||||
memset(&dynamic_macros, 0, DYNAMIC_MACRO_COUNT * sizeof(dynamic_macro_t));
|
||||
dynamic_macro_load_eeprom_all();
|
||||
}
|
||||
60
users/freznel/keyrecords/dynamic_macros.h
Normal file
60
users/freznel/keyrecords/dynamic_macros.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/* Copyright 2016 Jack Humbert
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */
|
||||
#pragma once
|
||||
|
||||
#include "action.h"
|
||||
#include "action_layer.h"
|
||||
|
||||
#ifndef DYNAMIC_MACRO_COUNT
|
||||
# define DYNAMIC_MACRO_COUNT 16
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_MACRO_SIZE
|
||||
# define DYNAMIC_MACRO_SIZE 64
|
||||
#endif
|
||||
|
||||
enum dynamic_macro_recording_state {
|
||||
STATE_NOT_RECORDING,
|
||||
STATE_RECORD_KEY_PRESSED,
|
||||
STATE_CURRENTLY_RECORDING,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
keyrecord_t events[DYNAMIC_MACRO_SIZE];
|
||||
uint8_t length;
|
||||
uint16_t checksum;
|
||||
} dynamic_macro_t;
|
||||
|
||||
void dynamic_macro_init(void);
|
||||
void dynamic_macro_led_blink(void);
|
||||
void dynamic_macro_record_start(uint8_t macro_id);
|
||||
void dynamic_macro_play(uint8_t macro_id);
|
||||
void dynamic_macro_record_key(uint8_t macro_id, keyrecord_t* record);
|
||||
void dynamic_macro_record_end(uint8_t macro_id);
|
||||
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t* record);
|
||||
|
||||
#define DYNAMIC_MACRO_CRC_LENGTH (sizeof(dynamic_macro_t) - sizeof(uint16_t))
|
||||
#define IS_DYN_KEYCODE(keycode) (keycode >= DYN_MACRO_KEY00 && keycode <= DYN_MACRO_KEY15)
|
||||
|
||||
#define DYNAMIC_MACRO_EEPROM_MAGIC (uint16_t)0xDEAD
|
||||
|
||||
uint16_t dynamic_macro_calc_crc(dynamic_macro_t* macro);
|
||||
void dynamic_macro_load_eeprom_all(void);
|
||||
void dynamic_macro_load_eeprom(uint8_t macro_id);
|
||||
void dynamic_macro_save_eeprom(uint8_t macro_id);
|
||||
bool dynamic_macro_header_correct(void);
|
||||
18
users/freznel/keyrecords/keycodes.md
Normal file
18
users/freznel/keyrecords/keycodes.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
# Custom Keycodes
|
||||
|
||||
Keycodes are defined in the `process_record.h` file and need to be included in the keymap.c files, so that they can be used there.
|
||||
|
||||
A bunch of macros are present and are only included on boards that are not the Ergodox EZ or Orthodox, as they are not needed for those boards.
|
||||
|
||||
* `KC_MAKE` - outputs `qmk compile -kb (keyboard) -km (keymap)` and enter, to start compiling the currenct keyboard. This uses generated variables to always use the current keyboard and keymap. Will work with any keyboard and any keymap.
|
||||
* If you are holding shift, it will use `qmk flash` instead of `qmk compile`.
|
||||
* If `MAKE_BOOTLOADER` is defined, it will always use `qmk flash` instead of `qmk compile`.
|
||||
* `DEFAULT_LAYER_1` ... `DEFAULT_LAYER_4` - This sets layer 0-3 as the default layer, and writes that to eeprom, and plays a chime.
|
||||
* `VRSN`, outputs the keyboard, keymap, commit and date info. Eg:
|
||||
* `handwired/tractyl_manuform/5x6_right/f411/drashna @ 0.15.9-162-g087d08, Built on: 2021-12-19-21:10:26`
|
||||
* `KC_DIABLO_CLEAR` - clears the diablo tapdance status.
|
||||
* `KC_CCCV` - Copy on hold, paste on tap.
|
||||
* `KEYLOCK` - This unloads the host driver, and prevents any data from being sent to the host. Hitting it again loads the driver, back.
|
||||
* `REBOOT` - Uses watchdog timer on AVR, and `NVIC_SystemReset()` on ChibiOS to reset the board, without jumping to the bootloader.
|
||||
* `EEP_RST` - Overrides the default behavior, disables EEPROM (which will trigger a reset on init), and reboots the keyboard as per `REBOOT` keycode.
|
||||
438
users/freznel/keyrecords/process_records.c
Normal file
438
users/freznel/keyrecords/process_records.c
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
#include "version.h"
|
||||
#include "drivers/haptic/drv2605l.h"
|
||||
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
# include "keyrecords/dynamic_macros.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAPTIC_ENABLE
|
||||
#include "drivers/haptic/drv2605l.h"
|
||||
#endif
|
||||
|
||||
#include "select_word.h"
|
||||
#include "pointing_device_auto_mouse.h"
|
||||
|
||||
|
||||
|
||||
uint16_t copy_paste_timer;
|
||||
bool host_driver_disabled = false;
|
||||
bool is_caret = false;
|
||||
bool auto_mouse_tg_off = false;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Keycode handler for keymaps
|
||||
*
|
||||
* This handles the keycodes at the keymap level, useful for keyboard specific customization
|
||||
*/
|
||||
__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;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool process_record_painter(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifndef SUPER_TAB_TIMEOUT
|
||||
# define SUPER_TAB_TIMEOUT 500
|
||||
#endif
|
||||
#ifndef SUPER_CTRL_TAB_TIMEOUT
|
||||
# define SUPER_CTRL_TAB_TIMEOUT 750
|
||||
#endif
|
||||
|
||||
bool is_super_tab_active = false;
|
||||
bool is_super_ctrl_tab_active = false;
|
||||
// Note that super tab and super control tab share the same timer! Shouldn't matter, but in case there are issues, note this.
|
||||
uint16_t super_tab_timer = 0;
|
||||
|
||||
void press_super_tab(bool shift) {
|
||||
if (shift) {
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
if (!is_super_tab_active) {
|
||||
is_super_tab_active = true;
|
||||
#ifdef MAC_PREFERRED
|
||||
register_code(KC_LGUI);
|
||||
#else
|
||||
register_code(KC_LALT);
|
||||
#endif
|
||||
}
|
||||
|
||||
super_tab_timer = timer_read();
|
||||
tap_code(KC_TAB);
|
||||
}
|
||||
|
||||
void unregister_super_tab(void) {
|
||||
if (is_super_tab_active) {
|
||||
if (timer_elapsed(super_tab_timer) > SUPER_TAB_TIMEOUT) {
|
||||
#ifdef FP_MAC_PREFERRED
|
||||
unregister_code(KC_LGUI);
|
||||
#else
|
||||
unregister_code(KC_LALT);
|
||||
#endif
|
||||
is_super_tab_active = false;
|
||||
|
||||
if (get_mods() & MOD_MASK_SHIFT) {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void press_super_ctrl_tab(bool shift) {
|
||||
if (shift) {
|
||||
register_code(KC_LSFT);
|
||||
} else {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
if (!is_super_ctrl_tab_active) {
|
||||
is_super_ctrl_tab_active = true;
|
||||
register_code(KC_LCTL);
|
||||
}
|
||||
|
||||
super_tab_timer = timer_read();
|
||||
tap_code(KC_TAB);
|
||||
}
|
||||
|
||||
void unregister_super_ctrl_tab(void) {
|
||||
if (is_super_ctrl_tab_active) {
|
||||
if (timer_elapsed(super_tab_timer) > SUPER_CTRL_TAB_TIMEOUT) {
|
||||
unregister_code(KC_LCTL);
|
||||
is_super_ctrl_tab_active = false;
|
||||
|
||||
if (get_mods() & MOD_MASK_SHIFT) {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main user keycode handler
|
||||
*
|
||||
* This handles all of the keycodes for the user, including calling feature handlers.
|
||||
*
|
||||
* @param keycode Keycode from matrix
|
||||
* @param record keyrecord_t data structure
|
||||
* @return true Continue processing keycode and send to host
|
||||
* @return false Stop process keycode and do not send to host
|
||||
*/
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// If console is enabled, it will print the matrix position and status of each key pressed
|
||||
#ifdef KEYLOGGER_ENABLE
|
||||
uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %1d, time: %5u, int: %1d, 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 // KEYLOGGER_ENABLE #endif // KEYLOGGER_ENABLE
|
||||
#if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER)
|
||||
process_record_user_oled(keycode, record);
|
||||
#endif // OLED
|
||||
if(!process_select_word(keycode, record, SELWORD)) { return false; }
|
||||
|
||||
if (!(process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
|
||||
#ifdef CUSTOM_RGB_MATRIX
|
||||
&& process_record_user_rgb_matrix(keycode, record)
|
||||
#endif
|
||||
#ifdef CUSTOM_RGBLIGHT
|
||||
&& process_record_user_rgb_light(keycode, record)
|
||||
#endif
|
||||
#ifdef CUSTOM_UNICODE_ENABLE
|
||||
&& process_record_unicode(keycode, record)
|
||||
#endif
|
||||
#if defined(CUSTOM_POINTING_DEVICE)
|
||||
&& process_record_pointing(keycode, record)
|
||||
#endif
|
||||
#ifdef SUPER_ALT_TAB_ENABLE
|
||||
&& process_record_super_alt_tab(keycode, record)
|
||||
#endif
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
&& process_record_dynamic_macro(keycode, record)
|
||||
#endif
|
||||
&& true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (keycode) {
|
||||
case FIRST_DEFAULT_LAYER_KEYCODE ... LAST_DEFAULT_LAYER_KEYCODE:
|
||||
if (record->event.pressed) {
|
||||
uint8_t mods = mod_config(get_mods() | get_oneshot_mods());
|
||||
if (!mods) {
|
||||
set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE);
|
||||
#if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 3)
|
||||
} else if (mods & MOD_MASK_SHIFT) {
|
||||
set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE + 4);
|
||||
# if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 7)
|
||||
|
||||
} else if (mods & MOD_MASK_CTRL) {
|
||||
set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE + 8);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VRSN: // Prints firmware version
|
||||
if (record->event.pressed) {
|
||||
send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
|
||||
}
|
||||
break;
|
||||
|
||||
// case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
|
||||
// #ifdef TAP_DANCE_ENABLE
|
||||
// if (record->event.pressed) {
|
||||
// for (uint8_t index = 0; index < 4; index++) {
|
||||
// diablo_timer[index].key_interval = 0;
|
||||
// }
|
||||
// }
|
||||
// #endif // TAP_DANCE_ENABLE
|
||||
// break;
|
||||
|
||||
case KC_CCCV: // One key copy/paste
|
||||
if (record->event.pressed) {
|
||||
copy_paste_timer = timer_read();
|
||||
} else {
|
||||
if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
|
||||
tap_code16(LCTL(KC_C));
|
||||
} else { // Tap, paste
|
||||
tap_code16(LCTL(KC_V));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
|
||||
#if defined(CUSTOM_RGBLIGHT) || defined(CUSTOM_RGB_MATRIX)
|
||||
if (record->event.pressed) {
|
||||
userspace_config.rgb_layer_change ^= 1;
|
||||
dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
# if defined(CUSTOM_RGB_MATRIX)
|
||||
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW | LED_FLAG_KEYLIGHT | LED_FLAG_INDICATOR | LED_FLAG_MODIFIER);
|
||||
# if defined(CUSTOM_RGBLIGHT)
|
||||
rgblight_enable_noeeprom();
|
||||
# endif
|
||||
# endif
|
||||
layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
|
||||
# if defined(CUSTOM_RGB_MATRIX)
|
||||
} else {
|
||||
rgb_matrix_set_flags(LED_FLAG_ALL);
|
||||
# if defined(CUSTOM_RGBLIGHT)
|
||||
rgblight_disable_noeeprom();
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif // CUSTOM_RGBLIGHT
|
||||
break;
|
||||
|
||||
#if defined(CUSTOM_RGBLIGHT) || defined(CUSTOM_RGB_MATRIX)
|
||||
case RGB_TOG:
|
||||
// Split keyboards need to trigger on key-up for edge-case issue
|
||||
# ifndef SPLIT_KEYBOARD
|
||||
if (record->event.pressed) {
|
||||
# else
|
||||
if (!record->event.pressed) {
|
||||
# endif
|
||||
# if defined(CUSTOM_RGBLIGHT) && !defined(RGBLIGHT_DISABLE_KEYCODES)
|
||||
rgblight_toggle();
|
||||
# endif
|
||||
# if defined(CUSTOM_RGB_MATRIX) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
|
||||
rgb_matrix_toggle();
|
||||
# endif
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
|
||||
if (record->event.pressed) {
|
||||
bool is_eeprom_updated;
|
||||
# if defined(CUSTOM_RGBLIGHT) && !defined(RGBLIGHT_DISABLE_KEYCODES)
|
||||
// This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
userspace_config.rgb_layer_change = false;
|
||||
dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
|
||||
is_eeprom_updated = true;
|
||||
}
|
||||
# endif
|
||||
# if defined(CUSTOM_RGB_MATRIX) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
|
||||
if (userspace_config.rgb_matrix_idle_anim) {
|
||||
userspace_config.rgb_matrix_idle_anim = false;
|
||||
dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
|
||||
is_eeprom_updated = true;
|
||||
}
|
||||
# endif
|
||||
if (is_eeprom_updated) {
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case KEYLOCK: {
|
||||
static host_driver_t *host_driver = 0;
|
||||
if (record->event.pressed) {
|
||||
if (host_get_driver()) {
|
||||
host_driver = host_get_driver();
|
||||
clear_keyboard();
|
||||
host_set_driver(0);
|
||||
host_driver_disabled = true;
|
||||
} else {
|
||||
host_set_driver(host_driver);
|
||||
host_driver_disabled = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARET:
|
||||
if (record->event.pressed) {
|
||||
is_caret ^= 1;
|
||||
}
|
||||
break;
|
||||
case NX_TAB:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(C(KC_TAB));
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
}
|
||||
break;
|
||||
case BK_TAB:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(S(C(KC_TAB)));
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
}
|
||||
break;
|
||||
case RAISE_TOGGLE:
|
||||
if (record->event.pressed) {
|
||||
layer_invert(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
}
|
||||
break;
|
||||
case BSPC_LSFT_CLEAR:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(KC_END);
|
||||
tap_code16(C(KC_LEFT));
|
||||
tap_code_delay(KC_BSPC, 5);
|
||||
}
|
||||
break;
|
||||
case BACKLU:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(C(S(KC_LEFT)));
|
||||
tap_code16(KC_BSPC);
|
||||
}
|
||||
break;
|
||||
case UNDO:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(LCTL(KC_Z));
|
||||
}
|
||||
break;
|
||||
case REDO:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(LCTL(KC_Y));
|
||||
}
|
||||
break;
|
||||
case ENTER:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(KC_ENTER);
|
||||
}
|
||||
break;
|
||||
case CUT:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(C(KC_X));
|
||||
}
|
||||
break;
|
||||
case COPY:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(C(KC_C));
|
||||
}
|
||||
break;
|
||||
case PASTE:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(C(KC_V));
|
||||
}
|
||||
break;
|
||||
case KEYPAD:
|
||||
if (record->event.pressed) {
|
||||
layer_invert(_KEYPAD);
|
||||
}
|
||||
break;
|
||||
case LOWER_TOGGLE:
|
||||
if (record->event.pressed) {
|
||||
layer_invert(_LOWER);
|
||||
}
|
||||
break;
|
||||
case GAMEPAD_TOGGLE:
|
||||
if (record->event.pressed) {
|
||||
layer_invert(_GAMEPAD);
|
||||
}
|
||||
break;
|
||||
case LPAREN:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(KC_LPRN);
|
||||
}
|
||||
break;
|
||||
case RPAREN:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(KC_RPRN);
|
||||
}
|
||||
break;
|
||||
case WBACK:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(KC_WBAK);
|
||||
}
|
||||
break;
|
||||
case WFWD:
|
||||
if (record->event.pressed) {
|
||||
tap_code16(KC_WFWD);
|
||||
}
|
||||
break;
|
||||
case NEXTSEN:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(". ");
|
||||
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
|
||||
}
|
||||
break;
|
||||
case NEGATIVEPASTE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("-");
|
||||
tap_code16(C(KC_V));
|
||||
}
|
||||
break;
|
||||
case AM_TOGGLE:
|
||||
if(record->event.pressed) { // key down
|
||||
auto_mouse_layer_off(); // disable target layer if needed
|
||||
set_auto_mouse_enable((AUTO_MOUSE_ENABLED) ^ 1);
|
||||
auto_mouse_tg_off = !get_auto_mouse_enable();
|
||||
}
|
||||
break;
|
||||
case ALTTABF:
|
||||
if (record->event.pressed) {
|
||||
press_super_tab (false);
|
||||
}
|
||||
break;
|
||||
case ALTTABB:
|
||||
if (record->event.pressed) {
|
||||
press_super_tab (true);
|
||||
}
|
||||
break;
|
||||
case CTLTABF:
|
||||
if (record->event.pressed) {
|
||||
press_super_ctrl_tab (false);
|
||||
}
|
||||
break;
|
||||
case CTLTABB:
|
||||
if (record->event.pressed) {
|
||||
press_super_ctrl_tab (true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {}
|
||||
void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
post_process_record_keymap(keycode, record);
|
||||
}
|
||||
|
||||
260
users/freznel/keyrecords/process_records.h
Normal file
260
users/freznel/keyrecords/process_records.h
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include "freznel.h"
|
||||
|
||||
// #if defined(KEYBOARD_zerf9) && defined(POINTING_DEVICE_ENABLE)
|
||||
// # define PLACEHOLDER_SAFE_RANGE QK_USER
|
||||
// #elif defined(KEYBOARD_zerfstudios)
|
||||
// # define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
|
||||
// #elif defined(KEYBOARD_bastardkb_charybdis)
|
||||
// # define PLACEHOLDER_SAFE_RANGE CHARYBDIS_SAFE_RANGE
|
||||
// #elif defined(KEYBOARD_rocksolid)
|
||||
// # define PLACEHOLDER_SAFE_RANGE ROCKSOLID_SAFE_RANGE
|
||||
// #elif defined(KEYBOARD_unichunky)
|
||||
// # define PLACEHOLDER_SAFE_RANGE UNICHUNKY_SAFE_RANGE
|
||||
// #elif defined(KEYBOARD_chunkx)
|
||||
// # define PLACEHOLDER_SAFE_RANGE CHARYBDIS_SAFE_RANGE
|
||||
// #elif defined(KEYBOARD_zerfstudios_emblem)
|
||||
// # define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
|
||||
// #else
|
||||
// # define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
|
||||
// #endif
|
||||
|
||||
enum userspace_custom_keycodes {
|
||||
VRSN = QK_USER, // Prints QMK Firmware and board info
|
||||
KC_QWERTY, // Sets default layer to QWERTY
|
||||
FIRST_DEFAULT_LAYER_KEYCODE = KC_QWERTY, // Sets default layer to QWERTY
|
||||
KC_COLEMAK_DH, // Sets default layer to COLEMAK
|
||||
KC_COLEMAK, // Sets default layer to COLEMAK
|
||||
KC_DVORAK, // Sets default layer to DVORAK
|
||||
LAST_DEFAULT_LAYER_KEYCODE = KC_DVORAK, // Sets default layer to WORKMAN
|
||||
KC_DIABLO_CLEAR, // Clears all Diablo Timers
|
||||
KC_RGB_T, // Toggles RGB Layer Indication mode
|
||||
RGB_IDL, // RGB Idling animations
|
||||
KC_SECRET_1, // test1
|
||||
KC_SECRET_2, // test2
|
||||
KC_SECRET_3, // test3
|
||||
KC_SECRET_4, // test4
|
||||
KC_SECRET_5, // test5
|
||||
KC_CCCV, // Hold to copy, tap to paste
|
||||
KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
|
||||
UC_FLIP, // (ಠ痊ಠ)┻━┻
|
||||
UC_TABL, // ┬─┬ノ( º _ ºノ)
|
||||
UC_SHRG, // ¯\_(ツ)_/¯
|
||||
UC_DISA, // ಠ_ಠ
|
||||
UC_IRNY,
|
||||
UC_CLUE,
|
||||
KEYLOCK, // Locks keyboard by unmounting driver
|
||||
KC_NOMODE,
|
||||
KC_WIDE,
|
||||
KC_SCRIPT,
|
||||
KC_BLOCKS,
|
||||
KC_REGIONAL,
|
||||
KC_AUSSIE,
|
||||
KC_ZALGO,
|
||||
KC_SUPER,
|
||||
KC_COMIC,
|
||||
KC_ACCEL,
|
||||
DRAG_MOM,
|
||||
DRAG_SCROLL,
|
||||
CARET,
|
||||
MEDIA,
|
||||
ALT_TAB,
|
||||
|
||||
BK_TAB,
|
||||
NX_TAB,
|
||||
|
||||
SELWORD,
|
||||
|
||||
KB_TG_ACCEL,
|
||||
KB_MO_APP,
|
||||
KB_MO_WINDOW,
|
||||
AM_TOGGLE,
|
||||
PM_SWITCH,
|
||||
PMR_DRAG,
|
||||
PML_DRAG,
|
||||
PMR_VOL,
|
||||
PML_VOL,
|
||||
|
||||
RAISE_TOGGLE, //combos
|
||||
BSPC_LSFT_CLEAR,
|
||||
BACKLU,
|
||||
UNDO,
|
||||
REDO,
|
||||
ENTER,
|
||||
CUT,
|
||||
COPY,
|
||||
PASTE,
|
||||
KEYPAD,
|
||||
LOWER_TOGGLE,
|
||||
GAMEPAD_TOGGLE,
|
||||
LPAREN,
|
||||
RPAREN,
|
||||
WBACK,
|
||||
WFWD,
|
||||
NEXTSEN,
|
||||
NEGATIVEPASTE,
|
||||
|
||||
ENC_ALT_TAB,
|
||||
ENC_ALT_TAB_REV,
|
||||
ALTTABF, // ALT-TAB forward
|
||||
ALTTABB, // ALT-TAB backwards
|
||||
CTLTABF, //
|
||||
CTLTABB, //
|
||||
|
||||
ROUTE,
|
||||
ROTATE,
|
||||
DRAG_TRACKS,
|
||||
PLACE_VIA,
|
||||
TRACK_WIDTH,
|
||||
VIA_WIDTH,
|
||||
TRACK_POSTURE,
|
||||
TRACK_CORNER_MODE,
|
||||
|
||||
DYN_MACRO_PROG,
|
||||
DYN_MACRO_KEY00,
|
||||
DYN_MACRO_KEY01,
|
||||
DYN_MACRO_KEY02,
|
||||
DYN_MACRO_KEY03,
|
||||
DYN_MACRO_KEY04,
|
||||
DYN_MACRO_KEY05,
|
||||
DYN_MACRO_KEY06,
|
||||
DYN_MACRO_KEY07,
|
||||
DYN_MACRO_KEY08,
|
||||
DYN_MACRO_KEY09,
|
||||
DYN_MACRO_KEY10,
|
||||
DYN_MACRO_KEY11,
|
||||
DYN_MACRO_KEY12,
|
||||
DYN_MACRO_KEY13,
|
||||
DYN_MACRO_KEY14,
|
||||
DYN_MACRO_KEY15,
|
||||
ST_MACRO_6,
|
||||
|
||||
USER_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes
|
||||
};
|
||||
|
||||
bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
|
||||
void post_process_record_keymap(uint16_t keycode, keyrecord_t *record);
|
||||
#ifdef CUSTOM_UNICODE_ENABLE
|
||||
bool process_record_unicode(uint16_t keycode, keyrecord_t *record);
|
||||
#endif
|
||||
#ifdef QUANTUM_PAINTER_ENABLE
|
||||
bool process_record_painter(uint16_t keycode, keyrecord_t *record);
|
||||
#endif
|
||||
|
||||
#define LOWER MO(_LOWER)
|
||||
#define RAISE MO(_RAISE)
|
||||
#define ADJUST MO(_ADJUST)
|
||||
#define TG_MODS OS_TOGG
|
||||
#define TG_GAME TG(_GAMEPAD)
|
||||
|
||||
#define OS_LWR OSL(_LOWER)
|
||||
#define OS_RSE OSL(_RAISE)
|
||||
#define KC_MAKE QK_MAKE
|
||||
#define BSP_RSH MT(MOD_RSFT, KC_BSPC)
|
||||
#define BSP_KEY LT(_KEYPAD, KC_BSPC)
|
||||
#define ENT_LWR LT(_LOWER, KC_ENT)
|
||||
#define ESC_LWR LT(_LOWER, KC_ESC)
|
||||
#define GSC_LWR LT(_LOWER, QK_GESC)
|
||||
#define SPC_LSH MT(MOD_LSFT, KC_SPC)
|
||||
#define DEL_RSE LT(_RAISE, KC_DEL)
|
||||
#define TAB_RSE LT(_RAISE, KC_TAB)
|
||||
#define C_L C(KC_LEFT)
|
||||
#define C_R C(KC_RIGHT)
|
||||
#define CS_L C(S(KC_LEFT))
|
||||
#define CS_R C(S(KC_RIGHT))
|
||||
|
||||
#define KC_SEC1 KC_SECRET_1
|
||||
#define KC_SEC2 KC_SECRET_2
|
||||
#define KC_SEC3 KC_SECRET_3
|
||||
#define KC_SEC4 KC_SECRET_4
|
||||
#define KC_SEC5 KC_SECRET_5
|
||||
|
||||
#define QWERTY KC_QWERTY
|
||||
#define DVORAK KC_DVORAK
|
||||
#define COLEMAK KC_COLEMAK
|
||||
#define COLEMAKDH KC_COLEMAK_DH
|
||||
|
||||
#define DEFLYR1 FIRST_DEFAULT_LAYER_KEYCODE
|
||||
#define DEFLYR2 (FIRST_DEFAULT_LAYER_KEYCODE + 1)
|
||||
#define DEFLYR3 (FIRST_DEFAULT_LAYER_KEYCODE + 2)
|
||||
#define DEFLYR4 (FIRST_DEFAULT_LAYER_KEYCODE + 3)
|
||||
#if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 3)
|
||||
# define DEFLYR5 (FIRST_DEFAULT_LAYER_KEYCODE + 4)
|
||||
# define DEFLYR6 (FIRST_DEFAULT_LAYER_KEYCODE + 5)
|
||||
# define DEFLYR7 (FIRST_DEFAULT_LAYER_KEYCODE + 6)
|
||||
# define DEFLYR8 (FIRST_DEFAULT_LAYER_KEYCODE + 7)
|
||||
# if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 7)
|
||||
# define DEFLYR9 (FIRST_DEFAULT_LAYER_KEYCODE + 8)
|
||||
# define DEFLYR10 (FIRST_DEFAULT_LAYER_KEYCODE + 9)
|
||||
# define DEFLYR11 (FIRST_DEFAULT_LAYER_KEYCODE + 10)
|
||||
# define DEFLYR12 (FIRST_DEFAULT_LAYER_KEYCODE + 11)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define KC_RESET RESET
|
||||
#define KC_RST KC_RESET
|
||||
|
||||
#define BK_LWER LT(_LOWER, KC_BSPC)
|
||||
#define SP_LWER LT(_LOWER, KC_SPC)
|
||||
#define DL_RAIS LT(_RAISE, KC_DEL)
|
||||
#define ET_RAIS LT(_RAISE, KC_ENTER)
|
||||
|
||||
#define CTLNUBS MT(MOD_LCTL, KC_NUBS)
|
||||
#define CTLGRVE MT(MOD_LCTL, KC_GRAVE)
|
||||
#define KC_CTUP C(KC_PGUP)
|
||||
#define KC_CTDN C(KC_PGDN)
|
||||
#define KC_ADEL LALT_T(KC_DEL)
|
||||
#define KC_SBT3 S(KC_BTN3)
|
||||
#define KC_MAC_UNDO LGUI(KC_Z)
|
||||
#define KC_MAC_CUT LGUI(KC_X)
|
||||
#define KC_MAC_COPY LGUI(KC_C)
|
||||
#define KC_MAC_PASTE LGUI(KC_V)
|
||||
#define KC_PC_UNDO LCTL(KC_Z)
|
||||
#define KC_PC_CUT LCTL(KC_X)
|
||||
#define KC_PC_COPY LCTL(KC_C)
|
||||
#define KC_PC_PASTE LCTL(KC_V)
|
||||
#define KC_POSR S(KC_P)
|
||||
#define KC_INTR C(S(KC_COMMA))
|
||||
|
||||
/* OSM keycodes, to keep things clean and easy to change */
|
||||
#define KC_MLSF OSM(MOD_LSFT)
|
||||
#define KC_MRSF OSM(MOD_RSFT)
|
||||
#define OS_LGUI OSM(MOD_LGUI)
|
||||
#define OS_RGUI OSM(MOD_RGUI)
|
||||
#define OS_LSFT OSM(MOD_LSFT)
|
||||
#define OS_RSFT OSM(MOD_RSFT)
|
||||
#define OS_LCTL OSM(MOD_LCTL)
|
||||
#define OS_RCTL OSM(MOD_RCTL)
|
||||
#define OS_LALT OSM(MOD_LALT)
|
||||
#define OS_RALT OSM(MOD_RALT)
|
||||
#define OS_MEH OSM(MOD_MEH)
|
||||
#define OS_HYPR OSM(MOD_HYPR)
|
||||
|
||||
#define ALT_APP ALT_T(KC_APP)
|
||||
|
||||
#define MG_NKRO MAGIC_TOGGLE_NKRO
|
||||
|
||||
#define AUTO_CTN AUTOCORRECT_TOGGLE
|
||||
|
||||
/*
|
||||
Custom Keycodes for Diablo 3 layer
|
||||
But since TD() doesn't work when tap dance is disabled
|
||||
We use custom codes here, so we can substitute the right stuff
|
||||
*/
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
# define KC_D3_1 TD(TD_D3_1)
|
||||
# define KC_D3_2 TD(TD_D3_2)
|
||||
# define KC_D3_3 TD(TD_D3_3)
|
||||
# define KC_D3_4 TD(TD_D3_4)
|
||||
#else // TAP_DANCE_ENABLE
|
||||
# define KC_D3_1 KC_1
|
||||
# define KC_D3_2 KC_2
|
||||
# define KC_D3_3 KC_3
|
||||
# define KC_D3_4 KC_4
|
||||
#endif // TAP_DANCE_ENABLE
|
||||
|
||||
#define REBOOT QK_REBOOT
|
||||
9
users/freznel/keyrecords/readme.md
Normal file
9
users/freznel/keyrecords/readme.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Keycode handling and interception
|
||||
|
||||
* [Autocorrection](autocorrection/readme.md)
|
||||
* [Cap Words](capwords.md)
|
||||
* [Diablo Tap Dancing](tap_dance.md)
|
||||
* [Keymap Wrappers](wrappers.md)
|
||||
* [Secret Macros](secrets.md)
|
||||
* [Custom Keycodes](keycodes.md)
|
||||
* [Unicode Input](unicode.md)
|
||||
106
users/freznel/keyrecords/select_word.c
Normal file
106
users/freznel/keyrecords/select_word.c
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// Copyright 2021 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.
|
||||
//
|
||||
//
|
||||
// For full documentation, see
|
||||
// https://getreuer.info/posts/keyboards/select-word
|
||||
|
||||
#include "select_word.h"
|
||||
|
||||
// Mac users, uncomment this line:
|
||||
// #define MAC_HOTKEYS
|
||||
|
||||
enum { STATE_NONE, STATE_SELECTED, STATE_WORD, STATE_FIRST_LINE, STATE_LINE };
|
||||
|
||||
bool process_select_word(uint16_t keycode, keyrecord_t* record,
|
||||
uint16_t sel_keycode) {
|
||||
static uint8_t state = STATE_NONE;
|
||||
|
||||
if (keycode == KC_LSFT || keycode == KC_RSFT) { return true; }
|
||||
|
||||
if (keycode == sel_keycode && record->event.pressed) { // On key press.
|
||||
const uint8_t mods = get_mods();
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
const uint8_t all_mods = mods | get_oneshot_mods();
|
||||
#else
|
||||
const uint8_t all_mods = mods;
|
||||
#endif // NO_ACTION_ONESHOT
|
||||
if ((all_mods & MOD_MASK_SHIFT) == 0) { // Select word.
|
||||
#ifdef MAC_HOTKEYS
|
||||
register_code(KC_LALT);
|
||||
#else
|
||||
register_code(KC_LCTL);
|
||||
#endif // MAC_HOTKEYS
|
||||
if (state == STATE_NONE) {
|
||||
SEND_STRING(SS_TAP(X_RGHT) SS_TAP(X_LEFT));
|
||||
}
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_RGHT);
|
||||
state = STATE_WORD;
|
||||
} else { // Select line.
|
||||
if (state == STATE_NONE) {
|
||||
clear_mods();
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
clear_oneshot_mods();
|
||||
#endif // NO_ACTION_ONESHOT
|
||||
#ifdef MAC_HOTKEYS
|
||||
SEND_STRING(SS_LCTL("a" SS_LSFT("e")));
|
||||
#else
|
||||
SEND_STRING(SS_TAP(X_HOME) SS_LSFT(SS_TAP(X_END)));
|
||||
#endif // MAC_HOTKEYS
|
||||
set_mods(mods);
|
||||
state = STATE_FIRST_LINE;
|
||||
} else {
|
||||
register_code(KC_DOWN);
|
||||
state = STATE_LINE;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// `sel_keycode` was released, or another key was pressed.
|
||||
switch (state) {
|
||||
case STATE_WORD:
|
||||
unregister_code(KC_RGHT);
|
||||
unregister_code(KC_LSFT);
|
||||
#ifdef MAC_HOTKEYS
|
||||
unregister_code(KC_LALT);
|
||||
#else
|
||||
unregister_code(KC_LCTL);
|
||||
#endif // MAC_HOTKEYS
|
||||
state = STATE_SELECTED;
|
||||
break;
|
||||
|
||||
case STATE_FIRST_LINE:
|
||||
state = STATE_SELECTED;
|
||||
break;
|
||||
|
||||
case STATE_LINE:
|
||||
unregister_code(KC_DOWN);
|
||||
state = STATE_SELECTED;
|
||||
break;
|
||||
|
||||
case STATE_SELECTED:
|
||||
if (keycode == KC_ESC) {
|
||||
tap_code(KC_RGHT);
|
||||
state = STATE_NONE;
|
||||
return false;
|
||||
}
|
||||
// Fallthrough.
|
||||
default:
|
||||
state = STATE_NONE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
45
users/freznel/keyrecords/select_word.h
Normal file
45
users/freznel/keyrecords/select_word.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2021-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.
|
||||
//
|
||||
//
|
||||
// Select word/line button.
|
||||
//
|
||||
// Implements a button that selects the current word, assuming conventional text
|
||||
// editor hotkeys. Pressing it again extends the selection to the following
|
||||
// word. The effect is similar to word selection (W) in the Kakoune editor.
|
||||
//
|
||||
// Pressing the button with shift selects the current line, and pressing the
|
||||
// button again extends the selection to the following line.
|
||||
//
|
||||
// Note for Mac users: Windows/Linux editing hotkeys are assumed by default.
|
||||
// Uncomment the `#define MAC_HOTKEYS` line in select_word.c for Mac hotkeys.
|
||||
// The Mac implementation is untested, let me know if it has problems.
|
||||
//
|
||||
// For full documentation, see
|
||||
// https://getreuer.info/posts/keyboards/select-word
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool process_select_word(uint16_t keycode, keyrecord_t* record,
|
||||
uint16_t sel_keycode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
121
users/freznel/keyrecords/tap_dance.md
Normal file
121
users/freznel/keyrecords/tap_dance.md
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
# Diablo Tap Dances
|
||||
|
||||
My [Tap Dance](tap_dances.c) file includes the tap dance declarations, and everything needed for them.
|
||||
|
||||
To disable, add `CUSTOM_TAP_DANCE = no` to your `rules.mk`.
|
||||
|
||||
This is used for making Diablo 3 much easier to plan, especially at high rift levels.
|
||||
|
||||
This works by using Tap Dances. The taps don't actually "do anything". Instead, it sets up the interval for how often to send specific keypresses. As you can tell, this makes automating things very easy.
|
||||
|
||||
For critics that think this is cheating, just search "[diablo 3 num lock auto cast](http://lmgtfy.com/?q=diablo+3+numlock+autocast)". This is just a simpler method, that doesn't require a numpad.
|
||||
|
||||
|
||||
## Custom Tap Dance Type
|
||||
The real fun here is that the tap dances use a custom defined Tap Dance type:
|
||||
|
||||
```c
|
||||
#define ACTION_TAP_DANCE_DIABLO(index, keycode) { \
|
||||
.fn = { NULL, (void *)diablo_tapdance_master, NULL }, \
|
||||
.user_data = (void *)&((diable_keys_t) { index, keycode }), \
|
||||
}
|
||||
```
|
||||
This lets me set an index and keycode for the tap dance. This isn't the cool part yet, but this allows for the really cool stuff.
|
||||
|
||||
The Index is needed because I don't know how to handle it otherwise.
|
||||
|
||||
## The Actual Dances
|
||||
|
||||
These are the custom defined dances that I'm using. It sets up everything for later, using the above custom dance type.
|
||||
|
||||
```c
|
||||
//Tap Dance Definitions, sets the index and the keycode.
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
// tap once to disable, and more to enable timed micros
|
||||
[TD_D3_1] = ACTION_TAP_DANCE_DIABLO(0, KC_1),
|
||||
[TD_D3_2] = ACTION_TAP_DANCE_DIABLO(1, KC_2),
|
||||
[TD_D3_3] = ACTION_TAP_DANCE_DIABLO(2, KC_3),
|
||||
[TD_D3_4] = ACTION_TAP_DANCE_DIABLO(3, KC_4),
|
||||
};
|
||||
```
|
||||
|
||||
## Custom Data Structures
|
||||
|
||||
First, to get this all working, there are a couple of things that need to be set up. In a header file (or you could put it into the keymap), you need to create a couple of custom structures:
|
||||
|
||||
```c
|
||||
typedef struct {
|
||||
uint16_t timer;
|
||||
uint8_t key_interval;
|
||||
uint8_t keycode;
|
||||
} diablo_timer_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t index;
|
||||
uint8_t keycode;
|
||||
} diable_keys_t;
|
||||
```
|
||||
|
||||
The first structure is for tracking each key that is being used. The second is to pass data from the Tap Dance action array to the actual function that we will need.
|
||||
|
||||
|
||||
## Custom Arrays
|
||||
|
||||
To facilitate things, you will need a couple of arrays in your `c` file.
|
||||
|
||||
```c
|
||||
//define diablo macro timer variables
|
||||
diablo_timer_t diablo_timer[4];
|
||||
|
||||
// Set the default intervals. Always start with 0 so that it will disable on first hit.
|
||||
// Otherwise, you will need to hit a bunch of times, or hit the "clear" command
|
||||
uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
|
||||
```
|
||||
|
||||
The first one (`diablo_timer`) is what keeps track of the timer used for the keys, the interval that it uses, and the actual keycode. This makes managing it a lot easier.
|
||||
|
||||
The second array is a list of predefined intervals, in seconds. You can add more here, or remove entries. It doesn't matter how long the array is, as this is computed automatically.
|
||||
|
||||
## The Magic - Part 1: Master function
|
||||
|
||||
The first part of the magic here is the `diablo_tapdance_master` function. The Tap Dance feature calls this function, directly, and passes some data to the function. Namely, it passes the array of the index and the keycode (`diablo_keys_t` from above). This sets the keycode and the interval for the specific index of `diabolo_timer` based on the number of taps. If you hit it more than the number of items in the array, then it zeroes out the interval, disabling it.
|
||||
|
||||
```c
|
||||
// Cycle through the times for the macro, starting at 0, for disabled.
|
||||
void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) {
|
||||
diable_keys_t *diablo_keys = (diable_keys_t *)user_data;
|
||||
// Sets the keycode based on the index
|
||||
diablo_timer[diablo_keys->index].keycode = diablo_keys->keycode;
|
||||
|
||||
// if the tapdance is hit more than the number of elemints in the array, reset
|
||||
if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t) ) ) {
|
||||
diablo_timer[diablo_keys->index].key_interval = 0;
|
||||
reset_tap_dance(state);
|
||||
} else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one)
|
||||
diablo_timer[diablo_keys->index].key_interval = diablo_times[state->count - 1];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## The Magic - Part 2: The Coup de Grace
|
||||
|
||||
The real core here is the `run_diablo_macro_check()` function. You need to call this from `matrix_scan_user`, as this handles the timer check.
|
||||
|
||||
Specifically, it runs a check for each index of the timer. It checks to see if it's enabled, and if enough time has passed. If enough time has passed, it resets the timer, and will tap the keycode that you set for that index, but only if the Diablo layer is enabled.
|
||||
|
||||
```c
|
||||
// Checks each of the 4 timers/keys to see if enough time has elapsed
|
||||
void run_diablo_macro_check(void) {
|
||||
for (uint8_t index = 0; index < NUM_OF_DIABLO_KEYS; index++) {
|
||||
// if key_interval is 0, it's disabled, so only run if it's set. If it's set, check the timer.
|
||||
if ( diablo_timer[index].key_interval && timer_elapsed( diablo_timer[index].timer ) > ( diablo_timer[index].key_interval * 1000 ) ) {
|
||||
// reset the timer, since enough time has passed
|
||||
diablo_timer[index].timer = timer_read();
|
||||
// send keycode ONLY if we're on the diablo layer.
|
||||
if (IS_LAYER_ON(_DIABLO)) {
|
||||
tap_code(diablo_timer[index].keycode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
395
users/freznel/keyrecords/tap_dances.c
Normal file
395
users/freznel/keyrecords/tap_dances.c
Normal file
|
|
@ -0,0 +1,395 @@
|
|||
/*
|
||||
Copyright 2021-2022 Rocco Meli <@RMeli>
|
||||
|
||||
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 "keyrecords/tap_dances.h"
|
||||
#include "./quantum/pointing_device/pointing_device_modes.h"
|
||||
|
||||
// + ---------- +
|
||||
// + TAP DANCES |
|
||||
// + ---------- +
|
||||
|
||||
// Tap dances definitions
|
||||
// Need to needs to be defined in a .c file to avoid a linker error (multiple definitions)
|
||||
tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_LSPO_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, LSPO_CAPS_finished, LSPO_CAPS_reset),
|
||||
[TD_DRG_SNP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, DRG_SNP_finished, DRG_SNP_reset),
|
||||
[TD_DRG_SNP_R] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, DRG_SNP_R_finished, DRG_SNP_R_reset),
|
||||
[TD_PM_MODES] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, PM_MOD1_finished, PM_MOD1_reset),
|
||||
[TD_ESC_DEL] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_DEL),
|
||||
};
|
||||
|
||||
// + ------ +
|
||||
// + DANCES |
|
||||
// + ------ +
|
||||
|
||||
// https://github.com/qmk/qmk_firmware/blob/9294258c02d3e025e01935a06c4d9f1997535bda/users/gordon/gordon.c#L112-L135
|
||||
td_state_t hold_cur_dance(tap_dance_state_t *state) {
|
||||
if (state->count == 1) {
|
||||
if (state->interrupted) {
|
||||
if (!state->pressed)
|
||||
return TD_SINGLE_TAP;
|
||||
else
|
||||
return TD_SINGLE_HOLD;
|
||||
} else {
|
||||
if (!state->pressed)
|
||||
return TD_SINGLE_TAP;
|
||||
else
|
||||
return TD_SINGLE_HOLD;
|
||||
}
|
||||
} else if (state->count == 2) {
|
||||
if (state->interrupted) {
|
||||
if (!state->pressed)
|
||||
return TD_DOUBLE_TAP;
|
||||
else
|
||||
return TD_DOUBLE_HOLD;
|
||||
} else {
|
||||
if (!state->pressed)
|
||||
return TD_DOUBLE_TAP;
|
||||
else
|
||||
return TD_DOUBLE_HOLD;
|
||||
}
|
||||
} else
|
||||
return TD_NONE;
|
||||
}
|
||||
|
||||
// + ------------------------------------------------ +
|
||||
// + LEFT SHIFT PARENTHESIS OPEN (LSPO) AND CAPS LOCK |
|
||||
// + ------------------------------------------------ +
|
||||
|
||||
// Create an instance of 'td_tap_t' for the 'LSPO_CAPS' tap dance.
|
||||
static td_tap_t LSPO_CAPS_state = {.is_press_action = true, .state = TD_NONE};
|
||||
|
||||
void LSPO_CAPS_finished(tap_dance_state_t *state, void *user_data) {
|
||||
LSPO_CAPS_state.state = hold_cur_dance(state);
|
||||
switch (LSPO_CAPS_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
register_code16(KC_LPRN);
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
register_code16(KC_LSFT);
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
register_code16(KC_CAPS);
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
register_code16(KC_CAPS);
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LSPO_CAPS_reset(tap_dance_state_t *state, void *user_data) {
|
||||
switch (LSPO_CAPS_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
unregister_code16(KC_LPRN);
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
unregister_code16(KC_LSFT);
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
unregister_code16(KC_CAPS);
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
unregister_code16(KC_CAPS);
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
LSPO_CAPS_state.state = TD_NONE;
|
||||
}
|
||||
|
||||
|
||||
extern uint8_t rec1;
|
||||
extern uint8_t rec2;
|
||||
|
||||
|
||||
// + -------------------------------------------------- +
|
||||
// + DRAG SCROLL and SNIPING into one button |
|
||||
// + -------------------------------------------------- +
|
||||
|
||||
// Create an instance of 'td_tap_t' for the 'DRG_SNP' tap dance.
|
||||
static td_tap_t DRG_SNP_state = {.is_press_action = true, .state = TD_NONE};
|
||||
|
||||
void DRG_SNP_finished(tap_dance_state_t *state, void *user_data) {
|
||||
DRG_SNP_state.state = hold_cur_dance(state);
|
||||
switch (DRG_SNP_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_dragscroll_enabled(!unichunky_get_pointer_dragscroll_enabled());
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
if (is_keyboard_master()) {
|
||||
set_pointing_mode_device(is_keyboard_left() ? 1 : 0); //set to the peripheral side
|
||||
}
|
||||
toggle_pointing_mode_id(PM_DRAG);
|
||||
#endif
|
||||
break;
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
toggle_pointing_mode_id(PM_DRAG);
|
||||
#endif
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_dragscroll_enabled(1);
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
if (is_keyboard_master()) {
|
||||
set_pointing_mode_device(is_keyboard_left() ? 1 : 0); //set to the peripheral side
|
||||
}
|
||||
set_pointing_mode_id(PM_DRAG);
|
||||
#endif
|
||||
break;
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
set_pointing_mode_id(PM_DRAG);
|
||||
#endif
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_sniping_enabled(!unichunky_get_pointer_sniping_enabled());
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
toggle_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
if (is_keyboard_master()) {
|
||||
set_pointing_mode_device(is_keyboard_left() ? 1 : 0); //set to the peripheral side
|
||||
}
|
||||
toggle_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
if (is_keyboard_master()) {
|
||||
set_pointing_mode_device(is_keyboard_left() ? 1 : 0); //set to the peripheral side
|
||||
}
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DRG_SNP_reset(tap_dance_state_t *state, void *user_data) {
|
||||
switch (DRG_SNP_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_dragscroll_enabled(0);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)
|
||||
if (is_keyboard_master()) {
|
||||
set_pointing_mode_device(is_keyboard_left() ? 1 : 0); //set to the peripheral side
|
||||
}
|
||||
set_pointing_mode_id(PM_NONE);
|
||||
#endif
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_sniping_enabled(0);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)
|
||||
toggle_pointing_mode_id(PM_NONE);
|
||||
#endif
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
DRG_SNP_state.state = TD_NONE;
|
||||
}
|
||||
|
||||
// + -------------------------------------------------- +
|
||||
// + DRAG SCROLL and SNIPING into one button | Right version
|
||||
// + -------------------------------------------------- +
|
||||
|
||||
// Create an instance of 'td_tap_t' for the 'DRG_SNP' tap dance.
|
||||
static td_tap_t DRG_SNP_R_state = {.is_press_action = true, .state = TD_NONE};
|
||||
|
||||
void DRG_SNP_R_finished(tap_dance_state_t *state, void *user_data) {
|
||||
DRG_SNP_R_state.state = hold_cur_dance(state);
|
||||
switch (DRG_SNP_R_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_dragscroll_enabled(!unichunky_get_pointer_dragscroll_enabled());
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
switch (get_pointing_mode_device()) {
|
||||
case PM_RIGHT_DEVICE:
|
||||
set_pointing_mode_device(PM_LEFT_DEVICE);
|
||||
toggle_pointing_mode_id(PM_DRAG);
|
||||
break;
|
||||
case PM_LEFT_DEVICE:
|
||||
toggle_pointing_mode_id(PM_DRAG);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
toggle_pointing_mode_id(PM_DRAG);
|
||||
#endif
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_dragscroll_enabled(1);
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
switch (get_pointing_mode_device()) {
|
||||
case PM_RIGHT_DEVICE:
|
||||
set_pointing_mode_device(PM_LEFT_DEVICE);
|
||||
set_pointing_mode_id(PM_DRAG);
|
||||
break;
|
||||
case PM_LEFT_DEVICE:
|
||||
set_pointing_mode_id(PM_DRAG);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
set_pointing_mode_id(PM_DRAG);
|
||||
#endif
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_sniping_enabled(!unichunky_get_pointer_sniping_enabled());
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
toggle_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
switch (get_pointing_mode_device()) {
|
||||
case PM_RIGHT_DEVICE:
|
||||
set_pointing_mode_device(PM_LEFT_DEVICE);
|
||||
toggle_pointing_mode_id(PM_PRECISION);
|
||||
break;
|
||||
case PM_LEFT_DEVICE:
|
||||
toggle_pointing_mode_id(PM_PRECISION);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
#endif
|
||||
#if (defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)) && defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
switch (get_pointing_mode_device()) {
|
||||
case PM_RIGHT_DEVICE:
|
||||
set_pointing_mode_device(PM_LEFT_DEVICE);
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
break;
|
||||
case PM_LEFT_DEVICE:
|
||||
set_pointing_mode_id(PM_PRECISION);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DRG_SNP_R_reset(tap_dance_state_t *state, void *user_data) {
|
||||
switch (DRG_SNP_R_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_dragscroll_enabled(0);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
set_pointing_mode_id(PM_NONE);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)
|
||||
set_pointing_mode_id(PM_NONE);
|
||||
#endif
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
#if defined(KEYBOARD_unichunky)
|
||||
unichunky_set_pointer_sniping_enabled(0);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerf9) || defined(KEYBOARD_zerfstudios_emblem)
|
||||
toggle_pointing_mode_id(PM_NONE);
|
||||
#endif
|
||||
#if defined(KEYBOARD_zerfstudios) || defined(KEYBOARD_chunkx)
|
||||
toggle_pointing_mode_id(PM_NONE);
|
||||
#endif
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
DRG_SNP_R_state.state = TD_NONE;
|
||||
}
|
||||
|
||||
|
||||
// + -------------------------------------------------- +
|
||||
// BROWSER, CARET in one button |
|
||||
// + -------------------------------------------------- +
|
||||
|
||||
// Create an instance of 'td_tap_t' for the 'DRG_SNP' tap dance.
|
||||
static td_tap_t PM_MOD1_state = {.is_press_action = true, .state = TD_NONE};
|
||||
|
||||
void PM_MOD1_finished(tap_dance_state_t *state, void *user_data) {
|
||||
PM_MOD1_state.state = hold_cur_dance(state);
|
||||
switch (PM_MOD1_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
tap_code16(S(C(KC_TAB)));
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
set_pointing_mode_id(6);
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
toggle_pointing_mode_id(3);
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
set_pointing_mode_id(3);
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PM_MOD1_reset(tap_dance_state_t *state, void *user_data) {
|
||||
switch (PM_MOD1_state.state) {
|
||||
case TD_SINGLE_TAP:
|
||||
break;
|
||||
case TD_SINGLE_HOLD:
|
||||
set_pointing_mode_id(0);
|
||||
break;
|
||||
case TD_DOUBLE_TAP:
|
||||
break;
|
||||
case TD_DOUBLE_HOLD:
|
||||
toggle_pointing_mode_id(PM_NONE);
|
||||
break;
|
||||
case TD_NONE:
|
||||
break;
|
||||
}
|
||||
PM_MOD1_state.state = TD_NONE;
|
||||
}
|
||||
|
||||
82
users/freznel/keyrecords/tap_dances.h
Normal file
82
users/freznel/keyrecords/tap_dances.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
Copyright 2021-2022 Rocco Meli <@RMeli>
|
||||
|
||||
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
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "freznel.h"
|
||||
|
||||
// https://beta.docs.qmk.fm/using-qmk/software-features/feature_tap_dance#example-4-quad-function-tap-dance-id-example-4
|
||||
|
||||
// + ---------- +
|
||||
// + TAP DANCES |
|
||||
// + ---------- +
|
||||
|
||||
// Tap dance enums
|
||||
enum {
|
||||
TD_LSPO_CAPS, // Tap once for (, hold once for LSFT, tap twice for CAPS
|
||||
TD_DRG_SNP, // Tap once for drag scroll (toggle PM Mode 1), hold for drag scroll (momentary activation of PM Mode 1), double tap and hold for sniping (momentary and toggel respectively
|
||||
TD_DRG_SNP_R,
|
||||
TD_PM_MODES, //
|
||||
TD_ESC_DEL, // Tap once for KC_ESC, twice for KC_DEL
|
||||
};
|
||||
|
||||
// Rename tap dances for keymap with shortcuts
|
||||
#define TD_LSPC TD(TD_LSPO_CAPS)
|
||||
#define TD_DRGS TD(TD_DRG_SNP)
|
||||
#define TD_DRGR TD(TD_DRG_SNP_R)
|
||||
#define TD_PMD1 TD(TD_PM_MODES)
|
||||
#define TD_ED TD(TD_ESC_DEL)
|
||||
|
||||
// + ----------- +
|
||||
// + KEY PRESSES |
|
||||
// + ----------- +
|
||||
|
||||
// Different types of key presses
|
||||
typedef enum {
|
||||
TD_NONE,
|
||||
TD_SINGLE_TAP,
|
||||
TD_SINGLE_HOLD,
|
||||
TD_DOUBLE_TAP,
|
||||
TD_DOUBLE_HOLD,
|
||||
} td_state_t;
|
||||
|
||||
// Key press state
|
||||
typedef struct {
|
||||
bool is_press_action;
|
||||
td_state_t state;
|
||||
} td_tap_t;
|
||||
|
||||
// + --------- +
|
||||
// + FUNCTIONS |
|
||||
// + --------- +
|
||||
|
||||
// Tap dance for fast modifiers; favors being held over being tapped.
|
||||
td_state_t hold_cur_dance(tap_dance_state_t *state);
|
||||
|
||||
// Left Shift Parenthesis Open (LSPO) and Caps Lock (CAPS) on DOUBLE_TAP
|
||||
void LSPO_CAPS_finished(tap_dance_state_t *state, void *user_data);
|
||||
void LSPO_CAPS_reset(tap_dance_state_t *state, void *user_data);
|
||||
|
||||
void DRG_SNP_finished(tap_dance_state_t *state, void *user_data);
|
||||
void DRG_SNP_reset(tap_dance_state_t *state, void *user_data);
|
||||
|
||||
void DRG_SNP_R_finished(tap_dance_state_t *state, void *user_data);
|
||||
void DRG_SNP_R_reset(tap_dance_state_t *state, void *user_data);
|
||||
|
||||
void PM_MOD1_finished(tap_dance_state_t *state, void *user_data);
|
||||
void PM_MOD1_reset(tap_dance_state_t *state, void *user_data);
|
||||
|
||||
61
users/freznel/keyrecords/tapping.c
Normal file
61
users/freznel/keyrecords/tapping.c
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
|
||||
#ifdef TAPPING_TERM_PER_KEY
|
||||
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case BK_LWER:
|
||||
return TAPPING_TERM + 25;
|
||||
default:
|
||||
return TAPPING_TERM;
|
||||
}
|
||||
}
|
||||
#endif // TAPPING_TERM_PER_KEY
|
||||
|
||||
#ifdef PERMISSIVE_HOLD_PER_KEY
|
||||
__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
|
||||
// Immediately select the hold action when another key is tapped:
|
||||
// return true;
|
||||
// Do not select the hold action when another key is tapped.
|
||||
// return false;
|
||||
switch (keycode) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif // PERMISSIVE_HOLD_PER_KEY
|
||||
|
||||
#ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
|
||||
__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
|
||||
// Immediately select the hold action when another key is pressed.
|
||||
// return true;
|
||||
// Do not select the hold action when another key is pressed.
|
||||
// return false;
|
||||
switch (keycode) {
|
||||
// case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
|
||||
// return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif // HOLD_ON_OTHER_KEY_PRESS_PER_KEY
|
||||
|
||||
#ifdef QUICK_TAP_TERM_PER_KEY
|
||||
__attribute__((weak)) uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
default:
|
||||
return QUICK_TAP_TERM;
|
||||
}
|
||||
}
|
||||
#endif // QUICK_TAP_TERM_PER_KEY
|
||||
|
||||
#ifdef RETRO_TAPPING_PER_KEY
|
||||
__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif // RETRO_TAPPING_PER_KEY
|
||||
436
users/freznel/keyrecords/unicode.c
Normal file
436
users/freznel/keyrecords/unicode.c
Normal file
|
|
@ -0,0 +1,436 @@
|
|||
// Copyright 2020 @ridingqwerty
|
||||
// Copyright 2020 @tzarc
|
||||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
#include "unicode.h"
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
uint8_t unicode_typing_mode = UCTM_NO_MODE;
|
||||
const char unicode_mode_str[UNCODES_MODE_END][13] PROGMEM = {
|
||||
" Normal\0",
|
||||
" Wide\0",
|
||||
" Script\0",
|
||||
" Blocks\0",
|
||||
" Regional\0",
|
||||
" Aussie\0",
|
||||
" Zalgo\0",
|
||||
"Super Script\0",
|
||||
" Comic\0",
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Registers the unicode keystrokes based on desired unicode
|
||||
*
|
||||
* @param glyph Unicode character, supports up to 0x1FFFF (or higher)
|
||||
*/
|
||||
void tap_unicode_glyph_nomods(uint32_t glyph) {
|
||||
uint8_t temp_mod = get_mods();
|
||||
clear_mods();
|
||||
clear_oneshot_mods();
|
||||
register_unicode(glyph);
|
||||
set_mods(temp_mod);
|
||||
}
|
||||
|
||||
typedef uint32_t (*translator_function_t)(bool is_shifted, uint32_t keycode);
|
||||
|
||||
#define DEFINE_UNICODE_RANGE_TRANSLATOR(translator_name, lower_alpha, upper_alpha, zero_glyph, number_one, space_glyph) \
|
||||
static inline uint32_t translator_name(bool is_shifted, uint32_t keycode) { \
|
||||
switch (keycode) { \
|
||||
case KC_A ... KC_Z: \
|
||||
return (is_shifted ? upper_alpha : lower_alpha) + keycode - KC_A; \
|
||||
case KC_0: \
|
||||
return zero_glyph; \
|
||||
case KC_1 ... KC_9: \
|
||||
return (number_one + keycode - KC_1); \
|
||||
case KC_SPACE: \
|
||||
return space_glyph; \
|
||||
} \
|
||||
return keycode; \
|
||||
}
|
||||
|
||||
#define DEFINE_UNICODE_LUT_TRANSLATOR(translator_name, ...) \
|
||||
static inline uint32_t translator_name(bool is_shifted, uint32_t keycode) { \
|
||||
static const uint32_t translation[] = {__VA_ARGS__}; \
|
||||
uint32_t ret = keycode; \
|
||||
if ((keycode - KC_A) < ARRAY_SIZE(translation)) { \
|
||||
ret = translation[keycode - KC_A]; \
|
||||
} \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handler function for outputting unicode.
|
||||
*
|
||||
* @param keycode Keycode from matrix.
|
||||
* @param record keyrecord_t data structure
|
||||
* @param translator translator lut for different unicode modes
|
||||
* @return true Continue processing matrix press, and send to host
|
||||
* @return false Replace keycode, and do not send to host
|
||||
*/
|
||||
bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, translator_function_t translator) {
|
||||
uint8_t temp_mod = get_mods();
|
||||
uint8_t temp_osm = get_oneshot_mods();
|
||||
bool is_shifted = (temp_mod | temp_osm) & MOD_MASK_SHIFT;
|
||||
if (((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI)) == 0) {
|
||||
if (KC_A <= keycode && keycode <= KC_Z) {
|
||||
if (record->event.pressed) {
|
||||
tap_unicode_glyph_nomods(translator(is_shifted, keycode));
|
||||
}
|
||||
return false;
|
||||
} else if (KC_1 <= keycode && keycode <= KC_0) {
|
||||
if (is_shifted) { // skip shifted numbers, so that we can still use symbols etc.
|
||||
return process_record_keymap(keycode, record);
|
||||
}
|
||||
if (record->event.pressed) {
|
||||
register_unicode(translator(is_shifted, keycode));
|
||||
}
|
||||
return false;
|
||||
} else if (keycode == KC_SPACE) {
|
||||
if (record->event.pressed) {
|
||||
register_unicode(translator(is_shifted, keycode));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_wide, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003);
|
||||
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_script, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7C1, 0x2002);
|
||||
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_boxes, 0x1F170, 0x1F170, '0', '1', 0x2002);
|
||||
DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_regional, 0x1F1E6, 0x1F1E6, '0', '1', 0x2003);
|
||||
|
||||
// DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_normal,
|
||||
// 'a', // a
|
||||
// 'b', // b
|
||||
// 'c', // c
|
||||
// 'd', // d
|
||||
// 'e', // e
|
||||
// 'f', // f
|
||||
// 'g', // g
|
||||
// 'h', // h
|
||||
// 'i', // i
|
||||
// 'j', // j
|
||||
// 'k', // k
|
||||
// 'l', // l
|
||||
// 'm', // m
|
||||
// 'n', // n
|
||||
// 'o', // o
|
||||
// 'p', // p
|
||||
// 'q', // q
|
||||
// 'r', // r
|
||||
// 's', // s
|
||||
// 't', // t
|
||||
// 'u', // u
|
||||
// 'v', // v
|
||||
// 'w', // w
|
||||
// 'x', // x
|
||||
// 'y', // y
|
||||
// 'z', // z
|
||||
// '1', // 1
|
||||
// '2', // 2
|
||||
// '3', // 3
|
||||
// '4', // 4
|
||||
// '5', // 5
|
||||
// '6', // 6
|
||||
// '7', // 7
|
||||
// '8', // 8
|
||||
// '9', // 9
|
||||
// '0' // 0
|
||||
// );
|
||||
|
||||
DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_aussie,
|
||||
0x0250, // a
|
||||
'q', // b
|
||||
0x0254, // c
|
||||
'p', // d
|
||||
0x01DD, // e
|
||||
0x025F, // f
|
||||
0x0183, // g
|
||||
0x0265, // h
|
||||
0x1D09, // i
|
||||
0x027E, // j
|
||||
0x029E, // k
|
||||
'l', // l
|
||||
0x026F, // m
|
||||
'u', // n
|
||||
'o', // o
|
||||
'd', // p
|
||||
'b', // q
|
||||
0x0279, // r
|
||||
's', // s
|
||||
0x0287, // t
|
||||
'n', // u
|
||||
0x028C, // v
|
||||
0x028D, // w
|
||||
0x2717, // x
|
||||
0x028E, // y
|
||||
'z', // z
|
||||
0x0269, // 1
|
||||
0x3139, // 2
|
||||
0x0190, // 3
|
||||
0x3123, // 4
|
||||
0x03DB, // 5
|
||||
'9', // 6
|
||||
0x3125, // 7
|
||||
'8', // 8
|
||||
'6', // 9
|
||||
'0' // 0
|
||||
);
|
||||
|
||||
DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_super,
|
||||
0x1D43, // a
|
||||
0x1D47, // b
|
||||
0x1D9C, // c
|
||||
0x1D48, // d
|
||||
0x1D49, // e
|
||||
0x1DA0, // f
|
||||
0x1D4D, // g
|
||||
0x02B0, // h
|
||||
0x2071, // i
|
||||
0x02B2, // j
|
||||
0x1D4F, // k
|
||||
0x02E1, // l
|
||||
0x1D50, // m
|
||||
0x207F, // n
|
||||
0x1D52, // o
|
||||
0x1D56, // p
|
||||
0x06F9, // q
|
||||
0x02B3, // r
|
||||
0x02E2, // s
|
||||
0x1D57, // t
|
||||
0x1D58, // u
|
||||
0x1D5B, // v
|
||||
0x02B7, // w
|
||||
0x02E3, // x
|
||||
0x02B8, // y
|
||||
0x1DBB, // z
|
||||
0x00B9, // 1
|
||||
0x00B2, // 2
|
||||
0x00B3, // 3
|
||||
0x2074, // 4
|
||||
0x2075, // 5
|
||||
0x2076, // 6
|
||||
0x2077, // 7
|
||||
0x2078, // 8
|
||||
0x2079, // 9
|
||||
0x2070 // 0
|
||||
);
|
||||
|
||||
DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_comic,
|
||||
0x212B, // a
|
||||
0x212C, // b
|
||||
0x2102, // c
|
||||
0x2145, // d
|
||||
0x2107, // e
|
||||
0x2132, // f
|
||||
0x2141, // g
|
||||
0x210D, // h
|
||||
0x2148, // i
|
||||
0x2111, // j
|
||||
'k', // k
|
||||
0x2143, // l
|
||||
'm', // m
|
||||
0x2115, // n
|
||||
0x2134, // o
|
||||
0x2119, // p
|
||||
0x211A, // q
|
||||
0x211B, // r
|
||||
0x20B7, // s
|
||||
0x20B8, // t
|
||||
0x2127, // u
|
||||
'v', // v
|
||||
0x20A9, // w
|
||||
'x', // x
|
||||
0x213D, // y
|
||||
'z', // z
|
||||
'1', // 1
|
||||
'2', // 2
|
||||
'3', // 3
|
||||
'4', // 4
|
||||
'5', // 5
|
||||
'6', // 6
|
||||
'7', // 7
|
||||
'8', // 8
|
||||
'9', // 9
|
||||
'0' // 0
|
||||
);
|
||||
|
||||
bool process_record_aussie(uint16_t keycode, keyrecord_t *record) {
|
||||
bool is_shifted = (get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT;
|
||||
if ((KC_A <= keycode) && (keycode <= KC_0)) {
|
||||
if (record->event.pressed) {
|
||||
if (!process_record_glyph_replacement(keycode, record, unicode_lut_translator_aussie)) {
|
||||
tap_code16_nomods(KC_LEFT);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (record->event.pressed && keycode == KC_SPACE) {
|
||||
tap_code16_nomods(KC_SPACE);
|
||||
tap_code16_nomods(KC_LEFT);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_ENTER) {
|
||||
tap_code16_nomods(KC_END);
|
||||
tap_code16_nomods(KC_ENTER);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_HOME) {
|
||||
tap_code16_nomods(KC_END);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_END) {
|
||||
tap_code16_nomods(KC_HOME);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_BSPC) {
|
||||
tap_code16_nomods(KC_DEL);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_DEL) {
|
||||
tap_code16_nomods(KC_BSPC);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_QUOT) {
|
||||
tap_unicode_glyph_nomods(is_shifted ? 0x201E : 0x201A);
|
||||
tap_code16_nomods(KC_LEFT);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_COMMA) {
|
||||
tap_unicode_glyph_nomods(is_shifted ? '<' : 0x2018);
|
||||
tap_code16_nomods(KC_LEFT);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_DOT) {
|
||||
tap_unicode_glyph_nomods(is_shifted ? '>' : 0x02D9);
|
||||
tap_code16_nomods(KC_LEFT);
|
||||
return false;
|
||||
} else if (record->event.pressed && keycode == KC_SLASH) {
|
||||
tap_unicode_glyph_nomods(is_shifted ? 0x00BF : '/');
|
||||
tap_code16_nomods(KC_LEFT);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_record_zalgo(uint16_t keycode, keyrecord_t *record) {
|
||||
if ((KC_A <= keycode) && (keycode <= KC_0)) {
|
||||
if (record->event.pressed) {
|
||||
tap_code16_nomods(keycode);
|
||||
|
||||
int number = (rand() % (8 + 1 - 2)) + 2;
|
||||
for (int index = 0; index < number; index++) {
|
||||
uint16_t hex = (rand() % (0x036F + 1 - 0x0300)) + 0x0300;
|
||||
register_unicode(hex);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main handler for unicode input
|
||||
*
|
||||
* @param keycode Keycode from switch matrix
|
||||
* @param record keyrecord_t data struture
|
||||
* @return true Send keycode from matrix to host
|
||||
* @return false Stop processing and do not send to host
|
||||
*/
|
||||
|
||||
bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
|
||||
if (record->event.pressed) {
|
||||
send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
|
||||
}
|
||||
break;
|
||||
|
||||
case UC_TABL: // ┬─┬ノ( º _ ºノ)
|
||||
if (record->event.pressed) {
|
||||
send_unicode_string("┬─┬ノ( º _ ºノ)");
|
||||
}
|
||||
break;
|
||||
|
||||
case UC_SHRG: // ¯\_(ツ)_/¯
|
||||
if (record->event.pressed) {
|
||||
send_unicode_string("¯\\_(ツ)_/¯");
|
||||
}
|
||||
break;
|
||||
|
||||
case UC_DISA: // ಠ_ಠ
|
||||
if (record->event.pressed) {
|
||||
send_unicode_string("ಠ_ಠ");
|
||||
}
|
||||
break;
|
||||
|
||||
case UC_IRNY: // ⸮
|
||||
if (record->event.pressed) {
|
||||
register_unicode(0x2E2E);
|
||||
}
|
||||
break;
|
||||
case UC_CLUE: // ‽
|
||||
if (record->event.pressed) {
|
||||
register_unicode(0x203D);
|
||||
}
|
||||
break;
|
||||
case KC_NOMODE ... KC_COMIC:
|
||||
if (record->event.pressed) {
|
||||
if (unicode_typing_mode != keycode - KC_NOMODE) {
|
||||
unicode_typing_mode = keycode - KC_NOMODE;
|
||||
} else {
|
||||
unicode_typing_mode = UCTM_NO_MODE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (((get_mods() | get_oneshot_mods()) & ~MOD_MASK_SHIFT) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IS_QK_MOD_TAP(keycode) && record->tap.count) {
|
||||
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
|
||||
}
|
||||
if (IS_QK_LAYER_TAP(keycode) && record->tap.count) {
|
||||
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
|
||||
}
|
||||
|
||||
if (unicode_typing_mode == UCTM_WIDE) {
|
||||
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
|
||||
return process_record_glyph_replacement(keycode, record, unicode_range_translator_wide);
|
||||
}
|
||||
} else if (unicode_typing_mode == UCTM_SCRIPT) {
|
||||
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
|
||||
return process_record_glyph_replacement(keycode, record, unicode_range_translator_script);
|
||||
}
|
||||
} else if (unicode_typing_mode == UCTM_BLOCKS) {
|
||||
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
|
||||
return process_record_glyph_replacement(keycode, record, unicode_range_translator_boxes);
|
||||
}
|
||||
} else if (unicode_typing_mode == UCTM_REGIONAL) {
|
||||
if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) {
|
||||
if (!process_record_glyph_replacement(keycode, record, unicode_range_translator_regional)) {
|
||||
wait_us(500);
|
||||
tap_unicode_glyph_nomods(0x200C);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (unicode_typing_mode == UCTM_SUPER) {
|
||||
if (((KC_A <= keycode) && (keycode <= KC_0))) {
|
||||
return process_record_glyph_replacement(keycode, record, unicode_lut_translator_super);
|
||||
}
|
||||
} else if (unicode_typing_mode == UCTM_COMIC) {
|
||||
if (((KC_A <= keycode) && (keycode <= KC_0))) {
|
||||
return process_record_glyph_replacement(keycode, record, unicode_lut_translator_comic);
|
||||
}
|
||||
} else if (unicode_typing_mode == UCTM_AUSSIE) {
|
||||
return process_record_aussie(keycode, record);
|
||||
} else if (unicode_typing_mode == UCTM_ZALGO) {
|
||||
return process_record_zalgo(keycode, record);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the default unicode mode on firmware startup
|
||||
*
|
||||
*/
|
||||
void keyboard_post_init_unicode(void) {
|
||||
unicode_input_mode_init();
|
||||
}
|
||||
22
users/freznel/keyrecords/unicode.h
Normal file
22
users/freznel/keyrecords/unicode.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
enum unicode_typing_modes {
|
||||
UCTM_NO_MODE,
|
||||
UCTM_WIDE,
|
||||
UCTM_SCRIPT,
|
||||
UCTM_BLOCKS,
|
||||
UCTM_REGIONAL,
|
||||
UCTM_AUSSIE,
|
||||
UCTM_ZALGO,
|
||||
UCTM_SUPER,
|
||||
UCTM_COMIC,
|
||||
UNCODES_MODE_END,
|
||||
};
|
||||
|
||||
extern uint8_t unicode_typing_mode;
|
||||
extern const PROGMEM char unicode_mode_str[UNCODES_MODE_END][13];
|
||||
|
||||
|
||||
294
users/freznel/keyrecords/wrappers.h
Normal file
294
users/freznel/keyrecords/wrappers.h
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2020 @jola5
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include "freznel.h"
|
||||
/*
|
||||
Since our quirky block definitions are basically a list of comma separated
|
||||
arguments, we need a wrapper in order for these definitions to be
|
||||
expanded before being used as arguments to the LAYOUT_xxx macro.
|
||||
*/
|
||||
|
||||
/*
|
||||
Blocks for each of the four major keyboard layouts
|
||||
Organized so we can quickly adapt and modify all of them
|
||||
at once, rather than for each keyboard, one at a time.
|
||||
And this allows for much cleaner blocks in the keymaps.
|
||||
For instance Tap/Hold for Control on all of the layouts
|
||||
|
||||
NOTE: These are all the same length. If you do a search/replace
|
||||
then you need to add/remove underscores to keep the
|
||||
lengths consistent.
|
||||
*/
|
||||
// clang-format off
|
||||
#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
|
||||
#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
|
||||
#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define _________________GAMING_L0_________________ KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,KC_R
|
||||
#define _________________GAMING_L1_________________ KC_TAB, KC_Q, KC_W, KC_E, KC_R
|
||||
#define _________________GAMING_L2_________________ KC_LSFT, KC_A, KC_S, KC_D, KC_F
|
||||
#define _________________GAMING_L3_________________ KC_LCTL, KC_Z, KC_X, KC_C, KC_V
|
||||
|
||||
#define _________________GAMING_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
|
||||
#define _________________GAMING_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
|
||||
#define _________________GAMING_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
|
||||
#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT
|
||||
#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G
|
||||
#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D
|
||||
#define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
|
||||
#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT
|
||||
#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
#define ______________COLEMAK_MOD_DH_L1____________ KC_Q, KC_W, KC_F, KC_P, KC_B
|
||||
#define ______________COLEMAK_MOD_DH_L2____________ KC_A, KC_R, KC_S, KC_T, KC_G
|
||||
#define ______________COLEMAK_MOD_DH_L3____________ KC_Z, KC_X, KC_C, KC_D, KC_V
|
||||
|
||||
#define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
|
||||
#define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT
|
||||
#define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, KC_SLASH
|
||||
|
||||
|
||||
#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
|
||||
#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I
|
||||
#define _________________DVORAK_L3_________________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X
|
||||
|
||||
#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L
|
||||
#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH
|
||||
#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, KC_Z
|
||||
|
||||
|
||||
#define ________________DVORAK_AU_L1_______________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
|
||||
#define ________________DVORAK_AU_L2_______________ KC_O, KC_A, KC_E, KC_I, KC_U
|
||||
#define ________________DVORAK_AU_L3_______________ KC_SCLN, KC_Q, KC_J, KC_K, KC_X
|
||||
|
||||
#define ________________DVORAK_AU_R1_______________ KC_F, KC_G, KC_C, KC_R, KC_L
|
||||
#define ________________DVORAK_AU_R2_______________ KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH
|
||||
#define ________________DVORAK_AU_R3_______________ KC_B, KC_M, KC_W, KC_V, KC_Z
|
||||
|
||||
#define _________________WORKMAN_L1________________ KC_Q, KC_D, KC_R, KC_W, KC_B
|
||||
#define _________________WORKMAN_L2________________ KC_A, KC_S, KC_H, KC_T, KC_G
|
||||
#define _________________WORKMAN_L3________________ KC_Z, KC_X, KC_M, KC_C, KC_V
|
||||
|
||||
#define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN
|
||||
#define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT
|
||||
#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K
|
||||
#define _________________NORMAN_L2_________________ KC_A, KC_S, KC_E, KC_T, KC_G
|
||||
#define _________________NORMAN_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN
|
||||
#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U, KC_QUOT
|
||||
#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define _________________MALTRON_L1________________ KC_Q, KC_P, KC_Y, KC_C, KC_B
|
||||
#define _________________MALTRON_L2________________ KC_A, KC_N, KC_I, KC_S, KC_F
|
||||
#define _________________MALTRON_L3________________ KC_SCLN, KC_SLSH, KC_J, KC_G, KC_COMM
|
||||
|
||||
#define _________________MALTRON_R1________________ KC_V, KC_M, KC_U, KC_Z, KC_L
|
||||
#define _________________MALTRON_R2________________ KC_D, KC_T, KC_D, KC_O, KC_R, KC_QUOT
|
||||
#define _________________MALTRON_R3________________ KC_DOT, KC_W, KC_K, KC_MINS, KC_X
|
||||
|
||||
|
||||
#define _________________EUCALYN_L1________________ KC_Q, KC_W, KC_COMM, KC_DOT, KC_SCLN
|
||||
#define _________________EUCALYN_L2________________ KC_A, KC_O, KC_E, KC_I, KC_U
|
||||
#define _________________EUCALYN_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_F
|
||||
|
||||
#define _________________EUCALYN_R1________________ KC_M, KC_R, KC_D, KC_Y, KC_P
|
||||
#define _________________EUCALYN_R2________________ KC_G, KC_T, KC_K, KC_S, KC_N, KC_QUOT
|
||||
#define _________________EUCALYN_R3________________ KC_B, KC_H, KC_J, KC_L, KC_SLSH
|
||||
|
||||
// Qwerty-like
|
||||
#define _____________CARPLAX_QFMLWY_L1_____________ KC_Q, KC_F, KC_M, KC_L, KC_W
|
||||
#define _____________CARPLAX_QFMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
|
||||
#define _____________CARPLAX_QFMLWY_L3_____________ KC_Z, KC_V, KC_G, KC_C, KC_X
|
||||
|
||||
#define _____________CARPLAX_QFMLWY_R1_____________ KC_Y, KC_U, KC_O, KC_B, KC_J
|
||||
#define _____________CARPLAX_QFMLWY_R2_____________ KC_I, KC_A, KC_E, KC_H, KC_SCLN, KC_QUOT
|
||||
#define _____________CARPLAX_QFMLWY_R3_____________ KC_P, KC_K, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
// Colemak like
|
||||
#define _____________CARPLAX_QGMLWB_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W
|
||||
#define _____________CARPLAX_QGMLWB_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
|
||||
#define _____________CARPLAX_QGMLWB_L3_____________ KC_Z, KC_X, KC_C, KC_F, KC_J
|
||||
|
||||
#define _____________CARPLAX_QGMLWB_R1_____________ KC_B, KC_Y, KC_U, KC_V, KC_SCLN
|
||||
#define _____________CARPLAX_QGMLWB_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H, KC_QUOT
|
||||
#define _____________CARPLAX_QGMLWB_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
// colemak like, zxcv fixed
|
||||
#define _____________CARPLAX_QGMLWY_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W
|
||||
#define _____________CARPLAX_QGMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
|
||||
#define _____________CARPLAX_QGMLWY_L3_____________ KC_Z, KC_X, KC_C, KC_V, KC_J
|
||||
|
||||
#define _____________CARPLAX_QGMLWY_R1_____________ KC_Y, KC_F, KC_U, KC_B, KC_SCLN
|
||||
#define _____________CARPLAX_QGMLWY_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H, KC_QUOT
|
||||
#define _____________CARPLAX_QGMLWY_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
// teeheehee
|
||||
#define _____________CARPLAX_TNWCLR_L1_____________ KC_T, KC_N, KC_W, KC_C, KC_L
|
||||
#define _____________CARPLAX_TNWCLR_L2_____________ KC_S, KC_K, KC_J, KC_X, KC_G
|
||||
#define _____________CARPLAX_TNWCLR_L3_____________ KC_E, KC_O, KC_D, KC_I, KC_A
|
||||
|
||||
#define _____________CARPLAX_TNWCLR_R1_____________ KC_R, KC_B, KC_F, KC_M, KC_H
|
||||
#define _____________CARPLAX_TNWCLR_R2_____________ KC_P, KC_Q, KC_Z, KC_V, KC_SCLN, KC_QUOT
|
||||
#define _____________CARPLAX_TNWCLR_R3_____________ KC_U, KC_Y, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define _________________WHITE_R1__________________ KC_V, KC_Y, KC_D, KC_COMM, KC_QUOT
|
||||
#define _________________WHITE_R2__________________ KC_A, KC_T, KC_H, KC_E, KC_B
|
||||
#define _________________WHITE_R3__________________ KC_P, KC_K, KC_G, KC_W, KC_Q
|
||||
|
||||
#define _________________WHITE_L1__________________ KC_INT1, KC_J, KC_M, KC_L, KC_U
|
||||
#define _________________WHITE_L2__________________ KC_MINS, KC_C, KC_S, KC_N, KC_O, KC_I
|
||||
#define _________________WHITE_L3__________________ KC_X, KC_R, KC_F, KC_DOT, KC_Z
|
||||
|
||||
|
||||
#define _________________HALMAK_L1_________________ KC_W, KC_L, KC_R, KC_B, KC_Z
|
||||
#define _________________HALMAK_L2_________________ KC_S, KC_H, KC_N, KC_T, KC_COMM
|
||||
#define _________________HALMAK_L3_________________ KC_F, KC_M, KC_V, KC_V, KC_SLASH
|
||||
|
||||
#define _________________HALMAK_R1_________________ KC_SCLN, KC_Q, KC_U, KC_D, KC_J
|
||||
#define _________________HALMAK_R2_________________ KC_DOT, KC_A, KC_E, KC_O, KC_I, KC_QUOTE
|
||||
#define _________________HALMAK_R3_________________ KC_G, KC_P, KC_X, KC_K, KC_Y
|
||||
|
||||
|
||||
#define __________________ISRT_L1__________________ KC_W, KC_C, KC_L, KC_M, KC_K
|
||||
#define __________________ISRT_L2__________________ KC_I, KC_S, KC_R, KC_T, KC_G
|
||||
#define __________________ISRT_L3__________________ KC_Q, KC_V, KC_W, KC_D, KC_J
|
||||
|
||||
#define __________________ISRT_R1__________________ KC_Z, KC_F, KC_U, KC_COMM, KC_QUOTE
|
||||
#define __________________ISRT_R2__________________ KC_P, KC_N, KC_E, KC_A, KC_O, KC_SCLN
|
||||
#define __________________ISRT_R3__________________ KC_B, KC_H, KC_SLSH, KC_DOT, KC_X
|
||||
|
||||
|
||||
#define __________________SOUL_L1__________________ KC_Q, KC_W, KC_L, KC_D, KC_P
|
||||
#define __________________SOUL_L2__________________ KC_A, KC_S, KC_R, KC_T, KC_G
|
||||
#define __________________SOUL_L3__________________ KC_Z, KC_X, KC_C, KC_V, KC_J
|
||||
|
||||
#define __________________SOUL_R1__________________ KC_K, KC_M, KC_U, KC_Y, KC_SCLN
|
||||
#define __________________SOUL_R2__________________ KC_F, KC_N, KC_E, KC_I, KC_O, KC_QUOTE
|
||||
#define __________________SOUL_R3__________________ KC_B, KC_H, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define __________________NIRO_L1__________________ KC_Q, KC_W, KC_U, KC_D, KC_P
|
||||
#define __________________NIRO_L2__________________ KC_A, KC_S, KC_E, KC_T, KC_G
|
||||
#define __________________NIRO_L3__________________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define __________________NIRO_R1__________________ KC_J, KC_F, KC_Y, KC_L, KC_SCLN
|
||||
#define __________________NIRO_R2__________________ KC_H, KC_N, KC_I, KC_R, KC_O, KC_QUOTE
|
||||
#define __________________NIRO_R3__________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define _________________ASSET_L1__________________ KC_Q, KC_W, KC_J, KC_F, KC_G
|
||||
#define _________________ASSET_L2__________________ KC_A, KC_S, KC_E, KC_T, KC_D
|
||||
#define _________________ASSET_L3__________________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define _________________ASSET_R1__________________ KC_Y, KC_P, KC_U, KC_L, KC_SCLN
|
||||
#define _________________ASSET_R2__________________ KC_H, KC_N, KC_I, KC_O, KC_R, KC_QUOTE
|
||||
#define _________________ASSET_R3__________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
|
||||
#define _________________MTGAP_L1__________________ KC_Y, KC_P, KC_O, KC_U, KC_J
|
||||
#define _________________MTGAP_L2__________________ KC_I, KC_N, KC_E, KC_A, KC_COMM
|
||||
#define _________________MTGAP_L3__________________ KC_Q, KC_Z, KC_SLSH, KC_DOT, KC_SCLN
|
||||
|
||||
#define _________________MTGAP_R1__________________ KC_K, KC_D, KC_L, KC_C, KC_W
|
||||
#define _________________MTGAP_R2__________________ KC_M, KC_H, KC_T, KC_S, KC_R, KC_QUOTE
|
||||
#define _________________MTGAP_R3__________________ KC_B, KC_F, KC_G, KC_V, KC_X
|
||||
|
||||
#define _________________MINIMAK_L1________________ KC_Q, KC_W, KC_D, KC_R, KC_K
|
||||
#define _________________MINIMAK_L2________________ KC_A, KC_S, KC_T, KC_F, KC_G
|
||||
#define _________________MINIMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define _________________MINIMAK_R1________________ KC_Y, KC_U, KC_I, KC_O, KC_P
|
||||
#define _________________MINIMAK_R2________________ KC_H, KC_J, KC_E, KC_L, KC_SCLN, KC_QUOT
|
||||
#define _________________MINIMAK_R3________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
#define ________________MINIMAK_8_L1_______________ KC_Q, KC_W, KC_D, KC_R, KC_K
|
||||
#define ________________MINIMAK_8_L2_______________ KC_A, KC_S, KC_T, KC_F, KC_G
|
||||
#define ________________MINIMAK_8_L3_______________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define ________________MINIMAK_8_R1_______________ KC_Y, KC_U, KC_I, KC_L, KC_P
|
||||
#define ________________MINIMAK_8_R2_______________ KC_H, KC_N, KC_E, KC_O, KC_SCLN, KC_QUOT
|
||||
#define ________________MINIMAK_8_R3_______________ KC_J, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
#define _______________MINIMAK_12_L1_______________ KC_Q, KC_W, KC_D, KC_F, KC_K
|
||||
#define _______________MINIMAK_12_L2_______________ KC_A, KC_S, KC_T, KC_R, KC_G
|
||||
#define _______________MINIMAK_12_L3_______________ KC_Z, KC_X, KC_C, KC_V, KC_B
|
||||
|
||||
#define _______________MINIMAK_12_R1_______________ KC_Y, KC_U, KC_I, KC_L, KC_SCLN
|
||||
#define _______________MINIMAK_12_R2_______________ KC_H, KC_N, KC_E, KC_O, KC_P, KC_QUOT
|
||||
#define _______________MINIMAK_12_R3_______________ KC_J, KC_M, KC_COMM, KC_DOT, KC_SLSH
|
||||
|
||||
#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
|
||||
#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0
|
||||
#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
|
||||
#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
|
||||
|
||||
#define ________________NUMPAD1_LEFT_______________ KC_PAST, KC_P7, KC_P8, KC_P9, KC_PPLS
|
||||
#define ________________NUMPAD2_LEFT_______________ KC_PSLS, KC_P4, KC_P5, KC_P6, KC_PMNS
|
||||
#define ________________NUMPAD3_LEFT_______________ KC_P0, KC_P1, KC_P2, KC_P3, KC_PDOT
|
||||
#define ___________________BLANK___________________ _______, _______, _______, _______, _______
|
||||
|
||||
#define ________________NUMPAD1_RIGHT______________ KC_PAST, KC_P7, KC_P8, KC_P9, KC_PPLS
|
||||
#define ________________NUMPAD2_RIGHT______________ KC_ENT, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI
|
||||
#define ________________NUMPAD3_RIGHT______________ KC_P0, KC_P1, KC_P2, KC_P3, KC_PDOT
|
||||
|
||||
#define _________________FUNCA_LEFT________________ A(KC_F1), A(KC_F2), A(KC_F3), A(KC_F4), A(KC_F5)
|
||||
#define _________________FUNCA_RIGHT_______________ A(KC_F6), A(KC_F7), A(KC_F8), A(KC_F9), A(KC_F10)
|
||||
|
||||
#define _________________LOWER_L1__________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC
|
||||
#define _________________LOWER_L2__________________ C_L, CS_L, CS_R, C_R, C(KC_W)
|
||||
#define _________________LOWER_L3__________________ G(KC_LEFT), G(KC_DOWN), G(KC_UP), G(KC_RGHT), A(KC_F4)
|
||||
|
||||
#define _________________LOWER_R1__________________ _______, C_L, CS_L, CS_R, C_R
|
||||
#define _________________LOWER_R2__________________ _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
|
||||
#define _________________LOWER_R3__________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR
|
||||
|
||||
#define _________________LOWER_R2_ALT______________ _______, C_L, CS_L, CS_R, C_R
|
||||
#define _________________LOWER_R1_ALT______________ _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
|
||||
#define _________________LOWER_R3__________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR
|
||||
|
||||
#define _________________RAISE_L1__________________ KC_CIRC, KC_AT, KC_EXLM, KC_QUES, KC_PERC
|
||||
#define _________________RAISE_L2__________________ LGUI_T(KC_GRAVE), LALT_T(KC_MINUS), KC_PLUS, LSFT_T(KC_EQUAL), KC_UNDS
|
||||
#define _________________RAISE_L3__________________ KC_LCBR, KC_LBRC, KC_NUHS, KC_RBRC, KC_RCBR
|
||||
|
||||
#define _________________RAISE_R1__________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN
|
||||
#define _________________RAISE_R2__________________ KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
||||
#define _________________RAISE_R3__________________ SELWORD, KC_WWW_BACK, KC_PGDN, KC_PGUP, KC_END
|
||||
|
||||
#define _________________EXTEND_R1_________________ KC_PGUP, KC_HOME, KC_INS, KC_END, KC_PRINT_SCREEN
|
||||
#define _________________EXTEND_R2_________________ KC_PGDN, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
||||
#define _________________EXTEND_R3_________________ SELWORD, KC_HOME, KC_PGDN, KC_PGUP, KC_END
|
||||
|
||||
#define _________________UNICO_L1__________________ KC_WIDE, KC_SCRIPT, KC_BLOCKS, KC_REGIONAL, KC_AUSSIE
|
||||
#define _________________UNICO_R1__________________ KC_ZALGO, KC_SUPER, KC_COMIC, KC_NOMODE, UC(0x2763)
|
||||
|
||||
#define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_IDL
|
||||
#define _________________ADJUST_L2_________________ MU_TOGG , CK_TOGG, AU_ON, AU_OFF, CG_NORM
|
||||
#define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T
|
||||
|
||||
#define _________________ADJUST_R1_________________ HF_TOGG, HF_BUZZ, HF_FDBK, HF_PREV, HF_NEXT
|
||||
#define _________________ADJUST_R2_________________ CG_SWAP, DEFLYR1, DEFLYR2, DEFLYR3, DEFLYR4
|
||||
#define _________________ADJUST_R3_________________ HF_RST, KC_MUTE, KC_VOLD, HF_CONT, HF_CONU
|
||||
|
||||
#define ______________COLEMAK_MOD_DH_Q1____________ KC_Q, KC_W, KC_F, KC_P, KC_B
|
||||
#define ______________COLEMAK_MOD_DH_Q2____________ LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G
|
||||
#define ______________COLEMAK_MOD_DH_Q3____________ LCTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V
|
||||
|
||||
#define ______________COLEMAK_MOD_DH_W1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
|
||||
#define ______________COLEMAK_MOD_DH_W2____________ KC_M, RSFT_T(KC_N), RCTL_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), KC_QUOT
|
||||
#define ______________COLEMAK_MOD_DH_W3____________ KC_K, KC_H, KC_COMM, KC_DOT, RCTL_T(KC_SLASH)
|
||||
// clang-format on
|
||||
1472
users/freznel/oled/freznel_font.h
Normal file
1472
users/freznel/oled/freznel_font.h
Normal file
File diff suppressed because it is too large
Load diff
990
users/freznel/oled/oled_stuff.c
Normal file
990
users/freznel/oled/oled_stuff.c
Normal file
|
|
@ -0,0 +1,990 @@
|
|||
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
* Copyright 2021 John Ezra - wpm graph
|
||||
* Copyright 2022 IFreznel B. Sta. Ana - (@freznel10)
|
||||
*
|
||||
* 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 "freznel.h"
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
# include "process_unicode_common.h"
|
||||
# include "keyrecords/unicode.h"
|
||||
#endif
|
||||
#ifdef AUDIO_CLICKY
|
||||
# include "process_clicky.h"
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
bool is_oled_enabled = true;
|
||||
|
||||
extern bool host_driver_disabled;
|
||||
|
||||
uint32_t oled_timer = 0;
|
||||
char keylog_str[OLED_KEYLOGGER_LENGTH] = {0};
|
||||
static uint16_t log_timer = 0;
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0};
|
||||
#endif
|
||||
|
||||
deferred_token kittoken;
|
||||
|
||||
// clang-format off
|
||||
static const char PROGMEM code_to_name[256] = {
|
||||
// 0 1 2 3 4 5 6 7 8 9 A B c D E F
|
||||
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x
|
||||
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x
|
||||
'3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x
|
||||
']','\\', '#', ';','\'', '`', ',', '.', '/', 128,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA, // 3x
|
||||
0xDB,0xDC,0xDD,0xDE,0XDF,0xFB,'P', 'S', 19, ' ', 17, 30, 16, 16, 31, 26, // 4x
|
||||
27, 25, 24, 'N', '/', '*', '-', '+', 23, '1', '2', '3', '4', '5', '6', '7', // 5x
|
||||
'8', '9', '0', '.','\\', 'A', 0, '=', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x
|
||||
' ', ' ', ' ', ' ', ' ', 0, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx
|
||||
'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 24, 26, 24, // Ex
|
||||
25,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D,0x9D, 24, 25, 27, 26, ' ', ' ', ' ' // Fx
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
/**
|
||||
* @brief parses pressed keycodes and saves to buffer
|
||||
*
|
||||
* @param keycode Keycode pressed from switch matrix
|
||||
* @param record keyrecord_t data structure
|
||||
*/
|
||||
void add_keylog(uint16_t keycode, keyrecord_t *record) {
|
||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
|
||||
if (((keycode & 0xFF) == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) {
|
||||
memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH);
|
||||
return;
|
||||
}
|
||||
if (record->tap.count) {
|
||||
keycode &= 0xFF;
|
||||
} else if (keycode > 0xFF) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (keycode > 0xFF) {
|
||||
return;
|
||||
}
|
||||
|
||||
memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1);
|
||||
|
||||
if (keycode < ARRAY_SIZE(code_to_name)) {
|
||||
keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]);
|
||||
}
|
||||
|
||||
log_timer = timer_read();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Keycode handler for oled display.
|
||||
*
|
||||
* This adds pressed keys to buffer, but also resets the oled timer
|
||||
*
|
||||
* @param keycode Keycode from matrix
|
||||
* @param record keyrecord data struture
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
oled_timer_reset();
|
||||
add_keylog(keycode, record);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void oled_timer_reset(void) {
|
||||
oled_timer = timer_read32();
|
||||
}
|
||||
/**
|
||||
* @brief Renders keylogger buffer to oled
|
||||
*
|
||||
*/
|
||||
void render_keylogger_status(uint8_t col, uint8_t line) {
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
oled_set_cursor(col, line);
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false);
|
||||
oled_write(keylog_str, false);
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
oled_advance_page(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Renders default layer state (aka layout) to oled
|
||||
*
|
||||
*/
|
||||
void render_default_layer_state(uint8_t col, uint8_t line) {
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
oled_set_cursor(col, line);
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
|
||||
switch (get_highest_layer(default_layer_state)) {
|
||||
case _QWERTY:
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false);
|
||||
break;
|
||||
case _COLEMAK_DH:
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK_DH), false);
|
||||
break;
|
||||
case _COLEMAK:
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false);
|
||||
break;
|
||||
case _DVORAK:
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false);
|
||||
break;
|
||||
}
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
oled_advance_page(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Renders the active layers to the OLED
|
||||
*
|
||||
*/
|
||||
void render_layer_state(uint8_t col, uint8_t line) {
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
// clang-format off
|
||||
static const char PROGMEM tri_layer_image[][3][24] = {
|
||||
// base
|
||||
{
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0x40,
|
||||
0x40, 0x20, 0x20, 0x10, 0x10, 0x08,
|
||||
0x08, 0x10, 0x10, 0x20, 0x20, 0x40,
|
||||
0x40, 0x80, 0x80, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x5D,
|
||||
0x5D, 0x3E, 0x3E, 0x7C, 0x7C, 0xF8,
|
||||
0xF8, 0x7C, 0x7C, 0x3E, 0x3E, 0x5D,
|
||||
0x5D, 0x88, 0x88, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x01, 0x02, 0x02, 0x04, 0x04, 0x08,
|
||||
0x08, 0x04, 0x04, 0x02, 0x02, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
},
|
||||
// raise
|
||||
{
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0xC0,
|
||||
0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF8,
|
||||
0xF8, 0xF0, 0xF0, 0xE0, 0xE0, 0xC0,
|
||||
0xC0, 0x80, 0x80, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x55,
|
||||
0x55, 0x23, 0x23, 0x47, 0x47, 0x8F,
|
||||
0x8F, 0x47, 0x47, 0x23, 0x23, 0x55,
|
||||
0x55, 0x88, 0x88, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x01, 0x02, 0x02, 0x04, 0x04, 0x08,
|
||||
0x08, 0x04, 0x04, 0x02, 0x02, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
},
|
||||
// lower
|
||||
{
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0x40,
|
||||
0x40, 0x20, 0x20, 0x10, 0x10, 0x08,
|
||||
0x08, 0x10, 0x10, 0x20, 0x20, 0x40,
|
||||
0x40, 0x80, 0x80, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0xD5,
|
||||
0xD5, 0xE2, 0xE2, 0xC4, 0xC4, 0x88,
|
||||
0x88, 0xC4, 0xC4, 0xE2, 0xE2, 0xD5,
|
||||
0xD5, 0x88, 0x88, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x01, 0x03, 0x03, 0x07, 0x07, 0x0F,
|
||||
0x0F, 0x07, 0x07, 0x03, 0x03, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
},
|
||||
// adjust
|
||||
{
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x80, 0x80, 0x40,
|
||||
0xC0, 0x60, 0xA0, 0x50, 0xB0, 0x58,
|
||||
0xA8, 0x50, 0xB0, 0x60, 0xA0, 0x40,
|
||||
0xC0, 0x80, 0x80, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x88, 0x88, 0x5D,
|
||||
0xD5, 0x6B, 0xB6, 0x6D, 0xD6, 0xAD,
|
||||
0xDA, 0x6D, 0xD6, 0x6B, 0xB6, 0x5D,
|
||||
0xD5, 0x88, 0x88, 0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x01, 0x03, 0x02, 0x05, 0x06, 0x0D,
|
||||
0x0A, 0x05, 0x06, 0x03, 0x02, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
},
|
||||
// blank
|
||||
{
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
// better gamepad
|
||||
{
|
||||
{ 0, 0, 0,192,224,224,112,240,240,240,240,144,144,240,240,240,240,112,224,224,192, 0, 0, 0 },
|
||||
{ 128,248,255,255,255,254,252,230,195,195,230,255,255,254,247,227,246,253,254,255,255,255,248,128 },
|
||||
{ 7, 15, 15, 15, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 15, 15, 7 }
|
||||
|
||||
},
|
||||
// mouse
|
||||
{
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0,192, 32, 32, 32,160, 32, 32, 32,192, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0,240, 15, 0, 0, 0, 3, 0, 0, 0, 15,240, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 3, 6, 4, 4, 4, 4, 4, 4, 4, 6, 3, 0, 0, 0, 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
uint8_t layer_is[4] = {0, 4, 4, 4};
|
||||
if (layer_state_is(_ADJUST)) {
|
||||
layer_is[0] = 3;
|
||||
} else if (layer_state_is(_RAISE)) {
|
||||
layer_is[0] = 1;
|
||||
} else if (layer_state_is(_LOWER)) {
|
||||
layer_is[0] = 2;
|
||||
}
|
||||
|
||||
if (layer_state_is(_MOUSE)) {
|
||||
layer_is[1] = 6;
|
||||
}
|
||||
if (layer_state_is(_GAMEPAD)) {
|
||||
layer_is[2] = 5;
|
||||
}
|
||||
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[0]][0], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 4, line);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[1]][0], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 8, line);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[2]][0], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 13, line);
|
||||
oled_write_P(PSTR("Keypad2"), layer_state_is(_KEYPAD));
|
||||
oled_advance_page(true);
|
||||
|
||||
oled_set_cursor(col, line + 1);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[0]][1], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 4, line + 1);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[1]][1], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 8, line + 1);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[2]][1], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 13, line + 1);
|
||||
oled_write_P(PSTR("Mouse"), layer_state_is(_MOUSE));
|
||||
oled_advance_page(true);
|
||||
|
||||
oled_set_cursor(col, line + 2);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[0]][2], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 4, line + 2);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[1]][2], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 8, line + 2);
|
||||
oled_write_raw_P(tri_layer_image[layer_is[2]][2], sizeof(tri_layer_image[0][0]));
|
||||
oled_set_cursor(col + 13, line + 2);
|
||||
oled_write_P(PSTR("Media"), layer_state_is(_MEDIA));
|
||||
#else
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER));
|
||||
oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
|
||||
#endif
|
||||
oled_advance_page(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Renders the current lock status to oled
|
||||
*
|
||||
* @param led_usb_state Current keyboard led state
|
||||
*/
|
||||
void render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line) {
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_set_cursor(col, line);
|
||||
#endif
|
||||
#ifdef CAPS_WORD_ENABLE
|
||||
led_usb_state.caps_lock |= is_caps_word_on();
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false);
|
||||
#if !defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state.num_lock);
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state.caps_lock);
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state.scroll_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Renders the matrix scan rate to the host system
|
||||
*
|
||||
*/
|
||||
void render_matrix_scan_rate(uint8_t padding, uint8_t col, uint8_t line) {
|
||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_P(PSTR("MS:"), false);
|
||||
if (padding) {
|
||||
for (uint8_t n = padding; n > 0; n--) {
|
||||
oled_write_P(PSTR(" "), false);
|
||||
}
|
||||
}
|
||||
oled_write(get_u16_str(get_matrix_scan_rate(), ' '), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Renders the modifier state
|
||||
*
|
||||
* @param modifiers Modifiers to check against (real, weak, onesheot, etc;)
|
||||
*/
|
||||
void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line) {
|
||||
static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_set_cursor(col, line);
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSHIFT)));
|
||||
oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI)));
|
||||
oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT)));
|
||||
oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_LCTL)));
|
||||
oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_RCTL)));
|
||||
oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_RALT)));
|
||||
oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_RGUI)));
|
||||
oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_RSHIFT)));
|
||||
#else
|
||||
oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT));
|
||||
oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI));
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT));
|
||||
oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
extern bool swap_hands;
|
||||
#endif
|
||||
|
||||
void render_bootmagic_status(uint8_t col, uint8_t line) {
|
||||
/* Show Ctrl-Gui Swap options */
|
||||
static const char PROGMEM logo[][2][3] = {
|
||||
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
||||
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
||||
};
|
||||
|
||||
bool is_bootmagic_on;
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
oled_set_cursor(col, line);
|
||||
is_bootmagic_on = !keymap_config.swap_lctl_lgui;
|
||||
#else
|
||||
is_bootmagic_on = keymap_config.swap_lctl_lgui;
|
||||
#endif
|
||||
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
if (keymap_config.swap_lctl_lgui)
|
||||
#else
|
||||
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false);
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#endif
|
||||
{
|
||||
oled_write_P(logo[1][0], is_bootmagic_on);
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
} else {
|
||||
#endif
|
||||
oled_write_P(logo[0][0], !is_bootmagic_on);
|
||||
}
|
||||
#ifndef OLED_DISPLAY_VERBOSE
|
||||
oled_write_P(logo[1][1], is_bootmagic_on);
|
||||
oled_write_P(logo[0][1], !is_bootmagic_on);
|
||||
#endif
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#if defined(AUTOCORRECTION_ENABLE) || defined(AUTOCORRECT_ENABLE)
|
||||
oled_write_P(PSTR("CRCT"), autocorrect_is_enabled());
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#else
|
||||
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui);
|
||||
#endif
|
||||
#ifdef OLED_DISPLAY_VERBOSE
|
||||
oled_set_cursor(col, line + 1);
|
||||
if (keymap_config.swap_lctl_lgui) {
|
||||
oled_write_P(logo[1][1], is_bootmagic_on);
|
||||
} else {
|
||||
oled_write_P(logo[0][1], !is_bootmagic_on);
|
||||
}
|
||||
#endif
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_ONESHOT), is_oneshot_enabled());
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands);
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void render_user_status(uint8_t col, uint8_t line) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
bool is_audio_on = false, l_is_clicky_on = false;
|
||||
# ifdef SPLIT_KEYBOARD
|
||||
|
||||
is_audio_on = user_state.audio_enable;
|
||||
# ifdef AUDIO_CLICKY
|
||||
l_is_clicky_on = user_state.audio_clicky_enable;
|
||||
# endif
|
||||
# else
|
||||
is_audio_on = is_audio_on();
|
||||
# ifdef AUDIO_CLICKY
|
||||
l_is_clicky_on = is_clicky_on();
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_set_cursor(col, line);
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
|
||||
#if !defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#endif
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
oled_write_P(PSTR(OLED_RENDER_USER_ANIM), userspace_config.rgb_matrix_idle_anim);
|
||||
# if !defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(PSTR(" "), false);
|
||||
# endif
|
||||
#elif defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
|
||||
static const char PROGMEM mouse_lock[3] = {0xF2, 0xF3, 0};
|
||||
oled_write_P(mouse_lock, get_auto_mouse_toggle());
|
||||
#endif
|
||||
#ifdef AUDIO_ENABLE
|
||||
static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}};
|
||||
oled_write_P(audio_status[is_audio_on], false);
|
||||
|
||||
# ifdef AUDIO_CLICKY
|
||||
static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}};
|
||||
oled_write_P(audio_clicky_status[l_is_clicky_on && is_audio_on], false);
|
||||
# if !defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(PSTR(" "), false);
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static const char PROGMEM rgb_layer_status[2][3] = {{0xEE, 0xEF, 0}, {0xF0, 0xF1, 0}};
|
||||
oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false);
|
||||
static const char PROGMEM cat_mode[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}};
|
||||
oled_write_P(cat_mode[0], host_driver_disabled);
|
||||
#if defined(UNICODE_COMMON_ENABLE)
|
||||
static const char PROGMEM uc_mod_status[5][3] = {{0xEC, 0xED, 0}, {0x20, 0x20, 0}, {0x20, 0x20, 0}, {0x20, 0x20, 0}, {0xEA, 0xEB, 0}};
|
||||
oled_write_P(uc_mod_status[get_unicode_input_mode()], false);
|
||||
#endif
|
||||
if (userspace_config.nuke_switch) {
|
||||
#if !defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_write_P(PSTR(" "), false);
|
||||
#endif
|
||||
static const char PROGMEM nukem_good[2] = {0xFA, 0};
|
||||
oled_write_P(nukem_good, false);
|
||||
#if !defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_advance_page(true);
|
||||
#endif
|
||||
}
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
oled_advance_page(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void render_rgb_hsv(uint8_t col, uint8_t line) {
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_P(PSTR("HSV: "), false);
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
oled_write(get_u8_str(rgb_matrix_get_hue(), ' '), false);
|
||||
oled_write_P(PSTR(", "), false);
|
||||
oled_write(get_u8_str(rgb_matrix_get_sat(), ' '), false);
|
||||
oled_write_P(PSTR(", "), false);
|
||||
oled_write(get_u8_str(rgb_matrix_get_val(), ' '), false);
|
||||
#elif RGBLIGHT_ENABLE
|
||||
oled_write(get_u8_str(rgblight_get_hue(), ' '), false);
|
||||
oled_write_P(PSTR(", "), false);
|
||||
oled_write(get_u8_str(rgblight_get_sat(), ' '), false);
|
||||
oled_write_P(PSTR(", "), false);
|
||||
oled_write(get_u8_str(rgblight_get_val(), ' '), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void render_wpm(uint8_t padding, uint8_t col, uint8_t line) {
|
||||
#ifdef WPM_ENABLE
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
|
||||
if (padding) {
|
||||
for (uint8_t n = padding; n > 0; n--) {
|
||||
oled_write_P(PSTR(" "), false);
|
||||
}
|
||||
}
|
||||
oled_write(get_u8_str(get_current_wpm(), ' '), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
//============= USER CONFIG PARAMS ===============
|
||||
// wpm graph originally designed by john-ezra
|
||||
|
||||
// for 128x128:
|
||||
// max_lines_graph = 54;
|
||||
// vertical_offset = 64;
|
||||
// for 128x64:
|
||||
// max_lines_graph = 64;
|
||||
// vertical_offset = 0;
|
||||
|
||||
void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) {
|
||||
#ifdef WPM_ENABLE
|
||||
static uint16_t timer = 0;
|
||||
static uint8_t x = OLED_DISPLAY_HEIGHT - 1;
|
||||
uint8_t currwpm = get_current_wpm();
|
||||
float max_wpm = OLED_WPM_GRAPH_MAX_WPM;
|
||||
|
||||
if (timer_elapsed(timer) > OLED_WPM_GRAPH_REFRESH_INTERVAL) { // check if it's been long enough before refreshing graph
|
||||
x = (max_lines_graph - 1) - ((currwpm / max_wpm) * (max_lines_graph - 1)); // main calculation to plot graph line
|
||||
for (uint8_t i = 0; i <= OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS - 1; i++) { // first draw actual value line
|
||||
oled_write_pixel(3, x + i + vertical_offset, true);
|
||||
}
|
||||
# ifdef OLED_WPM_GRAPH_VERTICAL_LINE
|
||||
static uint8_t vert_count = 0;
|
||||
if (vert_count == OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL) {
|
||||
vert_count = 0;
|
||||
while (x <= (max_lines_graph - 1)) {
|
||||
oled_write_pixel(3, x + vertical_offset, true);
|
||||
x++;
|
||||
}
|
||||
} else {
|
||||
for (uint8_t i = (max_lines_graph - 1); i > x; i--) {
|
||||
if (i % OLED_WPM_GRAPH_AREA_FILL_INTERVAL == 0) {
|
||||
oled_write_pixel(3, i + vertical_offset, true);
|
||||
}
|
||||
}
|
||||
vert_count++;
|
||||
}
|
||||
# else
|
||||
for (int i = (max_lines_graph - 1); i > x; i--) {
|
||||
if (i % OLED_WPM_GRAPH_AREA_FILL_INTERVAL == 0) {
|
||||
oled_write_pixel(3, i + vertical_offset, true);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# include <math.h>
|
||||
uint8_t y_start = ceil(vertical_offset / 8);
|
||||
uint8_t y_length = y_start + ceil(max_lines_graph / 8);
|
||||
oled_pan_section(false, y_start, y_length, 3, 125); // then move the entire graph one pixel to the right
|
||||
timer = timer_read(); // refresh the timer for the next iteration
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(POINTING_DEVICE_ENABLE)
|
||||
void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint8_t line) {
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_P(PSTR("CPI:"), false);
|
||||
if (padding) {
|
||||
for (uint8_t n = padding - 1; n > 0; n--) {
|
||||
oled_write_P(PSTR(" "), false);
|
||||
}
|
||||
}
|
||||
|
||||
oled_write(get_u16_str(cpi, ' '), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
// WPM-responsive animation stuff here
|
||||
#define OLED_SLEEP_FRAMES 2
|
||||
#define OLED_SLEEP_SPEED 10 // below this wpm value your animation will idle
|
||||
|
||||
#define OLED_WAKE_FRAMES 2 // uncomment if >1
|
||||
#define OLED_WAKE_SPEED OLED_SLEEP_SPEED // below this wpm value your animation will idle
|
||||
|
||||
#define OLED_KAKI_FRAMES 3
|
||||
#define OLED_KAKI_SPEED 40 // above this wpm value typing animation to triggere
|
||||
|
||||
#define OLED_RTOGI_FRAMES 2
|
||||
//#define OLED_LTOGI_FRAMES 2
|
||||
|
||||
//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
|
||||
// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
|
||||
#define OLED_ANIM_SIZE 36
|
||||
#define OLED_ANIM_ROWS 4
|
||||
#define OLED_ANIM_MAX_FRAMES 3
|
||||
#if (OLED_SLEEP_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_WAKE_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_KAKI_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_RTOGI_FRAMES > OLED_ANIM_MAX_FRAMES)
|
||||
# error frame size too large
|
||||
#endif
|
||||
|
||||
static uint8_t animation_frame = 0;
|
||||
static uint8_t animation_type = 0;
|
||||
|
||||
void render_kitty(uint8_t col, uint8_t line) {
|
||||
// Images credit j-inc(/James Incandenza) and pixelbenny.
|
||||
// Credit to obosob for initial animation approach.
|
||||
// heavily modified by drashna because he's a glutton for punishment
|
||||
|
||||
// clang-format off
|
||||
static const char PROGMEM animation[4][OLED_ANIM_MAX_FRAMES][OLED_ANIM_ROWS][OLED_ANIM_SIZE] = {
|
||||
// sleep frames
|
||||
{
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
}
|
||||
},
|
||||
// wake frames
|
||||
{
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 }
|
||||
}
|
||||
},
|
||||
// kaki frames
|
||||
{
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 }
|
||||
}
|
||||
},
|
||||
// rtogi frames
|
||||
{
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
}
|
||||
}
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
oled_set_cursor(1, i + 1);
|
||||
oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void render_unicode_mode(uint8_t col, uint8_t line) {
|
||||
#ifdef CUSTOM_UNICODE_ENABLE
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_ln_P(PSTR("Unicode:"), false);
|
||||
switch (typing_mode) {
|
||||
case UCTM_WIDE:
|
||||
oled_write_P(PSTR(" Wide"), false);
|
||||
break;
|
||||
case UCTM_SCRIPT:
|
||||
oled_write_P(PSTR(" Script"), false);
|
||||
break;
|
||||
case UCTM_BLOCKS:
|
||||
oled_write_P(PSTR(" Blocks"), false);
|
||||
break;
|
||||
case UCTM_REGIONAL:
|
||||
oled_write_P(PSTR(" Regional"), false);
|
||||
break;
|
||||
case UCTM_AUSSIE:
|
||||
oled_write_P(PSTR(" Aussie"), false);
|
||||
break;
|
||||
case UCTM_ZALGO:
|
||||
oled_write_P(PSTR(" Zalgo"), false);
|
||||
break;
|
||||
case UCTM_NO_MODE:
|
||||
oled_write_P(PSTR(" Normal"), false);
|
||||
break;
|
||||
default:
|
||||
oled_write_P(PSTR(" Unknown"), false);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) {
|
||||
static uint32_t anim_frame_duration = 500;
|
||||
#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
|
||||
if (get_auto_mouse_toggle()) {
|
||||
animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES;
|
||||
animation_type = 3;
|
||||
anim_frame_duration = 300;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef WPM_ENABLE
|
||||
if (get_current_wpm() <= OLED_SLEEP_SPEED) {
|
||||
#endif
|
||||
animation_frame = (animation_frame + 1) % OLED_SLEEP_FRAMES;
|
||||
animation_type = 0;
|
||||
anim_frame_duration = 500;
|
||||
#ifdef WPM_ENABLE
|
||||
} else if (get_current_wpm() > OLED_WAKE_SPEED) {
|
||||
animation_frame = (animation_frame + 1) % OLED_WAKE_FRAMES;
|
||||
animation_type = 1;
|
||||
anim_frame_duration = 800;
|
||||
} else if (get_current_wpm() >= OLED_KAKI_SPEED) {
|
||||
animation_frame = (animation_frame + 1) % OLED_KAKI_FRAMES;
|
||||
animation_type = 2;
|
||||
anim_frame_duration = 500;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return anim_frame_duration;
|
||||
}
|
||||
|
||||
void render_mouse_mode(uint8_t col, uint8_t line) {
|
||||
#if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE)
|
||||
// credit and thanks to jaspertandy on discord for these images
|
||||
static const char PROGMEM mouse_logo[3][2][16] = {// mouse icon
|
||||
{{0, 0, 0, 252, 2, 2, 2, 58, 2, 2, 2, 252, 0, 0, 0, 0}, {0, 0, 63, 96, 64, 64, 64, 64, 64, 64, 64, 96, 63, 0, 0, 0}},
|
||||
// crosshair icon
|
||||
{{128, 240, 136, 228, 146, 138, 202, 127, 202, 138, 146, 228, 136, 240, 128, 0}, {0, 7, 8, 19, 36, 40, 41, 127, 41, 40, 36, 19, 8, 7, 0, 0}},
|
||||
// dragscroll icon
|
||||
{{0, 0, 112, 136, 156, 2, 15, 1, 15, 2, 140, 68, 56, 0, 0, 0}, {0, 0, 2, 6, 15, 28, 60, 124, 60, 28, 15, 6, 2, 0, 0, 0}}};
|
||||
|
||||
uint8_t image_index = 0;
|
||||
# ifdef OLED_DISPLAY_TEST
|
||||
image_index = animation_frame;
|
||||
# else
|
||||
if (charybdis_get_pointer_sniping_enabled()) {
|
||||
image_index = 1;
|
||||
} else if (charybdis_get_pointer_dragscroll_enabled()) {
|
||||
image_index = 2;
|
||||
}
|
||||
# endif
|
||||
|
||||
oled_set_cursor(col, line);
|
||||
oled_write_raw_P(mouse_logo[image_index][0], 16);
|
||||
oled_set_cursor(col, line + 1);
|
||||
oled_write_raw_P(mouse_logo[image_index][1], 16);
|
||||
#endif
|
||||
}
|
||||
|
||||
void render_status_right(void) {
|
||||
#if defined(KEYBOARD_handwired_tractyl_manuform)
|
||||
oled_set_cursor(7, 0);
|
||||
oled_write_P(PSTR("Manuform"), true);
|
||||
#elif defined(KEYBOARD_bastardkb_charybdis)
|
||||
oled_set_cursor(6, 0);
|
||||
oled_write_P(PSTR("Charybdis"), true);
|
||||
#elif defined(KEYBOARD_splitkb_kyria)
|
||||
oled_set_cursor(8, 0);
|
||||
oled_write_P(PSTR("Kyria"), true);
|
||||
#else
|
||||
oled_set_cursor(8, 0);
|
||||
oled_write_P(PSTR("Right"), true);
|
||||
#endif
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
render_default_layer_state(1, 1);
|
||||
#else
|
||||
render_default_layer_state(0, 0);
|
||||
#endif
|
||||
|
||||
/* Show Keyboard Layout */
|
||||
render_layer_state(1, 2);
|
||||
render_mod_status(get_mods() | get_oneshot_mods(), 1, 5);
|
||||
#if !defined(OLED_DISPLAY_VERBOSE) && defined(WPM_ENABLE) && !defined(STM32F303xC)
|
||||
render_wpm(2);
|
||||
#endif
|
||||
render_keylock_status(host_keyboard_led_state(), 1, 6);
|
||||
}
|
||||
|
||||
void render_status_left(void) {
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
render_kitty(0, 1);
|
||||
|
||||
# if defined(KEYBOARD_handwired_tractyl_manuform)
|
||||
oled_set_cursor(7, 0);
|
||||
oled_write_P(PSTR("Tractyl"), true);
|
||||
# elif defined(KEYBOARD_bastardkb_charybdis)
|
||||
oled_set_cursor(6, 0);
|
||||
oled_write_P(PSTR("Charybdis"), true);
|
||||
# elif defined(KEYBOARD_splitkb_kyria)
|
||||
oled_set_cursor(7, 0);
|
||||
oled_write_P(PSTR("SplitKB"), true);
|
||||
# elif defined(KEYBOARD_handwired_fingerpunch_rockon)
|
||||
oled_set_cursor(7, 0);
|
||||
oled_write_P(PSTR("Rock On"), true);
|
||||
# else
|
||||
oled_set_cursor(8, 0);
|
||||
oled_write_P(PSTR("Left"), true);
|
||||
# endif
|
||||
|
||||
# if defined(WPM_ENABLE)
|
||||
render_wpm(1, 7, 1);
|
||||
# elif defined(DEBUG_MATRIX_SCAN_RATE)
|
||||
render_matrix_scan_rate(1, 7, 1);
|
||||
# endif
|
||||
# if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_zerf9) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE)
|
||||
render_pointing_dpi_status(charybdis_get_pointer_sniping_enabled() ? charybdis_get_pointer_sniping_dpi() : charybdis_get_pointer_default_dpi(), 1, 7, 2);
|
||||
render_mouse_mode(17, 1);
|
||||
# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE)
|
||||
render_matrix_scan_rate(1, 7, 2);
|
||||
# endif
|
||||
/* Show Keyboard Layout */
|
||||
render_bootmagic_status(7, 3);
|
||||
render_user_status(1, 5);
|
||||
|
||||
render_keylogger_status(1, 6);
|
||||
#else
|
||||
render_default_layer_state(0, 0);
|
||||
/* Show Keyboard Layout */
|
||||
render_bootmagic_status(7, 3);
|
||||
render_user_status(1, 5);
|
||||
|
||||
render_keylogger_status(1, 6);
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) void oled_render_large_display(bool side) {
|
||||
if (!side) {
|
||||
render_unicode_mode(1, 14);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
if (is_keyboard_master()) {
|
||||
memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH);
|
||||
}
|
||||
|
||||
kittoken = defer_exec(3000, kitty_animation_phases, NULL);
|
||||
|
||||
oled_clear();
|
||||
oled_render();
|
||||
return oled_init_keymap(rotation);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool oled_task_keymap(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool oled_task_user(void) {
|
||||
#ifndef OLED_DISPLAY_TEST
|
||||
if (!is_oled_enabled) {
|
||||
oled_off();
|
||||
return false;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
oled_on();
|
||||
}
|
||||
|
||||
if (!oled_task_keymap()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
static const char PROGMEM header_image[] = {
|
||||
0, 192, 32, 16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 15, 31, 63, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 63, 31, 15, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, 192, 0,
|
||||
// 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0
|
||||
};
|
||||
oled_write_raw_P(header_image, sizeof(header_image));
|
||||
#endif
|
||||
|
||||
#ifndef OLED_DISPLAY_TEST
|
||||
if (is_keyboard_left()) {
|
||||
#endif
|
||||
render_status_left();
|
||||
#if defined(OLED_DISPLAY_128X128)
|
||||
oled_render_large_display(true);
|
||||
#endif
|
||||
#ifndef OLED_DISPLAY_TEST
|
||||
} else {
|
||||
render_status_right();
|
||||
# if defined(OLED_DISPLAY_128X128)
|
||||
oled_render_large_display(false);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(OLED_DISPLAY_VERBOSE)
|
||||
uint8_t num_of_rows;
|
||||
# if defined(OLED_DISPLAY_128X128)
|
||||
num_of_rows = 15;
|
||||
# else
|
||||
num_of_rows = 7;
|
||||
# endif
|
||||
for (uint8_t i = 1; i < num_of_rows; i++) {
|
||||
oled_set_cursor(0, i);
|
||||
oled_write_raw_P(display_border, sizeof(display_border));
|
||||
oled_set_cursor(21, i);
|
||||
oled_write_raw_P(display_border, sizeof(display_border));
|
||||
}
|
||||
|
||||
static const char PROGMEM footer_image[] = {0, 3, 4, 8, 16, 32, 64, 128, 128, 128, 128, 128, 128, 128, 192, 224, 240, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 240, 224, 192, 128, 128, 128, 128, 128, 128, 128, 64, 32, 16, 8, 4, 3, 0};
|
||||
oled_set_cursor(0, num_of_rows);
|
||||
oled_write_raw_P(footer_image, sizeof(footer_image));
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
extern bool oled_initialized;
|
||||
|
||||
__attribute__((weak)) void matrix_scan_oled(void) {
|
||||
is_oled_enabled = !(timer_elapsed32(oled_timer) > 60000);
|
||||
}
|
||||
166
users/freznel/oled/oled_stuff.h
Normal file
166
users/freznel/oled/oled_stuff.h
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "oled_driver.h"
|
||||
#ifdef DEFFERED_EXEC_ENABLE
|
||||
extern deferred_token kittoken;
|
||||
#endif
|
||||
|
||||
void oled_driver_render_logo(void);
|
||||
bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
|
||||
oled_rotation_t oled_init_keymap(oled_rotation_t rotation);
|
||||
void oled_timer_reset(void);
|
||||
void render_keylogger_status(uint8_t col, uint8_t line);
|
||||
void render_default_layer_state(uint8_t col, uint8_t line);
|
||||
void render_layer_state(uint8_t col, uint8_t line);
|
||||
void render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line);
|
||||
void render_matrix_scan_rate(uint8_t padding, uint8_t col, uint8_t line);
|
||||
void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line);
|
||||
void render_bootmagic_status(uint8_t col, uint8_t line);
|
||||
void render_user_status(uint8_t col, uint8_t line);
|
||||
void oled_driver_render_logo(void);
|
||||
void render_wpm(uint8_t padding, uint8_t col, uint8_t line);
|
||||
void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint8_t line);
|
||||
void oled_driver_render_logo_left(void);
|
||||
void oled_driver_render_logo_right(void);
|
||||
void oled_render_large_display(bool side);
|
||||
void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset);
|
||||
void render_kitty(uint8_t col, uint8_t line);
|
||||
void render_unicode_mode(uint8_t col, uint8_t line);
|
||||
void render_rgb_hsv(uint8_t col, uint8_t line);
|
||||
void render_mouse_mode(uint8_t col, uint8_t line);
|
||||
|
||||
void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end);
|
||||
|
||||
#if defined(OLED_DISPLAY_128X128) || defined(OLED_DISPLAY_128X64)
|
||||
# define OLED_DISPLAY_VERBOSE
|
||||
|
||||
# define OLED_RENDER_KEYLOGGER "Keylogger: "
|
||||
# ifndef OLED_KEYLOGGER_LENGTH
|
||||
# define OLED_KEYLOGGER_LENGTH 9
|
||||
# endif
|
||||
# define OLED_RENDER_LAYOUT_NAME "Layout: "
|
||||
# define OLED_RENDER_LAYOUT_QWERTY "Qwerty"
|
||||
# define OLED_RENDER_LAYOUT_COLEMAK_DH "Colemak DH"
|
||||
# define OLED_RENDER_LAYOUT_COLEMAK "Colemak"
|
||||
# define OLED_RENDER_LAYOUT_DVORAK "Dvorak"
|
||||
# define OLED_RENDER_LAYOUT_WORKMAN "Workman"
|
||||
# define OLED_RENDER_LAYOUT_NORMAN "Norman"
|
||||
# define OLED_RENDER_LAYOUT_MALTRON "Matron"
|
||||
# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn"
|
||||
# define OLED_RENDER_LAYOUT_CARPLAX "Carplax"
|
||||
|
||||
# define OLED_RENDER_LAYER_NAME "Layer:"
|
||||
# define OLED_RENDER_LAYER_LOWER "Lower"
|
||||
# define OLED_RENDER_LAYER_RAISE "Raise"
|
||||
# define OLED_RENDER_LAYER_ADJUST "Adjust"
|
||||
# define OLED_RENDER_LAYER_MODS "Mods"
|
||||
|
||||
# define OLED_RENDER_LOCK_NAME "Lock: "
|
||||
# define OLED_RENDER_LOCK_NUML "NUM"
|
||||
# define OLED_RENDER_LOCK_CAPS "CAPS"
|
||||
# define OLED_RENDER_LOCK_SCLK "SCLK"
|
||||
|
||||
# define OLED_RENDER_MODS_NAME "Mods"
|
||||
# define OLED_RENDER_MODS_SFT "Sft"
|
||||
# define OLED_RENDER_MODS_CTL "Ctl"
|
||||
# define OLED_RENDER_MODS_ALT "Alt"
|
||||
# define OLED_RENDER_MODS_GUI "GUI"
|
||||
|
||||
# define OLED_RENDER_BOOTMAGIC_NAME "Boot "
|
||||
# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
|
||||
# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
|
||||
# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
|
||||
# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
|
||||
# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
|
||||
# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
|
||||
|
||||
# define OLED_RENDER_USER_NAME "USER:"
|
||||
# define OLED_RENDER_USER_ANIM "Anim"
|
||||
# define OLED_RENDER_USER_LAYR "Layr"
|
||||
# define OLED_RENDER_USER_NUKE "Nuke"
|
||||
|
||||
# define OLED_RENDER_WPM_COUNTER "WPM: "
|
||||
#else
|
||||
# define OLED_RENDER_KEYLOGGER "KLogr"
|
||||
# ifndef OLED_KEYLOGGER_LENGTH
|
||||
# define OLED_KEYLOGGER_LENGTH 5
|
||||
# endif
|
||||
|
||||
# define OLED_RENDER_LAYOUT_NAME "Lyout"
|
||||
# define OLED_RENDER_LAYOUT_QWERTY " QRTY"
|
||||
# define OLED_RENDER_LAYOUT_COLEMAK_DH " cmDH"
|
||||
# define OLED_RENDER_LAYOUT_COLEMAK " COLE"
|
||||
# define OLED_RENDER_LAYOUT_DVORAK " DVRK"
|
||||
# define OLED_RENDER_LAYOUT_WORKMAN " WKMN"
|
||||
# define OLED_RENDER_LAYOUT_NORMAN " NORM"
|
||||
# define OLED_RENDER_LAYOUT_MALTRON " MLTN"
|
||||
# define OLED_RENDER_LAYOUT_EUCALYN " ECLN"
|
||||
# define OLED_RENDER_LAYOUT_CARPLAX " CRPX"
|
||||
|
||||
# define OLED_RENDER_LAYER_NAME "LAYER"
|
||||
# define OLED_RENDER_LAYER_LOWER "Lower"
|
||||
# define OLED_RENDER_LAYER_RAISE "Raise"
|
||||
# define OLED_RENDER_LAYER_ADJUST "Adjst"
|
||||
# define OLED_RENDER_LAYER_MODS " Mods"
|
||||
|
||||
# define OLED_RENDER_LOCK_NAME "Lock:"
|
||||
# define OLED_RENDER_LOCK_NUML "NumL"
|
||||
# define OLED_RENDER_LOCK_CAPS "CapL"
|
||||
# define OLED_RENDER_LOCK_SCLK "ScrL"
|
||||
|
||||
# define OLED_RENDER_MODS_NAME "Mods: "
|
||||
# define OLED_RENDER_MODS_SFT "Shft"
|
||||
# define OLED_RENDER_MODS_CTL "Ctrl"
|
||||
# define OLED_RENDER_MODS_ALT "Alt\n"
|
||||
# define OLED_RENDER_MODS_GUI "GUI\n"
|
||||
|
||||
# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK"
|
||||
# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
|
||||
# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
|
||||
# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
|
||||
# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
|
||||
# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
|
||||
# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
|
||||
|
||||
# define OLED_RENDER_USER_NAME "USER:"
|
||||
# define OLED_RENDER_USER_ANIM "Anim"
|
||||
# define OLED_RENDER_USER_LAYR "Layr"
|
||||
# define OLED_RENDER_USER_NUKE "Nuke"
|
||||
|
||||
# define OLED_RENDER_WPM_COUNTER "WPM: "
|
||||
#endif
|
||||
|
||||
extern char keylog_str[OLED_KEYLOGGER_LENGTH];
|
||||
|
||||
#ifndef OLED_WPM_GRAPH_MAX_WPM
|
||||
# define OLED_WPM_GRAPH_MAX_WPM 120
|
||||
#endif
|
||||
#ifndef OLED_WPM_GRAPH_REFRESH_INTERVAL
|
||||
# define OLED_WPM_GRAPH_REFRESH_INTERVAL 300
|
||||
#endif
|
||||
#ifndef OLED_WPM_GRAPH_AREA_FILL_INTERVAL
|
||||
# define OLED_WPM_GRAPH_AREA_FILL_INTERVAL 3
|
||||
#endif
|
||||
#ifndef OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL
|
||||
# define OLED_WPM_GRAPH_VERTCAL_LINE_INTERVAL 3
|
||||
#endif
|
||||
#ifndef OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS
|
||||
# define OLED_WPM_GRAPH_GRAPH_LINE_THICKNESS 2
|
||||
#endif
|
||||
42
users/freznel/oled/readme.md
Normal file
42
users/freznel/oled/readme.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# OLED Display
|
||||
|
||||
To disable the pre genrated oled display, add `CUSTOM_OLED_DRIVER = no` to your `rules.mk`.
|
||||
|
||||
<!-- to do: add all the stuff -->
|
||||
## OLED Font
|
||||
|
||||
My font file has multiple fonts and multiple logs integrated into the one file. And it uses the full 255 possible characters.
|
||||
|
||||
In addition to the default font and logos:
|
||||
|
||||
```c
|
||||
# define OLED_FONT_5X5
|
||||
# define OLED_FONT_AZTECH
|
||||
# define OLED_FONT_BMPLAIN
|
||||
# define OLED_FONT_CRACKERS
|
||||
# define OLED_FONT_EIN
|
||||
# define OLED_FONT_HISKYF21
|
||||
# define OLED_FONT_SQUASH
|
||||
# define OLED_FONT_SUPER_DIGG
|
||||
# define OLED_FONT_ZXPIX
|
||||
```
|
||||
|
||||
```c
|
||||
# define OLED_LOGO_CORNE
|
||||
# define OLED_LOGO_GMK_BAD
|
||||
# define OLED_LOGO_GOTHAM
|
||||
# define OLED_LOGO_HUE_MANITEE
|
||||
# define OLED_LOGO_LOOSE
|
||||
# define OLED_LOGO_SETS3N
|
||||
# define OLED_LOGO_SKEEB
|
||||
```
|
||||
|
||||
Additionally, the font file allows for external oled font files, instead. This allows for additional files that cannot be hosted in the QMK Repo.
|
||||
|
||||
## Display
|
||||
|
||||
A picture is worth a thousand words. So here are two:
|
||||
|
||||

|
||||
|
||||

|
||||
356
users/freznel/pointing/pointing.c
Normal file
356
users/freznel/pointing/pointing.c
Normal file
|
|
@ -0,0 +1,356 @@
|
|||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
||||
#include "pointing.h"
|
||||
#include "drivers/haptic/drv2605l.h"
|
||||
#include "pointing_device_modes.h"
|
||||
|
||||
// static uint16_t mouse_debounce_timer = 0;
|
||||
bool enable_acceleration = false;
|
||||
static bool APP_ALT, APP_WIN;
|
||||
|
||||
|
||||
#ifdef TAPPING_TERM_PER_KEY
|
||||
# define TAP_CHECK get_tapping_term(KC_BTN1, NULL)
|
||||
#else
|
||||
# ifndef TAPPING_TERM
|
||||
# define TAPPING_TERM 200
|
||||
# endif
|
||||
# define TAP_CHECK TAPPING_TERM
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) void pointing_device_init_keymap(void) {}
|
||||
|
||||
void pointing_device_init_user(void) {
|
||||
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
set_auto_mouse_enable(true);
|
||||
#endif
|
||||
pointing_device_init_keymap();
|
||||
}
|
||||
|
||||
__attribute__((weak)) report_mouse_t pointing_device_task_keymap(report_mouse_t mouse_report) {
|
||||
return mouse_report;
|
||||
}
|
||||
|
||||
enum keymap_pointing_device_modes {
|
||||
PM_BROW = PM_SAFE_RANGE, // BROWSER TAB Manipulation [mode id 6]
|
||||
PM_RGB_MODE_VAL, // RGB Control for mode and Brightness [mode id 7]
|
||||
PM_RGB_HUE_SAT, // RGB Control for HUE and Saturation [mode id 8]
|
||||
PM_RGB_SPEED, // RGB Control for Speed [mode id 9]
|
||||
PM_WINDOW, // LGUI plus Arrow Keys [mode id 10]
|
||||
PM_SWITCHER, // LGUI plus Arrow Keys (for rev) [mode id 11]
|
||||
PM_APP_2, // ALT_TAB [mode id 12]
|
||||
PM_CUR_ACCEL, // Acceleration [mode id 13]
|
||||
PM_BROWSER_CONTROL, // Browser history [mode id 14]
|
||||
PM_WIN_POS, // Window repositinong [mode id 15]
|
||||
};
|
||||
|
||||
const uint16_t pointing_device_mode_maps[][4] = {
|
||||
// PM_BROW
|
||||
[0] = POINTING_MODE_LAYOUT(
|
||||
C(S(KC_PGUP)),
|
||||
C(S(KC_TAB)), C(KC_TAB),
|
||||
C(S(KC_PGDN))
|
||||
),
|
||||
// PM_RGB_MODE_VAL
|
||||
[1] = POINTING_MODE_LAYOUT(
|
||||
RGB_VAI,
|
||||
RGB_RMOD, RGB_MOD,
|
||||
RGB_VAD
|
||||
),
|
||||
// PM_RGB_HUE_SAT
|
||||
[2] = POINTING_MODE_LAYOUT(
|
||||
RGB_SAI,
|
||||
RGB_HUD, RGB_HUI,
|
||||
RGB_SAD
|
||||
),
|
||||
// PM_RGB_SPEED
|
||||
[3] = POINTING_MODE_LAYOUT(
|
||||
KC_NO,
|
||||
RGB_SPD, RGB_SPI,
|
||||
KC_NO
|
||||
),
|
||||
// PM_WINDOW
|
||||
[4] = POINTING_MODE_LAYOUT(
|
||||
G(KC_UP),
|
||||
G(KC_LEFT), G(KC_RIGHT),
|
||||
G(KC_DOWN)
|
||||
),
|
||||
// PM_SWITCHER : PM 11
|
||||
[5] = POINTING_MODE_LAYOUT(
|
||||
G(KC_UP),
|
||||
G(KC_LEFT), G(KC_RIGHT),
|
||||
G(KC_DOWN)
|
||||
),
|
||||
// ALT_TAB: PM 12
|
||||
[6] = POINTING_MODE_LAYOUT(
|
||||
KC_NO,
|
||||
KC_NO, KC_NO,
|
||||
KC_NO
|
||||
),
|
||||
// ACCEL: PM 13
|
||||
[7] = POINTING_MODE_LAYOUT(
|
||||
KC_NO,
|
||||
KC_NO, KC_NO,
|
||||
KC_NO
|
||||
),
|
||||
// Browser Control: PM14
|
||||
[8] = POINTING_MODE_LAYOUT(
|
||||
KC_NO,
|
||||
KC_WBAK, KC_WFWD,
|
||||
KC_NO
|
||||
),
|
||||
//Windows Positioning: PM15
|
||||
[9] = POINTING_MODE_LAYOUT(
|
||||
KC_NO,
|
||||
KC_NO, KC_NO,
|
||||
KC_NO
|
||||
)
|
||||
};
|
||||
|
||||
uint8_t get_pointing_mode_divisor_user(uint8_t mode_id, uint8_t direction) {
|
||||
switch(mode_id) {
|
||||
case PM_BROW:
|
||||
// half speed for vertical axis
|
||||
return direction < PD_LEFT ? 128 : 64;
|
||||
case PM_RGB_MODE_VAL:
|
||||
// half speed for horizontal axis
|
||||
return direction < PD_LEFT ? 64 : 128;
|
||||
case PM_RGB_HUE_SAT:
|
||||
// example of unique divisor for each mode (not actually recommended for this mode (64 would be a good divisor here))
|
||||
switch(direction) {
|
||||
case PD_DOWN:
|
||||
return 32;
|
||||
case PD_UP:
|
||||
return 64;
|
||||
case PD_LEFT:
|
||||
return 16;
|
||||
case PD_RIGHT:
|
||||
return 128;
|
||||
}
|
||||
case PM_RGB_SPEED:
|
||||
return 64; // could skip adding this if default if POINTING_DEFAULT_DIVISOR is 64
|
||||
case PM_WINDOW:
|
||||
return 128;
|
||||
case PM_SWITCHER:
|
||||
return 64;
|
||||
case PM_CUR_ACCEL:
|
||||
return 8;
|
||||
case PM_APP_2:
|
||||
return 64;
|
||||
case PM_BROWSER_CONTROL:
|
||||
return 64;
|
||||
case PM_WIN_POS:
|
||||
return 128; // could skip adding this if default if POINTING_DEFAULT_DIVISOR is 64
|
||||
}
|
||||
|
||||
return 0; // returning 0 to let processing of divisors continue
|
||||
}
|
||||
|
||||
|
||||
#define CONSTRAIN_XY(value) (value > XY_REPORT_MAX ? XY_REPORT_MAX : value < XY_REPORT_MIN? XY_REPORT_MIN: value)
|
||||
|
||||
bool process_pointing_mode_user(pointing_mode_t pointing_mode, report_mouse_t* mouse_report) {
|
||||
switch(pointing_mode.id){
|
||||
/** Manipulate browser tabs (win/linux) (switch to left tab, move tab left, move tab right, switch to right tab)
|
||||
* Note that this mode could be put in a mode map but is here as an example of going past the bottom support 10 modes
|
||||
* without overwriting any built in modes
|
||||
*/
|
||||
// Manipulating pointing_mode & mouse_report (cursor speed boost mode example)
|
||||
case PM_CUR_ACCEL:
|
||||
// reset mouse_report note that mouse_report is a pointer in this function's context
|
||||
*mouse_report = pointing_device_get_report();
|
||||
// set up temp variable and context
|
||||
{
|
||||
// add linear boost to cursor x speed
|
||||
mouse_xy_report_t temp_mouse_axis = apply_divisor_xy(pointing_mode.x);
|
||||
#ifdef POINTING_DEVICE_INVERT_H
|
||||
mouse_report->x = CONSTRAIN_XY(mouse_report->x - temp_mouse_axis);
|
||||
#else
|
||||
mouse_report->x = CONSTRAIN_XY(mouse_report->x + temp_mouse_axis);
|
||||
#endif
|
||||
// collect residual
|
||||
pointing_mode.x -= multiply_divisor_xy(temp_mouse_axis);
|
||||
// add linear boost to cursor y speed
|
||||
temp_mouse_axis = apply_divisor_xy(pointing_mode.y);
|
||||
#ifdef POINTING_DEVICE_INVERT_V
|
||||
mouse_report->y = CONSTRAIN_XY(mouse_report->y - apply_divisor_xy(pointing_mode.y));
|
||||
#else
|
||||
mouse_report->y = CONSTRAIN_XY(mouse_report->y + apply_divisor_xy(pointing_mode.y));
|
||||
#endif
|
||||
// collect residual
|
||||
pointing_mode.y -= multiply_divisor_xy(temp_mouse_axis);
|
||||
}
|
||||
// update pointing_mode with residual stored x & y
|
||||
set_pointing_mode(pointing_mode);
|
||||
// NOTE: mouse_report does not need to be set or sent here as it will be carried forward
|
||||
return false; // stop pointing mode processing
|
||||
|
||||
// Alternative method for app scrolling that only toggles ALT key when there is movement and holds until key release
|
||||
case PM_APP_2:
|
||||
// activate alt key if greater/equal to divisor and set flag
|
||||
if((abs(pointing_mode.x)) >= current_pointing_mode_divisor() && !APP_ALT) {
|
||||
register_code(KC_LALT);
|
||||
APP_ALT = true;
|
||||
}
|
||||
pointing_tap_codes(S(KC_TAB), KC_NO, KC_NO, KC_TAB);
|
||||
return false;
|
||||
case PM_WIN_POS:
|
||||
if((abs(pointing_mode.x)) >= current_pointing_mode_divisor() && !APP_WIN) {
|
||||
register_code(KC_LGUI);
|
||||
APP_WIN = true;
|
||||
}
|
||||
pointing_tap_codes(KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool process_record_pointing(uint16_t keycode, keyrecord_t* record) {
|
||||
switch (keycode) {
|
||||
case KC_ACCEL:
|
||||
enable_acceleration = record->event.pressed;
|
||||
break;
|
||||
case TD_DRGS:
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
break;
|
||||
case KC_BTN1:
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
break;
|
||||
case KB_MO_APP:
|
||||
// toggle Alt key off on key release and reset flag
|
||||
if(!record->event.pressed && APP_ALT) {
|
||||
unregister_code(KC_LALT);
|
||||
APP_ALT = false;
|
||||
}
|
||||
pointing_mode_key_momentary(PM_APP_2, record);
|
||||
break;
|
||||
case KB_TG_ACCEL:
|
||||
pointing_mode_key_toggle(PM_CUR_ACCEL, record);
|
||||
break; // continue key record processing
|
||||
case KB_MO_WINDOW:
|
||||
if(!record->event.pressed && APP_WIN) {
|
||||
unregister_code(KC_LGUI);
|
||||
APP_WIN = false;
|
||||
}
|
||||
pointing_mode_key_momentary(PM_WIN_POS, record);
|
||||
break;
|
||||
#if defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED)
|
||||
case PM_SWITCH:
|
||||
if (record->event.pressed) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ROUTE:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_X);
|
||||
}
|
||||
break;
|
||||
case ROTATE:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_R);
|
||||
}
|
||||
break;
|
||||
case DRAG_TRACKS:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_D);
|
||||
}
|
||||
break;
|
||||
case PLACE_VIA:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_V);
|
||||
}
|
||||
break;
|
||||
case TRACK_WIDTH:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_W);
|
||||
}
|
||||
break;
|
||||
case VIA_WIDTH:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_BACKSLASH);
|
||||
}
|
||||
break;
|
||||
case TRACK_POSTURE:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code(KC_SLASH);
|
||||
}
|
||||
break;
|
||||
case TRACK_CORNER_MODE:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
tap_code16(C(KC_SLASH));
|
||||
}
|
||||
break;
|
||||
case PMR_DRAG:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
set_pointing_mode_device(1);
|
||||
toggle_pointing_mode_id(2);
|
||||
}
|
||||
break;
|
||||
case PMR_LEFT:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
set_pointing_mode_device(0);
|
||||
toggle_pointing_mode_id(2);
|
||||
}
|
||||
break;
|
||||
case PMR_VOL:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
set_pointing_mode_device(1);
|
||||
toggle_pointing_mode_id(5);
|
||||
}
|
||||
break;
|
||||
case PML_VOL:
|
||||
if (record->event.pressed) {
|
||||
drv2605l_pulse(DRV2605L_EFFECT_MEDIUM_CLICK_1_100);
|
||||
set_pointing_mode_device(0);
|
||||
toggle_pointing_mode_id(5);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
|
||||
bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||
switch (keycode) {
|
||||
case KC_ACCEL:
|
||||
case TD_DRGS:
|
||||
case TD_DRGR:
|
||||
case BK_TAB:
|
||||
case NX_TAB:
|
||||
case TD_PMD1:
|
||||
case ST_MACRO_6:
|
||||
case KB_MO_WINDOW:
|
||||
case KB_MO_APP:
|
||||
case ROUTE:
|
||||
case ROTATE:
|
||||
case DRAG_TRACKS:
|
||||
case PLACE_VIA:
|
||||
case TRACK_WIDTH:
|
||||
case VIA_WIDTH:
|
||||
case TRACK_POSTURE:
|
||||
case TRACK_CORNER_MODE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
12
users/freznel/pointing/pointing.h
Normal file
12
users/freznel/pointing/pointing.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
|
||||
void pointing_device_init_keymap(void);
|
||||
report_mouse_t pointing_device_task_keymap(report_mouse_t mouse_report);
|
||||
void matrix_scan_pointing(void);
|
||||
bool process_record_pointing(uint16_t keycode, keyrecord_t* record);
|
||||
layer_state_t layer_state_set_pointing(layer_state_t state);
|
||||
extern bool enable_acceleration;
|
||||
137
users/freznel/post_config.h
Normal file
137
users/freznel/post_config.h
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// because layouts seem to not be respecting config.h order atm
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# undef RGBLIGHT_ANIMATIONS
|
||||
# if defined(__AVR__) && (!defined(__AVR_AT90USB1286__) && !defined(RGBLIGHT_ALL_ANIMATIONS))
|
||||
# define RGBLIGHT_EFFECT_BREATHING
|
||||
# define RGBLIGHT_EFFECT_SNAKE
|
||||
# define RGBLIGHT_EFFECT_KNIGHT
|
||||
# else
|
||||
# define RGBLIGHT_EFFECT_BREATHING
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
# define RGBLIGHT_EFFECT_SNAKE
|
||||
# define RGBLIGHT_EFFECT_KNIGHT
|
||||
# if defined(RGBLIGHT_ALL_ANIMATIONS)
|
||||
# define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
# define RGBLIGHT_EFFECT_RGB_TEST
|
||||
# define RGBLIGHT_EFFECT_ALTERNATING
|
||||
# endif
|
||||
# define RGBLIGHT_EFFECT_TWINKLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# ifndef RGB_MATRIX_REST_MODE
|
||||
# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
|
||||
# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
# else
|
||||
# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
|
||||
# endif
|
||||
# endif
|
||||
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE
|
||||
#endif
|
||||
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
// mouse movement config
|
||||
# ifdef MK_3_SPEED
|
||||
# undef MK_3_SPEED
|
||||
# endif
|
||||
# define MK_KINETIC_SPEED
|
||||
# ifdef MK_KINETIC_SPEED
|
||||
# ifndef MOUSEKEY_DELAY
|
||||
# define MOUSEKEY_DELAY 8
|
||||
# endif
|
||||
# ifndef MOUSEKEY_INTERVAL
|
||||
# define MOUSEKEY_INTERVAL 20
|
||||
# endif
|
||||
# ifndef MOUSEKEY_MOVE_DELTA
|
||||
# define MOUSEKEY_MOVE_DELTA 25
|
||||
# endif
|
||||
# else
|
||||
# ifndef MOUSEKEY_DELAY
|
||||
# define MOUSEKEY_DELAY 300
|
||||
# endif
|
||||
# ifndef MOUSEKEY_INTERVAL
|
||||
# define MOUSEKEY_INTERVAL 50
|
||||
# endif
|
||||
# ifndef MOUSEKEY_MOVE_DELTA
|
||||
# define MOUSEKEY_MOVE_DELTA 5
|
||||
# endif
|
||||
# endif
|
||||
# ifndef MOUSEKEY_MAX_SPEED
|
||||
# define MOUSEKEY_MAX_SPEED 7
|
||||
# endif
|
||||
# ifndef MOUSEKEY_TIME_TO_MAX
|
||||
# define MOUSEKEY_TIME_TO_MAX 60
|
||||
# endif
|
||||
# ifndef MOUSEKEY_INITIAL_SPEED
|
||||
# define MOUSEKEY_INITIAL_SPEED 100
|
||||
# endif
|
||||
# ifndef MOUSEKEY_BASE_SPEED
|
||||
# define MOUSEKEY_BASE_SPEED 1000
|
||||
# endif
|
||||
# ifndef MOUSEKEY_DECELERATED_SPEED
|
||||
# define MOUSEKEY_DECELERATED_SPEED 400
|
||||
# endif
|
||||
# ifndef MOUSEKEY_ACCELERATED_SPEED
|
||||
# define MOUSEKEY_ACCELERATED_SPEED 3000
|
||||
# endif
|
||||
// mouse scroll config
|
||||
# ifndef MOUSEKEY_WHEEL_DELAY
|
||||
# define MOUSEKEY_WHEEL_DELAY 15
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_DELTA
|
||||
# define MOUSEKEY_WHEEL_DELTA 1
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_INTERVAL
|
||||
# define MOUSEKEY_WHEEL_INTERVAL 50
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_MAX_SPEED
|
||||
# define MOUSEKEY_WHEEL_MAX_SPEED 8
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_TIME_TO_MAX
|
||||
# define MOUSEKEY_WHEEL_TIME_TO_MAX 80
|
||||
# endif
|
||||
// mouse scroll kinetic config
|
||||
# ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS
|
||||
# define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS
|
||||
# define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS
|
||||
# define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48
|
||||
# endif
|
||||
# ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS
|
||||
# define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8
|
||||
# endif
|
||||
#endif // MOUSEKEY_ENABLE
|
||||
|
||||
#define MOUSE_EXTENDED_REPORT
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
|
||||
# define DYNAMIC_KEYMAP_LAYER_COUNT 12
|
||||
#endif
|
||||
|
||||
#ifndef TAPPING_TERM
|
||||
# define TAPPING_TERM 250
|
||||
#endif
|
||||
|
||||
#ifndef SECURE_UNLOCK_SEQUENCE
|
||||
# define SECURE_UNLOCK_SEQUENCE \
|
||||
{ \
|
||||
{2, 1}, {2, 2}, {2, 3}, { \
|
||||
2, 4 \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SPLIT_KEYBOARD) && defined(PROTOCOL_CHIBIOS) && !defined(USB_SUSPEND_WAKEUP_DELAY)
|
||||
# define USB_SUSPEND_WAKEUP_DELAY 200
|
||||
#endif
|
||||
3
users/freznel/readme.md
Normal file
3
users/freznel/readme.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Summary
|
||||
|
||||
This is my personal userspace file whicn is mostly based on @drasha's userspace code.
|
||||
107
users/freznel/rgb/rgb_matrix_config.h
Normal file
107
users/freznel/rgb/rgb_matrix_config.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot)
|
||||
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened)
|
||||
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
|
||||
|
||||
#undef ENABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
#undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
#undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
|
||||
#undef ENABLE_RGB_MATRIX_BREATHING
|
||||
#undef ENABLE_RGB_MATRIX_BAND_SAT
|
||||
#undef ENABLE_RGB_MATRIX_BAND_VAL
|
||||
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_ALL
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
#undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
#undef ENABLE_RGB_MATRIX_DUAL_BEACON
|
||||
#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
#undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
#undef ENABLE_RGB_MATRIX_RAINDROPS
|
||||
#undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
#undef ENABLE_RGB_MATRIX_HUE_BREATHING
|
||||
#undef ENABLE_RGB_MATRIX_HUE_PENDULUM
|
||||
#undef ENABLE_RGB_MATRIX_HUE_WAVE
|
||||
#undef ENABLE_RGB_MATRIX_PIXEL_RAIN
|
||||
#undef ENABLE_RGB_MATRIX_PIXEL_FLOW
|
||||
#undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL
|
||||
// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined
|
||||
#undef ENABLE_RGB_MATRIX_TYPING_HEATMAP
|
||||
#undef ENABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
#undef ENABLE_RGB_MATRIX_SPLASH
|
||||
#undef ENABLE_RGB_MATRIX_MULTISPLASH
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
#undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
|
||||
#define ENABLE_RGB_MATRIX_TYPING_HEATMAP
|
||||
#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
#if !defined(SPLIT_KEYBOARD) && !defined(KEYBOARD_ergodox_ez) && !defined(KEYBOARD_moonlander)
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
#endif
|
||||
#if defined(__arm__) || defined(__AVR_AT90USB1286__) || defined(KEYBOARD_launchpad)
|
||||
// RGB Matrix Animation modes. Explicitly enabled
|
||||
// For full list of effects, see:
|
||||
// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects
|
||||
# define ENABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
|
||||
# define ENABLE_RGB_MATRIX_BREATHING
|
||||
# define ENABLE_RGB_MATRIX_BAND_SAT
|
||||
# define ENABLE_RGB_MATRIX_BAND_VAL
|
||||
# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_ALL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
# define ENABLE_RGB_MATRIX_DUAL_BEACON
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
# define ENABLE_RGB_MATRIX_RAINDROPS
|
||||
# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
# define ENABLE_RGB_MATRIX_HUE_BREATHING
|
||||
# define ENABLE_RGB_MATRIX_HUE_PENDULUM
|
||||
# define ENABLE_RGB_MATRIX_HUE_WAVE
|
||||
# define ENABLE_RGB_MATRIX_PIXEL_RAIN
|
||||
# define ENABLE_RGB_MATRIX_PIXEL_FLOW
|
||||
# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
|
||||
# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
# define ENABLE_RGB_MATRIX_SPLASH
|
||||
# define ENABLE_RGB_MATRIX_MULTISPLASH
|
||||
# define ENABLE_RGB_MATRIX_SOLID_SPLASH
|
||||
# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||
#endif // AVR
|
||||
173
users/freznel/rgb/rgb_matrix_stuff.c
Normal file
173
users/freznel/rgb/rgb_matrix_stuff.c
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2021-2022 Freznel (@freznel10) <freznel@gmail.com
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
#include "rgb_matrix.h"
|
||||
#include "lib/lib8tion/lib8tion.h"
|
||||
#include "users/freznel/pointing/pointing.h"
|
||||
extern led_config_t g_led_config;
|
||||
|
||||
|
||||
static uint32_t hypno_timer;
|
||||
|
||||
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) {
|
||||
HSV hsv = {hue, sat, val};
|
||||
if (hsv.v > rgb_matrix_get_val()) {
|
||||
hsv.v = rgb_matrix_get_val();
|
||||
}
|
||||
switch (mode) {
|
||||
case 1: // breathing
|
||||
{
|
||||
uint16_t time = scale16by8(g_rgb_timer, speed / 8);
|
||||
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
|
||||
if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Gradient
|
||||
{
|
||||
uint8_t scale = scale8(64, speed);
|
||||
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
|
||||
if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
|
||||
hsv.h = hsv.h + (scale * g_led_config.point[i].x >> 10);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: // Solid Color
|
||||
{
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
|
||||
if (HAS_FLAGS(g_led_config.flags[i], led_type)) {
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) void rgb_matrix_indicator_keymap(void) {}
|
||||
|
||||
void housekeeping_task_rgb_matrix(void) {
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
|
||||
if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) {
|
||||
rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
|
||||
}
|
||||
#endif
|
||||
rgb_matrix_indicator_keymap();
|
||||
}
|
||||
|
||||
void keyboard_post_init_rgb_matrix(void) {
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
|
||||
if (userspace_config.rgb_matrix_idle_anim) {
|
||||
rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
|
||||
}
|
||||
#endif
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW | LED_FLAG_KEYLIGHT | LED_FLAG_INDICATOR | LED_FLAG_MODIFIER );
|
||||
} else {
|
||||
rgb_matrix_set_flags(LED_FLAG_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
|
||||
hypno_timer = sync_timer_read32();
|
||||
if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_REST_MODE) {
|
||||
rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
|
||||
}
|
||||
#endif
|
||||
switch (keycode) {
|
||||
case RGB_IDL: // This allows me to use underglow as layer indication, or as normal
|
||||
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
|
||||
if (record->event.pressed) {
|
||||
userspace_config.rgb_matrix_idle_anim ^= 1;
|
||||
dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
if (userspace_config.rgb_matrix_idle_anim) {
|
||||
rgb_matrix_mode_noeeprom(RGB_MATRIX_TYPING_HEATMAP);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
||||
return true;
|
||||
}
|
||||
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
if (!rgb_matrix_indicators_advanced_keymap(led_min, led_max)) {
|
||||
return false;
|
||||
}
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (!userspace_config.rgb_layer_change)
|
||||
#else
|
||||
if (userspace_config.rgb_layer_change)
|
||||
#endif
|
||||
{
|
||||
switch (get_highest_layer(layer_state & ~((layer_state_t)1 << _MOUSE))) {
|
||||
case _RAISE:
|
||||
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _LOWER:
|
||||
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _ADJUST:
|
||||
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _KEYPAD:
|
||||
rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
break;
|
||||
default:
|
||||
if (layer_state_is(_MOUSE)) {
|
||||
rgb_matrix_layer_helper(HSV_PURPLE, 0, rgb_matrix_config.speed, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
}
|
||||
else if (host_keyboard_led_state().caps_lock) {
|
||||
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
} else {
|
||||
switch (get_highest_layer(default_layer_state)) {
|
||||
case _DEFAULT_LAYER_1:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_KEYLIGHT, led_min, led_max);
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _DEFAULT_LAYER_2:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
break;
|
||||
case _DEFAULT_LAYER_3:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
break;
|
||||
case _DEFAULT_LAYER_4:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool rgb_matrix_indicators_keymap(void) {
|
||||
return true;
|
||||
}
|
||||
bool rgb_matrix_indicators_user(void) {
|
||||
return rgb_matrix_indicators_keymap();
|
||||
}
|
||||
32
users/freznel/rgb/rgb_matrix_stuff.h
Normal file
32
users/freznel/rgb/rgb_matrix_stuff.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include "quantum.h"
|
||||
|
||||
bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record);
|
||||
void keyboard_post_init_rgb_matrix(void);
|
||||
void housekeeping_task_rgb_matrix(void);
|
||||
|
||||
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
|
||||
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max);
|
||||
|
||||
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max);
|
||||
bool rgb_matrix_indicators_keymap(void);
|
||||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include "quantum.h"
|
||||
|
||||
bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record);
|
||||
void keyboard_post_init_rgb_matrix(void);
|
||||
void housekeeping_task_rgb_matrix(void);
|
||||
|
||||
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
|
||||
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max);
|
||||
|
||||
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max);
|
||||
bool rgb_matrix_indicators_keymap(void);
|
||||
|
||||
extern bool tap_toggling, enable_acceleration, is_drag_mom, is_media, scrolling_mode, is_caret;
|
||||
124
users/freznel/rgb/rgb_stuff.c
Normal file
124
users/freznel/rgb/rgb_stuff.c
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "freznel.h"
|
||||
#include "rgb_stuff.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
bool has_initialized;
|
||||
|
||||
void rgblight_sethsv_default_helper(uint8_t index) {
|
||||
rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index);
|
||||
}
|
||||
void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
|
||||
rgblight_sethsv_noeeprom(hue, sat, val);
|
||||
// wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
|
||||
rgblight_mode_noeeprom(mode);
|
||||
}
|
||||
|
||||
bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(RGBLIGHT_STARTUP_ANIMATION)
|
||||
static bool is_enabled;
|
||||
static bool is_rgblight_startup;
|
||||
static HSV old_hsv;
|
||||
static uint8_t old_mode;
|
||||
deferred_token rgb_startup_token;
|
||||
|
||||
uint32_t rgb_startup_animation(uint32_t triger_time, void *cb_arg) {
|
||||
if (is_rgblight_startup && is_keyboard_master()) {
|
||||
static uint8_t counter = 0;
|
||||
counter++;
|
||||
rgblight_sethsv_noeeprom((counter + old_hsv.h) % 255, 255, 255);
|
||||
if (counter >= 255) {
|
||||
is_rgblight_startup = false;
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
layer_state_set_rgb_light(layer_state);
|
||||
} else {
|
||||
rgblight_set_hsv_and_mode(old_hsv.h, old_hsv.s, old_hsv.v, old_mode);
|
||||
}
|
||||
if (!is_enabled) {
|
||||
rgblight_disable_noeeprom();
|
||||
}
|
||||
}
|
||||
}
|
||||
return is_rgblight_startup ? 10 : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void keyboard_post_init_rgb_light(void) {
|
||||
#if defined(RGBLIGHT_STARTUP_ANIMATION)
|
||||
is_enabled = rgblight_is_enabled();
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
layer_state_set_rgb_light(layer_state);
|
||||
}
|
||||
old_hsv = rgblight_get_hsv();
|
||||
old_mode = rgblight_get_mode();
|
||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
is_rgblight_startup = true;
|
||||
rgb_startup_token = defer_exec(300, rgb_startup_animation, NULL);
|
||||
#endif
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
layer_state_set_rgb_light(layer_state);
|
||||
}
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_rgb_light(layer_state_t state) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
switch (get_highest_layer(state & ~((layer_state_t)1 << _MOUSE))) {
|
||||
case _MEDIA:
|
||||
rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1);
|
||||
break;
|
||||
case _GAMEPAD:
|
||||
rgblight_set_hsv_and_mode(HSV_ORANGE, RGBLIGHT_MODE_SNAKE + 2);
|
||||
break;
|
||||
// case _DIABLO:
|
||||
// case _DIABLOII:
|
||||
// rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3);
|
||||
// break;
|
||||
case _RAISE:
|
||||
rgblight_set_hsv_and_mode(HSV_YELLOW, RGBLIGHT_MODE_BREATHING + 3);
|
||||
break;
|
||||
case _LOWER:
|
||||
rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3);
|
||||
break;
|
||||
case _ADJUST:
|
||||
rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2);
|
||||
break;
|
||||
default:
|
||||
if (layer_state_cmp(state, _MOUSE)) {
|
||||
# if defined(RGBLIGHT_EFFECT_TWINKLE)
|
||||
rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_TWINKLE + 5);
|
||||
# else
|
||||
rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3);
|
||||
# endif
|
||||
} else {
|
||||
default_layer_state_set_rgb_light(default_layer_state);
|
||||
}
|
||||
}
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
layer_state_t default_layer_state_set_rgb_light(layer_state_t state) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _DEFAULT_LAYER_1:
|
||||
rgblight_set_hsv_and_mode(DEFAULT_LAYER_1_HSV, RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
break;
|
||||
case _DEFAULT_LAYER_2:
|
||||
rgblight_set_hsv_and_mode(DEFAULT_LAYER_2_HSV, RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
break;
|
||||
case _DEFAULT_LAYER_3:
|
||||
rgblight_set_hsv_and_mode(DEFAULT_LAYER_3_HSV, RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
break;
|
||||
case _DEFAULT_LAYER_4:
|
||||
rgblight_set_hsv_and_mode(DEFAULT_LAYER_4_HSV, RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
12
users/freznel/rgb/rgb_stuff.h
Normal file
12
users/freznel/rgb/rgb_stuff.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include "quantum.h"
|
||||
|
||||
bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record);
|
||||
void keyboard_post_init_rgb_light(void);
|
||||
void matrix_scan_rgb_light(void);
|
||||
layer_state_t layer_state_set_rgb_light(layer_state_t state);
|
||||
layer_state_t default_layer_state_set_rgb_light(layer_state_t state);
|
||||
void rgblight_sethsv_default_helper(uint8_t index);
|
||||
121
users/freznel/rgblight_breathe_table.h
Normal file
121
users/freznel/rgblight_breathe_table.h
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifndef RGBLIGHT_EFFECT_BREATHE_TABLE
|
||||
#define RGBLIGHT_EFFECT_BREATHE_TABLE
|
||||
|
||||
// clang-format off
|
||||
const uint8_t rgblight_effect_breathe_table[] PROGMEM = {
|
||||
/* #define RGBLIGHT_EFFECT_BREATHE_CENTER 0.00 */
|
||||
/* #define RGBLIGHT_EFFECT_BREATHE_MAX 255 */
|
||||
|
||||
#if RGBLIGHT_BREATHE_TABLE_SIZE == 256
|
||||
0x44, 0x45, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x4e,
|
||||
0x4f, 0x51, 0x52, 0x54, 0x55, 0x57, 0x58, 0x5a,
|
||||
0x5c, 0x5d, 0x5f, 0x60, 0x62, 0x64, 0x65, 0x67,
|
||||
0x69, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x73, 0x75,
|
||||
0x77, 0x79, 0x7b, 0x7c, 0x7e, 0x80, 0x82, 0x84,
|
||||
0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8f, 0x91, 0x93,
|
||||
0x95, 0x97, 0x99, 0x9b, 0x9d, 0x9f, 0xa1, 0xa3,
|
||||
0xa5, 0xa7, 0xa9, 0xaa, 0xac, 0xae, 0xb0, 0xb2,
|
||||
0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, 0xbf, 0xc1,
|
||||
0xc3, 0xc5, 0xc7, 0xc9, 0xca, 0xcc, 0xce, 0xd0,
|
||||
0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda, 0xdb, 0xdd,
|
||||
0xde, 0xe0, 0xe1, 0xe3, 0xe4, 0xe5, 0xe7, 0xe8,
|
||||
0xe9, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1,
|
||||
0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf8,
|
||||
0xf9, 0xfa, 0xfa, 0xfb, 0xfc, 0xfc, 0xfc, 0xfd,
|
||||
0xfd, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
|
||||
0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd,
|
||||
0xfd, 0xfc, 0xfc, 0xfc, 0xfb, 0xfa, 0xfa, 0xf9,
|
||||
0xf8, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2,
|
||||
0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, 0xeb, 0xe9,
|
||||
0xe8, 0xe7, 0xe5, 0xe4, 0xe3, 0xe1, 0xe0, 0xde,
|
||||
0xdd, 0xdb, 0xda, 0xd8, 0xd6, 0xd5, 0xd3, 0xd1,
|
||||
0xd0, 0xce, 0xcc, 0xca, 0xc9, 0xc7, 0xc5, 0xc3,
|
||||
0xc1, 0xbf, 0xbe, 0xbc, 0xba, 0xb8, 0xb6, 0xb4,
|
||||
0xb2, 0xb0, 0xae, 0xac, 0xaa, 0xa9, 0xa7, 0xa5,
|
||||
0xa3, 0xa1, 0x9f, 0x9d, 0x9b, 0x99, 0x97, 0x95,
|
||||
0x93, 0x91, 0x8f, 0x8d, 0x8b, 0x8a, 0x88, 0x86,
|
||||
0x84, 0x82, 0x80, 0x7e, 0x7c, 0x7b, 0x79, 0x77,
|
||||
0x75, 0x73, 0x72, 0x70, 0x6e, 0x6c, 0x6a, 0x69,
|
||||
0x67, 0x65, 0x64, 0x62, 0x60, 0x5f, 0x5d, 0x5c,
|
||||
0x5a, 0x58, 0x57, 0x55, 0x54, 0x52, 0x51, 0x4f,
|
||||
0x4e, 0x4c, 0x4b, 0x4a, 0x48, 0x47, 0x45, 0x44
|
||||
#endif /* 256 bytes table */
|
||||
|
||||
#if RGBLIGHT_BREATHE_TABLE_SIZE == 128
|
||||
0x44, 0x47, 0x4a, 0x4c,
|
||||
0x4f, 0x52, 0x55, 0x58,
|
||||
0x5c, 0x5f, 0x62, 0x65,
|
||||
0x69, 0x6c, 0x70, 0x73,
|
||||
0x77, 0x7b, 0x7e, 0x82,
|
||||
0x86, 0x8a, 0x8d, 0x91,
|
||||
0x95, 0x99, 0x9d, 0xa1,
|
||||
0xa5, 0xa9, 0xac, 0xb0,
|
||||
0xb4, 0xb8, 0xbc, 0xbf,
|
||||
0xc3, 0xc7, 0xca, 0xce,
|
||||
0xd1, 0xd5, 0xd8, 0xdb,
|
||||
0xde, 0xe1, 0xe4, 0xe7,
|
||||
0xe9, 0xec, 0xee, 0xf0,
|
||||
0xf2, 0xf4, 0xf6, 0xf8,
|
||||
0xf9, 0xfa, 0xfc, 0xfc,
|
||||
0xfd, 0xfe, 0xfe, 0xfe,
|
||||
0xfe, 0xfe, 0xfe, 0xfe,
|
||||
0xfd, 0xfc, 0xfb, 0xfa,
|
||||
0xf8, 0xf7, 0xf5, 0xf3,
|
||||
0xf1, 0xef, 0xed, 0xeb,
|
||||
0xe8, 0xe5, 0xe3, 0xe0,
|
||||
0xdd, 0xda, 0xd6, 0xd3,
|
||||
0xd0, 0xcc, 0xc9, 0xc5,
|
||||
0xc1, 0xbe, 0xba, 0xb6,
|
||||
0xb2, 0xae, 0xaa, 0xa7,
|
||||
0xa3, 0x9f, 0x9b, 0x97,
|
||||
0x93, 0x8f, 0x8b, 0x88,
|
||||
0x84, 0x80, 0x7c, 0x79,
|
||||
0x75, 0x72, 0x6e, 0x6a,
|
||||
0x67, 0x64, 0x60, 0x5d,
|
||||
0x5a, 0x57, 0x54, 0x51,
|
||||
0x4e, 0x4b, 0x48, 0x45
|
||||
#endif /* 128 bytes table */
|
||||
|
||||
#if RGBLIGHT_BREATHE_TABLE_SIZE == 64
|
||||
0x44, 0x4a,
|
||||
0x4f, 0x55,
|
||||
0x5c, 0x62,
|
||||
0x69, 0x70,
|
||||
0x77, 0x7e,
|
||||
0x86, 0x8d,
|
||||
0x95, 0x9d,
|
||||
0xa5, 0xac,
|
||||
0xb4, 0xbc,
|
||||
0xc3, 0xca,
|
||||
0xd1, 0xd8,
|
||||
0xde, 0xe4,
|
||||
0xe9, 0xee,
|
||||
0xf2, 0xf6,
|
||||
0xf9, 0xfc,
|
||||
0xfd, 0xfe,
|
||||
0xfe, 0xfe,
|
||||
0xfd, 0xfb,
|
||||
0xf8, 0xf5,
|
||||
0xf1, 0xed,
|
||||
0xe8, 0xe3,
|
||||
0xdd, 0xd6,
|
||||
0xd0, 0xc9,
|
||||
0xc1, 0xba,
|
||||
0xb2, 0xaa,
|
||||
0xa3, 0x9b,
|
||||
0x93, 0x8b,
|
||||
0x84, 0x7c,
|
||||
0x75, 0x6e,
|
||||
0x67, 0x60,
|
||||
0x5a, 0x54,
|
||||
0x4e, 0x48
|
||||
#endif /* 64 bytes table */
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static const int table_scale = 256 / sizeof(rgblight_effect_breathe_table);
|
||||
|
||||
#endif /* RGBLIGHT_EFFECT_BREATHE_TABLE */
|
||||
152
users/freznel/rules.mk
Normal file
152
users/freznel/rules.mk
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
SRC += $(USER_PATH)/freznel.c \
|
||||
$(USER_PATH)/callbacks.c \
|
||||
$(USER_PATH)/keyrecords/process_records.c \
|
||||
$(USER_PATH)/keyrecords/tapping.c
|
||||
|
||||
# TOP_SYMBOLS = yes
|
||||
|
||||
ifneq ($(PLATFORM),CHIBIOS)
|
||||
ifneq ($(strip $(LTO_SUPPORTED)), no)
|
||||
LTO_ENABLE = yes
|
||||
endif
|
||||
SPACE_CADET_ENABLE = no
|
||||
GRAVE_ESC_ENABLE = no
|
||||
endif
|
||||
# DEBUG_MATRIX_SCAN_RATE_ENABLE = api
|
||||
ifneq ($(strip $(NO_SECRETS)), yes)
|
||||
ifneq ("$(wildcard $(USER_PATH)/../../../qmk_secrets/secrets.c)","")
|
||||
SRC += $(USER_PATH)/../../../qmk_secrets/secrets.c
|
||||
$(shell touch $(USER_PATH)/../../../qmk_secrets/secrets.c)
|
||||
SECURE_ENABLE = yes
|
||||
endif
|
||||
ifeq ($(strip $(NO_SECRETS)), lite)
|
||||
OPT_DEFS += -DNO_SECRETS
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(MAKE_BOOTLOADER)), yes)
|
||||
OPT_DEFS += -DMAKE_BOOTLOADER
|
||||
endif
|
||||
|
||||
# At least until build.mk or the like drops, this is here to prevent
|
||||
# VUSB boards from enabling NKRO, as they do not support it. Ideally
|
||||
# this should be handled per keyboard, but until that happens ...
|
||||
ifeq ($(strip $(PROTOCOL)), VUSB)
|
||||
NKRO_ENABLE := no
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(PER_KEY_TAPPING)), yes)
|
||||
OPT_DEFS += -DPER_KEY_TAPPING
|
||||
endif
|
||||
|
||||
CUSTOM_UNICODE_ENABLE ?= yes
|
||||
ifeq ($(strip $(CUSTOM_UNICODE_ENABLE)), yes)
|
||||
UNICODE_ENABLE := no
|
||||
UNICODEMAP_ENABLE := no
|
||||
UCIS_ENABLE := no
|
||||
UNICODE_COMMON := yes
|
||||
OPT_DEFS += -DCUSTOM_UNICODE_ENABLE
|
||||
SRC += $(USER_PATH)/keyrecords/unicode.c
|
||||
endif
|
||||
|
||||
CUSTOM_TAP_DANCE ?= yes
|
||||
ifeq ($(strip $(CUSTOM_TAP_DANCE)), yes)
|
||||
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
|
||||
SRC += $(USER_PATH)/keyrecords/tap_dances.c
|
||||
endif
|
||||
endif
|
||||
|
||||
CUSTOM_RGBLIGHT ?= yes
|
||||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||
ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes)
|
||||
SRC += $(USER_PATH)/rgb/rgb_stuff.c
|
||||
OPT_DEFS += -DCUSTOM_RGBLIGHT
|
||||
ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
|
||||
OPT_DEFS += -DRGBLIGHT_NOEEPROM
|
||||
endif
|
||||
ifeq ($(strip $(RGBLIGHT_STARTUP_ANIMATION)), yes)
|
||||
OPT_DEFS += -DRGBLIGHT_STARTUP_ANIMATION
|
||||
DEFERRED_EXEC_ENABLE = yes
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
CUSTOM_RGB_MATRIX ?= yes
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
|
||||
ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes)
|
||||
SRC += $(USER_PATH)/rgb/rgb_matrix_stuff.c
|
||||
OPT_DEFS += -DCUSTOM_RGB_MATRIX
|
||||
endif
|
||||
endif
|
||||
|
||||
KEYLOGGER_ENABLE ?= no
|
||||
ifdef CONSOLE_ENABLE
|
||||
ifeq ($(strip $(KEYLOGGER_ENABLE)), yes)
|
||||
OPT_DEFS += -DKEYLOGGER_ENABLE
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(I2C_SCANNER_ENABLE)), yes)
|
||||
OPT_DEFS += -DI2C_SCANNER_ENABLE
|
||||
CONSOLE_ENABLE := yes
|
||||
endif
|
||||
|
||||
CUSTOM_OLED_DRIVER ?= yes
|
||||
ifeq ($(strip $(OLED_ENABLE)), yes)
|
||||
ifeq ($(strip $(OLED_DRIVER)), custom)
|
||||
OPT_DEFS += -DOLED_ENABLE \
|
||||
-DOLED_DRIVER_SH1107
|
||||
SRC += $(USER_PATH)/oled/sh110x.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes)
|
||||
OPT_DEFS += -DCUSTOM_OLED_DRIVER
|
||||
SRC += $(USER_PATH)/oled/oled_stuff.c
|
||||
endif
|
||||
ifeq ($(strip $(OLED_DISPLAY_TEST)), yes)
|
||||
OPT_DEFS += -DOLED_DISPLAY_TEST
|
||||
endif
|
||||
DEFERRED_EXEC_ENABLE = yes
|
||||
endif
|
||||
|
||||
CUSTOM_POINTING_DEVICE ?= yes
|
||||
ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
|
||||
ifeq ($(strip $(CUSTOM_POINTING_DEVICE)), yes)
|
||||
SRC += $(USER_PATH)/pointing/pointing.c
|
||||
OPT_DEFS += -DCUSTOM_POINTING_DEVICE
|
||||
OPT_DEFS += -DPOINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
OPT_DEFS += -DPOINTING_DEVICE_SCROLL_ENABLE
|
||||
endif
|
||||
endif
|
||||
|
||||
CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes
|
||||
ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes)
|
||||
ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
|
||||
QUANTUM_LIB_SRC += $(USER_PATH)/split/transport_sync.c
|
||||
OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(AUTOCORRECTION_ENABLE)), yes)
|
||||
AUTOCORRECT_ENABLE = yes
|
||||
endif
|
||||
|
||||
SUPER_ALT_TAB_ENABLE ?= no
|
||||
ifeq ($(strip $(SUPER_ALT_TAB_ENABLE)), yes)
|
||||
SRC +=super_alt_tab.c
|
||||
OPT_DEFS += -DSUPER_ALT_TAB_ENABLE
|
||||
endif
|
||||
|
||||
CUSTOM_DYNAMIC_MACROS_ENABLE ?= no
|
||||
ifeq ($(strip $(CUSTOM_DYNAMIC_MACROS_ENABLE)), yes)
|
||||
SRC += $(USER_PATH)/keyrecords/dynamic_macros.c
|
||||
OPT_DEFS += -DCUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
endif
|
||||
|
||||
CUSTOM_KEYLOGGER ?= no
|
||||
|
||||
HAPTIC_ENABLE = yes
|
||||
HAPTIC_DRIVER = drv2605l
|
||||
|
||||
SRC += keyrecords/select_word.c
|
||||
22
users/freznel/split/split_config.h
Normal file
22
users/freznel/split/split_config.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SPLIT_TRANSPORT_MIRROR
|
||||
#define SPLIT_LAYER_STATE_ENABLE
|
||||
#define SPLIT_LED_STATE_ENABLE
|
||||
#define SPLIT_MODS_ENABLE
|
||||
#define SPLIT_WATCHDOG_ENABLE
|
||||
#ifdef WPM_ENABLE
|
||||
# define SPLIT_WPM_ENABLE
|
||||
#endif
|
||||
#ifdef OLED_ENABLE
|
||||
# undef SPLIT_OLED_ENABLE
|
||||
#endif
|
||||
#if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED)
|
||||
# define SELECT_SOFT_SERIAL_SPEED 1
|
||||
#endif
|
||||
#ifdef CUSTOM_SPLIT_TRANSPORT_SYNC
|
||||
# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_PLACEHOLDER, RPC_ID_USER_KEYLOG_STR
|
||||
#endif
|
||||
220
users/freznel/split/transport_sync.c
Normal file
220
users/freznel/split/transport_sync.c
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "transport_sync.h"
|
||||
#include "transactions.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
# include "process_unicode_common.h"
|
||||
extern unicode_config_t unicode_config;
|
||||
# include "keyrecords/unicode.h"
|
||||
#endif
|
||||
#ifdef AUDIO_ENABLE
|
||||
# include "audio.h"
|
||||
extern audio_config_t audio_config;
|
||||
extern bool delayed_tasks_run;
|
||||
#endif
|
||||
#if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER)
|
||||
extern bool is_oled_enabled;
|
||||
#endif
|
||||
#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
|
||||
extern bool tap_toggling;
|
||||
#endif
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
extern bool swap_hands;
|
||||
#endif
|
||||
|
||||
extern userspace_config_t userspace_config;
|
||||
extern bool host_driver_disabled;
|
||||
|
||||
|
||||
uint16_t transport_keymap_config = 0;
|
||||
uint32_t transport_userspace_config = 0, transport_user_state = 0;
|
||||
|
||||
user_runtime_config_t user_state;
|
||||
|
||||
void user_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
|
||||
if (initiator2target_buffer_size == sizeof(transport_user_state)) {
|
||||
memcpy(&transport_user_state, initiator2target_buffer, initiator2target_buffer_size);
|
||||
}
|
||||
}
|
||||
void user_keymap_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
|
||||
if (initiator2target_buffer_size == sizeof(transport_keymap_config)) {
|
||||
memcpy(&transport_keymap_config, initiator2target_buffer, initiator2target_buffer_size);
|
||||
}
|
||||
}
|
||||
void user_config_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
|
||||
if (initiator2target_buffer_size == sizeof(transport_userspace_config)) {
|
||||
memcpy(&transport_userspace_config, initiator2target_buffer, initiator2target_buffer_size);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CUSTOM_KEYLOGGER
|
||||
// # include "./oled/oled_stuff.h"
|
||||
void keylogger_string_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
|
||||
if (initiator2target_buffer_size == KEYLOGGER_LENGTH) {
|
||||
memcpy(&painter_keylog_str, initiator2target_buffer, initiator2target_buffer_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void keyboard_post_init_transport_sync(void) {
|
||||
// Register keyboard state sync split transaction
|
||||
transaction_register_rpc(RPC_ID_USER_STATE_SYNC, user_state_sync);
|
||||
transaction_register_rpc(RPC_ID_USER_KEYMAP_SYNC, user_keymap_sync);
|
||||
transaction_register_rpc(RPC_ID_USER_CONFIG_SYNC, user_config_sync);
|
||||
#ifdef CUSTOM_KEYLOGGER
|
||||
transaction_register_rpc(RPC_ID_USER_KEYLOG_STR, keylogger_string_sync);
|
||||
#endif
|
||||
}
|
||||
|
||||
void user_transport_update(void) {
|
||||
if (is_keyboard_master()) {
|
||||
transport_keymap_config = keymap_config.raw;
|
||||
transport_userspace_config = userspace_config.raw;
|
||||
#ifdef AUDIO_ENABLE
|
||||
user_state.audio_enable = is_audio_on();
|
||||
user_state.audio_clicky_enable = is_clicky_on();
|
||||
#endif
|
||||
#if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER)
|
||||
user_state.is_oled_enabled = is_oled_enabled;
|
||||
#endif
|
||||
#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
|
||||
user_state.tap_toggling = get_auto_mouse_toggle();
|
||||
#endif
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
user_state.unicode_mode = unicode_config.input_mode;
|
||||
user_state.unicode_typing_mode = unicode_typing_mode;
|
||||
#endif
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
user_state.swap_hands = swap_hands;
|
||||
#endif
|
||||
user_state.is_caps_word_on = is_caps_word_on();
|
||||
user_state.host_driver_disabled = host_driver_disabled;
|
||||
#if defined (POINTING_DEVICE_MODES_ENABLE)
|
||||
user_state.split_pointing_mode = get_pointing_mode_id();
|
||||
# if defined (POINTING_DEVICE_COMBINED)
|
||||
user_state.pointing_side = get_pointing_mode_device();
|
||||
# endif //POINTING_DEVICE_COMBINED
|
||||
#endif //POINTING_DEVICE_MODES_ENABLE
|
||||
transport_user_state = user_state.raw;
|
||||
} else {
|
||||
keymap_config.raw = transport_keymap_config;
|
||||
userspace_config.raw = transport_userspace_config;
|
||||
user_state.raw = transport_user_state;
|
||||
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
unicode_config.input_mode = user_state.unicode_mode;
|
||||
unicode_typing_mode = user_state.unicode_typing_mode;
|
||||
#endif
|
||||
#if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER)
|
||||
is_oled_enabled = user_state.is_oled_enabled;
|
||||
#endif
|
||||
#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
|
||||
if (get_auto_mouse_toggle() != user_state.tap_toggling) {
|
||||
auto_mouse_toggle();
|
||||
}
|
||||
#endif
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
swap_hands = user_state.swap_hands;
|
||||
#endif
|
||||
host_driver_disabled = user_state.host_driver_disabled;
|
||||
}
|
||||
}
|
||||
|
||||
void user_transport_sync(void) {
|
||||
if (is_keyboard_master()) {
|
||||
// Keep track of the last state, so that we can tell if we need to propagate to slave
|
||||
static uint16_t last_keymap = 0;
|
||||
static uint32_t last_config = 0, last_sync[4], last_user_state = 0;
|
||||
bool needs_sync = false;
|
||||
#ifdef CUSTOM_KEYLOGGER
|
||||
static char keylog_temp[KEYLOGGER_LENGTH] = {0};
|
||||
#endif
|
||||
|
||||
// Check if the state values are different
|
||||
if (memcmp(&transport_user_state, &last_user_state, sizeof(transport_user_state))) {
|
||||
needs_sync = true;
|
||||
memcpy(&last_user_state, &transport_user_state, sizeof(transport_user_state));
|
||||
}
|
||||
// Send to slave every 500ms regardless of state change
|
||||
if (timer_elapsed32(last_sync[0]) > 250) {
|
||||
needs_sync = true;
|
||||
}
|
||||
|
||||
// Perform the sync if requested
|
||||
if (needs_sync) {
|
||||
if (transaction_rpc_send(RPC_ID_USER_STATE_SYNC, sizeof(user_state), &user_state)) {
|
||||
last_sync[0] = timer_read32();
|
||||
}
|
||||
needs_sync = false;
|
||||
}
|
||||
|
||||
// Check if the state values are different
|
||||
if (memcmp(&transport_keymap_config, &last_keymap, sizeof(transport_keymap_config))) {
|
||||
needs_sync = true;
|
||||
memcpy(&last_keymap, &transport_keymap_config, sizeof(transport_keymap_config));
|
||||
}
|
||||
|
||||
// Send to slave every 500ms regardless of state change
|
||||
if (timer_elapsed32(last_sync[1]) > 250) {
|
||||
needs_sync = true;
|
||||
}
|
||||
|
||||
// Perform the sync if requested
|
||||
if (needs_sync) {
|
||||
if (transaction_rpc_send(RPC_ID_USER_KEYMAP_SYNC, sizeof(transport_keymap_config), &transport_keymap_config)) {
|
||||
last_sync[1] = timer_read32();
|
||||
}
|
||||
needs_sync = false;
|
||||
}
|
||||
|
||||
// Check if the state values are different
|
||||
if (memcmp(&user_state, &last_config, sizeof(transport_userspace_config))) {
|
||||
needs_sync = true;
|
||||
memcpy(&last_config, &user_state, sizeof(transport_userspace_config));
|
||||
}
|
||||
|
||||
// Send to slave every 500ms regardless of state change
|
||||
if (timer_elapsed32(last_sync[2]) > 250) {
|
||||
needs_sync = true;
|
||||
}
|
||||
|
||||
// Perform the sync if requested
|
||||
if (needs_sync) {
|
||||
if (transaction_rpc_send(RPC_ID_USER_CONFIG_SYNC, sizeof(transport_userspace_config), &transport_userspace_config)) {
|
||||
last_sync[2] = timer_read32();
|
||||
}
|
||||
needs_sync = false;
|
||||
}
|
||||
|
||||
#ifdef CUSTOM_KEYLOGGER
|
||||
// Check if the state values are different
|
||||
if (memcmp(&painter_keylog_str, &keylog_temp, KEYLOGGER_LENGTH)) {
|
||||
needs_sync = true;
|
||||
memcpy(&keylog_temp, &painter_keylog_str, KEYLOGGER_LENGTH);
|
||||
}
|
||||
if (timer_elapsed32(last_sync[3]) > 250) {
|
||||
needs_sync = true;
|
||||
}
|
||||
|
||||
// Perform the sync if requested
|
||||
if (needs_sync) {
|
||||
if (transaction_rpc_send(RPC_ID_USER_KEYLOG_STR, KEYLOGGER_LENGTH, &painter_keylog_str)) {
|
||||
last_sync[3] = timer_read32();
|
||||
}
|
||||
needs_sync = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void housekeeping_task_transport_sync(void) {
|
||||
// Update kb_state so we can send to slave
|
||||
user_transport_update();
|
||||
|
||||
// Data sync from master to slave
|
||||
user_transport_sync();
|
||||
}
|
||||
39
users/freznel/split/transport_sync.h
Normal file
39
users/freznel/split/transport_sync.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@gmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "freznel.h"
|
||||
#ifdef OLED_ENABLE
|
||||
# include "oled/oled_stuff.h"
|
||||
extern char painter_keylog_str[OLED_KEYLOGGER_LENGTH];
|
||||
#endif
|
||||
|
||||
#ifdef CUSTOM_KEYLOGGER
|
||||
#define KEYLOGGER_LENGTH 8
|
||||
extern char painter_keylog_str[KEYLOGGER_LENGTH];
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool audio_enable :1;
|
||||
bool audio_clicky_enable :1;
|
||||
bool tap_toggling :1;
|
||||
uint8_t unicode_mode :3;
|
||||
bool swap_hands :1;
|
||||
bool host_driver_disabled :1;
|
||||
uint8_t unicode_typing_mode :3;
|
||||
bool is_oled_enabled :1;
|
||||
bool is_caps_word_on :1;
|
||||
bool pointing_side :1;
|
||||
uint8_t split_pointing_mode :4;
|
||||
};
|
||||
} user_runtime_config_t;
|
||||
|
||||
extern user_runtime_config_t user_state;
|
||||
|
||||
void keyboard_post_init_transport_sync(void);
|
||||
void housekeeping_task_transport_sync(void);
|
||||
80
users/freznel/super_alt_tab.c
Normal file
80
users/freznel/super_alt_tab.c
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* Copyright 2021 Joshua T.
|
||||
* Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@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 "freznel.h"
|
||||
|
||||
// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab
|
||||
|
||||
bool is_alt_tab_active = false;
|
||||
uint16_t alt_tab_timer = 0;
|
||||
|
||||
void matrix_scan_super_alt_tab(void) {
|
||||
if (is_alt_tab_active) {
|
||||
if (timer_elapsed(alt_tab_timer) > USER_SUPER_ALT_TAB_TIMEOUT) {
|
||||
unregister_code(KC_LALT);
|
||||
is_alt_tab_active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool process_record_super_alt_tab(uint16_t keycode, const keyrecord_t *record) {
|
||||
// if (keycode != ALT_TAB) {
|
||||
// }
|
||||
switch (keycode) {
|
||||
case ALT_TAB:
|
||||
if (record->event.pressed) {
|
||||
if (!is_alt_tab_active) {
|
||||
is_alt_tab_active = true;
|
||||
register_code(KC_LALT);
|
||||
}
|
||||
alt_tab_timer = timer_read();
|
||||
register_code(KC_TAB);
|
||||
} else {
|
||||
unregister_code(KC_TAB);
|
||||
}
|
||||
break;
|
||||
case ENC_ALT_TAB:
|
||||
if (record->event.pressed) {
|
||||
if (!is_alt_tab_active) {
|
||||
is_alt_tab_active = true;
|
||||
register_code(KC_LALT);
|
||||
}
|
||||
alt_tab_timer = timer_read();
|
||||
register_code(KC_TAB);
|
||||
} else {
|
||||
unregister_code(KC_TAB);
|
||||
}
|
||||
break;
|
||||
case ENC_ALT_TAB_REV:
|
||||
if (record->event.pressed) {
|
||||
if (!is_alt_tab_active) {
|
||||
is_alt_tab_active = true;
|
||||
register_code(KC_LALT);
|
||||
}
|
||||
alt_tab_timer = timer_read();
|
||||
register_code16(S(KC_TAB));
|
||||
} else {
|
||||
unregister_code16(S(KC_TAB));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
26
users/freznel/super_alt_tab.h
Normal file
26
users/freznel/super_alt_tab.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/* Copyright 2021 Joshua T.
|
||||
* Copyright 2022 Freznel B. Sta. Ana (@freznel10) <freznel@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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "freznel.h"
|
||||
|
||||
#ifndef USER_SUPER_ALT_TAB_TIMEOUT
|
||||
# define USER_SUPER_ALT_TAB_TIMEOUT 500
|
||||
#endif
|
||||
|
||||
void matrix_scan_super_alt_tab(void);
|
||||
|
||||
bool process_record_super_alt_tab(uint16_t keycode, const keyrecord_t *record);
|
||||
85
users/freznel/template.c
Normal file
85
users/freznel/template.c
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "template.h"
|
||||
|
||||
// Add reconfigurable functions here, for keymap customization
|
||||
// This allows for a global, userspace functions, and continued
|
||||
// customization of the keymap. Use _keymap instead of _user
|
||||
// functions in the keymaps
|
||||
__attribute__((weak)) void matrix_init_keymap(void) {}
|
||||
|
||||
// Call user matrix init, then call the keymap's init function
|
||||
void matrix_init_user(void) { matrix_init_keymap(); }
|
||||
|
||||
__attribute__((weak)) void matrix_scan_keymap(void) {}
|
||||
|
||||
// No global matrix scan code, so just run keymap's matix
|
||||
// scan function
|
||||
void matrix_scan_user(void) { matrix_scan_keymap(); }
|
||||
|
||||
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||
|
||||
// Defines actions tor my global custom keycodes. Defined in freznel.h file
|
||||
// Then runs the _keymap's recod handier if not processed here,
|
||||
// And use "NEWPLACEHOLDER" for new safe range
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case KC_MAKE:
|
||||
if (!record->event.pressed) {
|
||||
SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
|
||||
#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
|
||||
":dfu"
|
||||
#elif defined(BOOTLOADER_HALFKAY)
|
||||
":teensy"
|
||||
#elif defined(BOOTLOADER_CATERINA)
|
||||
":avrdude"
|
||||
#endif
|
||||
SS_TAP(X_ENTER));
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
||||
case VRSN:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return process_record_keymap(keycode, record);
|
||||
}
|
||||
|
||||
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); }
|
||||
|
||||
__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
|
||||
|
||||
void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
|
||||
|
||||
__attribute__((weak)) void suspend_power_down_keymap(void) {}
|
||||
|
||||
void suspend_power_down_user(void) { suspend_power_down_keymap(); }
|
||||
|
||||
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
|
||||
|
||||
void suspend_wakeup_init_user(void) {
|
||||
suspend_wakeup_init_keymap();
|
||||
#ifdef KEYBOARD_ergodox_ez
|
||||
wait_ms(10);
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) void startup_keymap(void) {}
|
||||
|
||||
void startup_user(void) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
matrix_init_rgb();
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
startup_keymap();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void shutdown_keymap(void) {}
|
||||
|
||||
void shutdown_user(void) { shutdown_keymap(); }
|
||||
18
users/freznel/template.h
Normal file
18
users/freznel/template.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "version.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
// Define layer names
|
||||
#define BASE 0
|
||||
|
||||
enum custom_keycodes {
|
||||
VRSN = SAFE_RANGE, // can always be here
|
||||
KC_MAKE,
|
||||
KC_RESET,
|
||||
NEWPLACEHOLDER // use "NEWPLACEHOLDER for keymap specific codes
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue