Merge remote-tracking branch 'qmk/master' into merge-2025-02-08
This commit is contained in:
commit
760225f515
2029 changed files with 49693 additions and 84656 deletions
|
|
@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "timer.h"
|
||||
#include "keycode_config.h"
|
||||
#include "qmk_settings.h"
|
||||
#include "usb_device_state.h"
|
||||
#include <string.h>
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
|
@ -303,7 +304,7 @@ void send_nkro_report(void) {
|
|||
*/
|
||||
void send_keyboard_report(void) {
|
||||
#ifdef NKRO_ENABLE
|
||||
if (keyboard_protocol && keymap_config.nkro) {
|
||||
if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) {
|
||||
send_nkro_report();
|
||||
} else {
|
||||
send_6kro_report();
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
# define TIMESTAMP_GETTER TCNT0
|
||||
#elif defined(PROTOCOL_CHIBIOS)
|
||||
# define TIMESTAMP_GETTER chSysGetRealtimeCounterX()
|
||||
#elif defined(PROTOCOL_ARM_ATSAM)
|
||||
# error arm_atsam not currently supported
|
||||
#else
|
||||
# error Unknown protocol in use
|
||||
#endif
|
||||
|
|
|
|||
33
quantum/bits.h
Normal file
33
quantum/bits.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Remove these once we transitioned to C23 across all platfroms */
|
||||
#define UINT32_WIDTH 32
|
||||
#define UINT64_WIDTH 64
|
||||
|
||||
/**
|
||||
* @brief Mask for the little endian nth bit (0-31) in a 32-bit integer.
|
||||
*/
|
||||
#define BIT32(n) (UINT32_C(1) << (n))
|
||||
|
||||
/**
|
||||
* @brief Mask for the little endian nth bit (0-63) in a 64-bit integer.
|
||||
*/
|
||||
#define BIT64(n) (UINT64_C(1) << (n))
|
||||
|
||||
/**
|
||||
* @brief Create a contiguous 32-bit wide bitmask starting at bit position @l
|
||||
* and ending at position @h. The range is inclusive, meaning GENMASK32(20, 10)
|
||||
* gives us the 32-bit mask 0x001ffc00.
|
||||
*/
|
||||
#define GENMASK32(h, l) (((~UINT32_C(0)) - (UINT32_C(1) << (l)) + 1) & (~UINT32_C(0) >> (UINT32_WIDTH - 1 - (h))))
|
||||
|
||||
/**
|
||||
* @brief Create a contiguous 64-bit wide bitmask starting at bit position @l
|
||||
* and ending at position @h. The range is inclusive, meaning GENMASK64(39, 21)
|
||||
* gives us the 64-bit mask 0x000000ffffe00000.
|
||||
*/
|
||||
#define GENMASK64(h, l) (((~UINT64_C(0)) - (UINT64_C(1) << (l)) + 1) & (~UINT64_C(0) >> (UINT64_WIDTH - 1 - (h))))
|
||||
|
|
@ -19,8 +19,8 @@
|
|||
#include "progmem.h"
|
||||
#include "util.h"
|
||||
|
||||
RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) {
|
||||
RGB rgb;
|
||||
rgb_t hsv_to_rgb_impl(hsv_t hsv, bool use_cie) {
|
||||
rgb_t rgb;
|
||||
uint8_t region, remainder, p, q, t;
|
||||
uint16_t h, s, v;
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) {
|
|||
return rgb;
|
||||
}
|
||||
|
||||
RGB hsv_to_rgb(HSV hsv) {
|
||||
rgb_t hsv_to_rgb(hsv_t hsv) {
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
return hsv_to_rgb_impl(hsv, true);
|
||||
#else
|
||||
|
|
@ -105,17 +105,6 @@ RGB hsv_to_rgb(HSV hsv) {
|
|||
#endif
|
||||
}
|
||||
|
||||
RGB hsv_to_rgb_nocie(HSV hsv) {
|
||||
rgb_t hsv_to_rgb_nocie(hsv_t hsv) {
|
||||
return hsv_to_rgb_impl(hsv, false);
|
||||
}
|
||||
|
||||
#ifdef WS2812_RGBW
|
||||
void convert_rgb_to_rgbw(rgb_led_t *led) {
|
||||
// Determine lowest value in all three colors, put that into
|
||||
// the white channel and then shift all colors by that amount
|
||||
led->w = MIN(led->r, MIN(led->g, led->b));
|
||||
led->r -= led->w;
|
||||
led->g -= led->w;
|
||||
led->b -= led->w;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -74,43 +74,24 @@
|
|||
|
||||
// clang-format on
|
||||
|
||||
#define WS2812_BYTE_ORDER_RGB 0
|
||||
#define WS2812_BYTE_ORDER_GRB 1
|
||||
#define WS2812_BYTE_ORDER_BGR 2
|
||||
|
||||
#ifndef WS2812_BYTE_ORDER
|
||||
# define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_GRB
|
||||
#endif
|
||||
|
||||
typedef struct PACKED rgb_led_t {
|
||||
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
uint8_t b;
|
||||
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB)
|
||||
typedef struct PACKED rgb_t {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
#endif
|
||||
#ifdef WS2812_RGBW
|
||||
uint8_t w;
|
||||
#endif
|
||||
} rgb_led_t;
|
||||
} rgb_t;
|
||||
|
||||
typedef rgb_led_t RGB;
|
||||
// DEPRECATED
|
||||
typedef rgb_t RGB;
|
||||
typedef rgb_t rgb_led_t;
|
||||
|
||||
typedef struct PACKED HSV {
|
||||
typedef struct PACKED hsv_t {
|
||||
uint8_t h;
|
||||
uint8_t s;
|
||||
uint8_t v;
|
||||
} HSV;
|
||||
} hsv_t;
|
||||
|
||||
RGB hsv_to_rgb(HSV hsv);
|
||||
RGB hsv_to_rgb_nocie(HSV hsv);
|
||||
#ifdef WS2812_RGBW
|
||||
void convert_rgb_to_rgbw(rgb_led_t *led);
|
||||
#endif
|
||||
// DEPRECATED
|
||||
typedef hsv_t HSV;
|
||||
|
||||
rgb_t hsv_to_rgb(hsv_t hsv);
|
||||
rgb_t hsv_to_rgb_nocie(hsv_t hsv);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "led.h"
|
||||
#include "command.h"
|
||||
#include "quantum.h"
|
||||
#include "usb_device_state.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
|
|
@ -234,8 +235,8 @@ static void print_status(void) {
|
|||
"timer_read32(): %08lX\n"
|
||||
|
||||
, host_keyboard_leds()
|
||||
, keyboard_protocol
|
||||
, keyboard_idle
|
||||
, usb_device_state_get_protocol()
|
||||
, usb_device_state_get_idle_rate()
|
||||
#ifdef NKRO_ENABLE
|
||||
, keymap_config.nkro
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ __attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) {
|
|||
#ifdef DIP_SWITCH_MAP_ENABLE
|
||||
# include "keymap_introspection.h"
|
||||
# include "action.h"
|
||||
# include "wait.h"
|
||||
|
||||
# ifndef DIP_SWITCH_MAP_KEY_DELAY
|
||||
# define DIP_SWITCH_MAP_KEY_DELAY TAP_CODE_DELAY
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <stdbool.h>
|
||||
#include "eeprom.h"
|
||||
#include "eeconfig.h"
|
||||
#include "action_layer.h"
|
||||
|
||||
#if defined(EEPROM_DRIVER)
|
||||
# include "eeprom_driver.h"
|
||||
|
|
@ -52,7 +51,7 @@ void eeconfig_init_quantum(void) {
|
|||
eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
|
||||
eeprom_update_byte(EECONFIG_DEBUG, 0);
|
||||
default_layer_state = (layer_state_t)1 << 0;
|
||||
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, default_layer_state);
|
||||
eeconfig_update_default_layer(default_layer_state);
|
||||
// Enable oneshot and autocorrect by default: 0b0001 0100 0000 0000
|
||||
eeprom_update_word(EECONFIG_KEYMAP, 0x1400);
|
||||
eeprom_update_byte(EECONFIG_BACKLIGHT, 0);
|
||||
|
|
@ -160,14 +159,30 @@ void eeconfig_update_debug(uint8_t val) {
|
|||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t eeconfig_read_default_layer(void) {
|
||||
return eeprom_read_byte(EECONFIG_DEFAULT_LAYER);
|
||||
layer_state_t eeconfig_read_default_layer(void) {
|
||||
uint8_t val = eeprom_read_byte(EECONFIG_DEFAULT_LAYER);
|
||||
|
||||
#ifdef DEFAULT_LAYER_STATE_IS_VALUE_NOT_BITMASK
|
||||
// stored as a layer number, so convert back to bitmask
|
||||
return 1 << val;
|
||||
#else
|
||||
// stored as 8-bit-wide bitmask, so read the value directly - handling padding to 16/32 bit layer_state_t
|
||||
return val;
|
||||
#endif
|
||||
}
|
||||
/** \brief eeconfig update default layer
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_default_layer(uint8_t val) {
|
||||
void eeconfig_update_default_layer(layer_state_t state) {
|
||||
#ifdef DEFAULT_LAYER_STATE_IS_VALUE_NOT_BITMASK
|
||||
// stored as a layer number, so only store the highest layer
|
||||
uint8_t val = get_highest_layer(state);
|
||||
#else
|
||||
// stored as 8-bit-wide bitmask, so write the value directly - handling truncation from 16/32 bit layer_state_t
|
||||
uint8_t val = state;
|
||||
#endif
|
||||
|
||||
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <stddef.h> // offsetof
|
||||
#include "eeprom.h"
|
||||
#include "util.h"
|
||||
#include "action_layer.h" // layer_state_t
|
||||
|
||||
#ifndef EECONFIG_MAGIC_NUMBER
|
||||
# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE5 // When changing, decrement this value to avoid future re-init issues
|
||||
|
|
@ -122,8 +123,8 @@ void eeconfig_disable(void);
|
|||
uint8_t eeconfig_read_debug(void);
|
||||
void eeconfig_update_debug(uint8_t val);
|
||||
|
||||
uint8_t eeconfig_read_default_layer(void);
|
||||
void eeconfig_update_default_layer(uint8_t val);
|
||||
layer_state_t eeconfig_read_default_layer(void);
|
||||
void eeconfig_update_default_layer(layer_state_t val);
|
||||
|
||||
uint16_t eeconfig_read_keymap(void);
|
||||
void eeconfig_update_keymap(uint16_t val);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ extern uint8_t split_haptic_play;
|
|||
haptic_config_t haptic_config;
|
||||
|
||||
static void update_haptic_enable_gpios(void) {
|
||||
if (haptic_config.enable && ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state == USB_DEVICE_STATE_CONFIGURED))) {
|
||||
if (haptic_config.enable && ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state_get_configure_state() == USB_DEVICE_STATE_CONFIGURED))) {
|
||||
#if defined(HAPTIC_ENABLE_PIN)
|
||||
HAPTIC_ENABLE_PIN_WRITE_ACTIVE();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ joystick_t joystick_state = {
|
|||
0
|
||||
#endif
|
||||
},
|
||||
#ifdef JOYSTICK_HAS_HAT
|
||||
.hat = -1,
|
||||
#endif
|
||||
.dirty = false,
|
||||
};
|
||||
|
||||
|
|
@ -145,6 +148,13 @@ void joystick_set_axis(uint8_t axis, int16_t value) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef JOYSTICK_HAS_HAT
|
||||
void joystick_set_hat(int8_t value) {
|
||||
joystick_state.hat = value;
|
||||
joystick_state.dirty = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void joystick_init(void) {
|
||||
joystick_init_axes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@
|
|||
|
||||
#define JOYSTICK_MAX_VALUE ((1L << (JOYSTICK_AXIS_RESOLUTION - 1)) - 1)
|
||||
|
||||
#define JOYSTICK_HAT_CENTER -1
|
||||
#define JOYSTICK_HAT_NORTH 0
|
||||
#define JOYSTICK_HAT_NORTHEAST 1
|
||||
#define JOYSTICK_HAT_EAST 2
|
||||
#define JOYSTICK_HAT_SOUTHEAST 3
|
||||
#define JOYSTICK_HAT_SOUTH 4
|
||||
#define JOYSTICK_HAT_SOUTHWEST 5
|
||||
#define JOYSTICK_HAT_WEST 6
|
||||
#define JOYSTICK_HAT_NORTHWEST 7
|
||||
|
||||
// configure on input_pin of the joystick_axes array entry to NO_PIN
|
||||
// to prevent it from being read from the ADC. This allows outputting forged axis value.
|
||||
#define JOYSTICK_AXIS_VIRTUAL \
|
||||
|
|
@ -73,7 +83,10 @@ extern joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT];
|
|||
typedef struct {
|
||||
uint8_t buttons[(JOYSTICK_BUTTON_COUNT - 1) / 8 + 1];
|
||||
int16_t axes[JOYSTICK_AXIS_COUNT];
|
||||
bool dirty;
|
||||
#ifdef JOYSTICK_HAS_HAT
|
||||
int8_t hat;
|
||||
#endif
|
||||
bool dirty;
|
||||
} joystick_t;
|
||||
|
||||
extern joystick_t joystick_state;
|
||||
|
|
@ -129,4 +142,11 @@ void joystick_read_axes(void);
|
|||
*/
|
||||
void joystick_set_axis(uint8_t axis, int16_t value);
|
||||
|
||||
/**
|
||||
* \brief Set the position of the hat switch.
|
||||
*
|
||||
* \param value The hat switch position to set.
|
||||
*/
|
||||
void joystick_set_hat(int8_t value);
|
||||
|
||||
/** \} */
|
||||
|
|
|
|||
|
|
@ -146,6 +146,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifdef OS_DETECTION_ENABLE
|
||||
# include "os_detection.h"
|
||||
#endif
|
||||
#ifdef LAYER_LOCK_ENABLE
|
||||
# include "layer_lock.h"
|
||||
#endif
|
||||
|
||||
static uint32_t last_input_modification_time = 0;
|
||||
uint32_t last_input_activity_time(void) {
|
||||
|
|
@ -667,6 +670,10 @@ void quantum_task(void) {
|
|||
#ifdef SECURE_ENABLE
|
||||
secure_task();
|
||||
#endif
|
||||
|
||||
#ifdef LAYER_LOCK_ENABLE
|
||||
layer_lock_task();
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Main task that is repeatedly called as fast as possible. */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
@ -52,6 +52,8 @@ enum qk_keycode_ranges {
|
|||
QK_ONE_SHOT_MOD_MAX = 0x52BF,
|
||||
QK_LAYER_TAP_TOGGLE = 0x52C0,
|
||||
QK_LAYER_TAP_TOGGLE_MAX = 0x52DF,
|
||||
QK_PERSISTENT_DEF_LAYER = 0x52E0,
|
||||
QK_PERSISTENT_DEF_LAYER_MAX = 0x52FF,
|
||||
QK_SWAP_HANDS = 0x5600,
|
||||
QK_SWAP_HANDS_MAX = 0x56FF,
|
||||
QK_TAP_DANCE = 0x5700,
|
||||
|
|
@ -72,6 +74,8 @@ enum qk_keycode_ranges {
|
|||
QK_STENO_MAX = 0x74FF,
|
||||
QK_MACRO = 0x7700,
|
||||
QK_MACRO_MAX = 0x777F,
|
||||
QK_CONNECTION = 0x7780,
|
||||
QK_CONNECTION_MAX = 0x77BF,
|
||||
QK_LIGHTING = 0x7800,
|
||||
QK_LIGHTING_MAX = 0x78FF,
|
||||
QK_QUANTUM = 0x7C00,
|
||||
|
|
@ -620,6 +624,21 @@ enum qk_keycode_defines {
|
|||
QK_MACRO_29 = 0x771D,
|
||||
QK_MACRO_30 = 0x771E,
|
||||
QK_MACRO_31 = 0x771F,
|
||||
QK_OUTPUT_AUTO = 0x7780,
|
||||
QK_OUTPUT_NEXT = 0x7781,
|
||||
QK_OUTPUT_PREV = 0x7782,
|
||||
QK_OUTPUT_NONE = 0x7783,
|
||||
QK_OUTPUT_USB = 0x7784,
|
||||
QK_OUTPUT_2P4GHZ = 0x7785,
|
||||
QK_OUTPUT_BLUETOOTH = 0x7786,
|
||||
QK_BLUETOOTH_PROFILE_NEXT = 0x7790,
|
||||
QK_BLUETOOTH_PROFILE_PREV = 0x7791,
|
||||
QK_BLUETOOTH_UNPAIR = 0x7792,
|
||||
QK_BLUETOOTH_PROFILE1 = 0x7793,
|
||||
QK_BLUETOOTH_PROFILE2 = 0x7794,
|
||||
QK_BLUETOOTH_PROFILE3 = 0x7795,
|
||||
QK_BLUETOOTH_PROFILE4 = 0x7796,
|
||||
QK_BLUETOOTH_PROFILE5 = 0x7797,
|
||||
QK_BACKLIGHT_ON = 0x7800,
|
||||
QK_BACKLIGHT_OFF = 0x7801,
|
||||
QK_BACKLIGHT_TOGGLE = 0x7802,
|
||||
|
|
@ -690,9 +709,6 @@ enum qk_keycode_defines {
|
|||
QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN = 0x7C1C,
|
||||
QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE = 0x7C1D,
|
||||
QK_SPACE_CADET_RIGHT_SHIFT_ENTER = 0x7C1E,
|
||||
QK_OUTPUT_AUTO = 0x7C20,
|
||||
QK_OUTPUT_USB = 0x7C21,
|
||||
QK_OUTPUT_BLUETOOTH = 0x7C22,
|
||||
QK_UNICODE_MODE_NEXT = 0x7C30,
|
||||
QK_UNICODE_MODE_PREVIOUS = 0x7C31,
|
||||
QK_UNICODE_MODE_MACOS = 0x7C32,
|
||||
|
|
@ -745,6 +761,7 @@ enum qk_keycode_defines {
|
|||
QK_TRI_LAYER_UPPER = 0x7C78,
|
||||
QK_REPEAT_KEY = 0x7C79,
|
||||
QK_ALT_REPEAT_KEY = 0x7C7A,
|
||||
QK_LAYER_LOCK = 0x7C7B,
|
||||
QK_KB_0 = 0x7E00,
|
||||
QK_KB_1 = 0x7E01,
|
||||
QK_KB_2 = 0x7E02,
|
||||
|
|
@ -1296,6 +1313,21 @@ enum qk_keycode_defines {
|
|||
MC_29 = QK_MACRO_29,
|
||||
MC_30 = QK_MACRO_30,
|
||||
MC_31 = QK_MACRO_31,
|
||||
OU_AUTO = QK_OUTPUT_AUTO,
|
||||
OU_NEXT = QK_OUTPUT_NEXT,
|
||||
OU_PREV = QK_OUTPUT_PREV,
|
||||
OU_NONE = QK_OUTPUT_NONE,
|
||||
OU_USB = QK_OUTPUT_USB,
|
||||
OU_2P4G = QK_OUTPUT_2P4GHZ,
|
||||
OU_BT = QK_OUTPUT_BLUETOOTH,
|
||||
BT_NEXT = QK_BLUETOOTH_PROFILE_NEXT,
|
||||
BT_PREV = QK_BLUETOOTH_PROFILE_PREV,
|
||||
BT_UNPR = QK_BLUETOOTH_UNPAIR,
|
||||
BT_PRF1 = QK_BLUETOOTH_PROFILE1,
|
||||
BT_PRF2 = QK_BLUETOOTH_PROFILE2,
|
||||
BT_PRF3 = QK_BLUETOOTH_PROFILE3,
|
||||
BT_PRF4 = QK_BLUETOOTH_PROFILE4,
|
||||
BT_PRF5 = QK_BLUETOOTH_PROFILE5,
|
||||
BL_ON = QK_BACKLIGHT_ON,
|
||||
BL_OFF = QK_BACKLIGHT_OFF,
|
||||
BL_TOGG = QK_BACKLIGHT_TOGGLE,
|
||||
|
|
@ -1365,9 +1397,6 @@ enum qk_keycode_defines {
|
|||
SC_LAPO = QK_SPACE_CADET_LEFT_ALT_PARENTHESIS_OPEN,
|
||||
SC_RAPC = QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE,
|
||||
SC_SENT = QK_SPACE_CADET_RIGHT_SHIFT_ENTER,
|
||||
OU_AUTO = QK_OUTPUT_AUTO,
|
||||
OU_USB = QK_OUTPUT_USB,
|
||||
OU_BT = QK_OUTPUT_BLUETOOTH,
|
||||
UC_NEXT = QK_UNICODE_MODE_NEXT,
|
||||
UC_PREV = QK_UNICODE_MODE_PREVIOUS,
|
||||
UC_MAC = QK_UNICODE_MODE_MACOS,
|
||||
|
|
@ -1419,6 +1448,7 @@ enum qk_keycode_defines {
|
|||
TL_UPPR = QK_TRI_LAYER_UPPER,
|
||||
QK_REP = QK_REPEAT_KEY,
|
||||
QK_AREP = QK_ALT_REPEAT_KEY,
|
||||
QK_LLCK = QK_LAYER_LOCK,
|
||||
};
|
||||
|
||||
// Range Helpers
|
||||
|
|
@ -1434,6 +1464,7 @@ enum qk_keycode_defines {
|
|||
#define IS_QK_ONE_SHOT_LAYER(code) ((code) >= QK_ONE_SHOT_LAYER && (code) <= QK_ONE_SHOT_LAYER_MAX)
|
||||
#define IS_QK_ONE_SHOT_MOD(code) ((code) >= QK_ONE_SHOT_MOD && (code) <= QK_ONE_SHOT_MOD_MAX)
|
||||
#define IS_QK_LAYER_TAP_TOGGLE(code) ((code) >= QK_LAYER_TAP_TOGGLE && (code) <= QK_LAYER_TAP_TOGGLE_MAX)
|
||||
#define IS_QK_PERSISTENT_DEF_LAYER(code) ((code) >= QK_PERSISTENT_DEF_LAYER && (code) <= QK_PERSISTENT_DEF_LAYER_MAX)
|
||||
#define IS_QK_SWAP_HANDS(code) ((code) >= QK_SWAP_HANDS && (code) <= QK_SWAP_HANDS_MAX)
|
||||
#define IS_QK_TAP_DANCE(code) ((code) >= QK_TAP_DANCE && (code) <= QK_TAP_DANCE_MAX)
|
||||
#define IS_QK_MAGIC(code) ((code) >= QK_MAGIC && (code) <= QK_MAGIC_MAX)
|
||||
|
|
@ -1444,6 +1475,7 @@ enum qk_keycode_defines {
|
|||
#define IS_QK_AUDIO(code) ((code) >= QK_AUDIO && (code) <= QK_AUDIO_MAX)
|
||||
#define IS_QK_STENO(code) ((code) >= QK_STENO && (code) <= QK_STENO_MAX)
|
||||
#define IS_QK_MACRO(code) ((code) >= QK_MACRO && (code) <= QK_MACRO_MAX)
|
||||
#define IS_QK_CONNECTION(code) ((code) >= QK_CONNECTION && (code) <= QK_CONNECTION_MAX)
|
||||
#define IS_QK_LIGHTING(code) ((code) >= QK_LIGHTING && (code) <= QK_LIGHTING_MAX)
|
||||
#define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX)
|
||||
#define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX)
|
||||
|
|
@ -1468,12 +1500,13 @@ enum qk_keycode_defines {
|
|||
#define IS_AUDIO_KEYCODE(code) ((code) >= QK_AUDIO_ON && (code) <= QK_AUDIO_VOICE_PREVIOUS)
|
||||
#define IS_STENO_KEYCODE(code) ((code) >= QK_STENO_BOLT && (code) <= QK_STENO_COMB_MAX)
|
||||
#define IS_MACRO_KEYCODE(code) ((code) >= QK_MACRO_0 && (code) <= QK_MACRO_31)
|
||||
#define IS_CONNECTION_KEYCODE(code) ((code) >= QK_OUTPUT_AUTO && (code) <= QK_BLUETOOTH_PROFILE5)
|
||||
#define IS_BACKLIGHT_KEYCODE(code) ((code) >= QK_BACKLIGHT_ON && (code) <= QK_BACKLIGHT_TOGGLE_BREATHING)
|
||||
#define IS_LED_MATRIX_KEYCODE(code) ((code) >= QK_LED_MATRIX_ON && (code) <= QK_LED_MATRIX_SPEED_DOWN)
|
||||
#define IS_UNDERGLOW_KEYCODE(code) ((code) >= QK_UNDERGLOW_TOGGLE && (code) <= QK_UNDERGLOW_SPEED_DOWN)
|
||||
#define IS_RGB_KEYCODE(code) ((code) >= RGB_MODE_PLAIN && (code) <= RGB_MODE_TWINKLE)
|
||||
#define IS_RGB_MATRIX_KEYCODE(code) ((code) >= QK_RGB_MATRIX_ON && (code) <= QK_RGB_MATRIX_SPEED_DOWN)
|
||||
#define IS_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_ALT_REPEAT_KEY)
|
||||
#define IS_QUANTUM_KEYCODE(code) ((code) >= QK_BOOTLOADER && (code) <= QK_LAYER_LOCK)
|
||||
#define IS_KB_KEYCODE(code) ((code) >= QK_KB_0 && (code) <= QK_KB_31)
|
||||
#define IS_USER_KEYCODE(code) ((code) >= QK_USER_0 && (code) <= QK_USER_31)
|
||||
|
||||
|
|
@ -1493,11 +1526,12 @@ enum qk_keycode_defines {
|
|||
#define AUDIO_KEYCODE_RANGE QK_AUDIO_ON ... QK_AUDIO_VOICE_PREVIOUS
|
||||
#define STENO_KEYCODE_RANGE QK_STENO_BOLT ... QK_STENO_COMB_MAX
|
||||
#define MACRO_KEYCODE_RANGE QK_MACRO_0 ... QK_MACRO_31
|
||||
#define CONNECTION_KEYCODE_RANGE QK_OUTPUT_AUTO ... QK_BLUETOOTH_PROFILE5
|
||||
#define BACKLIGHT_KEYCODE_RANGE QK_BACKLIGHT_ON ... QK_BACKLIGHT_TOGGLE_BREATHING
|
||||
#define LED_MATRIX_KEYCODE_RANGE QK_LED_MATRIX_ON ... QK_LED_MATRIX_SPEED_DOWN
|
||||
#define UNDERGLOW_KEYCODE_RANGE QK_UNDERGLOW_TOGGLE ... QK_UNDERGLOW_SPEED_DOWN
|
||||
#define RGB_KEYCODE_RANGE RGB_MODE_PLAIN ... RGB_MODE_TWINKLE
|
||||
#define RGB_MATRIX_KEYCODE_RANGE QK_RGB_MATRIX_ON ... QK_RGB_MATRIX_SPEED_DOWN
|
||||
#define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_ALT_REPEAT_KEY
|
||||
#define QUANTUM_KEYCODE_RANGE QK_BOOTLOADER ... QK_LAYER_LOCK
|
||||
#define KB_KEYCODE_RANGE QK_KB_0 ... QK_KB_31
|
||||
#define USER_KEYCODE_RANGE QK_USER_0 ... QK_USER_31
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2024 QMK
|
||||
// Copyright 2025 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ __attribute__((weak)) uint16_t combo_count(void) {
|
|||
return combo_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(ARRAY_SIZE(key_combos) <= (QK_KB), "Number of combos is abnormally high. Are you using SAFE_RANGE in an enum for combos?");
|
||||
|
||||
combo_t* combo_get_raw(uint16_t combo_idx) {
|
||||
if (combo_idx >= combo_count_raw()) {
|
||||
return NULL;
|
||||
|
|
@ -127,6 +129,8 @@ __attribute__((weak)) uint16_t tap_dance_count(void) {
|
|||
return tap_dance_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(ARRAY_SIZE(tap_dance_actions) <= (QK_TAP_DANCE_MAX - QK_TAP_DANCE), "Number of tap dance actions exceeds maximum. Are you using SAFE_RANGE in tap dance enum?");
|
||||
|
||||
tap_dance_action_t* tap_dance_get_raw(uint16_t tap_dance_idx) {
|
||||
if (tap_dance_idx >= tap_dance_count_raw()) {
|
||||
return NULL;
|
||||
|
|
@ -153,6 +157,8 @@ __attribute__((weak)) uint16_t key_override_count(void) {
|
|||
return key_override_count_raw();
|
||||
}
|
||||
|
||||
_Static_assert(ARRAY_SIZE(key_overrides) <= (QK_KB), "Number of key overrides is abnormally high. Are you using SAFE_RANGE in an enum for key overrides?");
|
||||
|
||||
const key_override_t* key_override_get_raw(uint16_t key_override_idx) {
|
||||
if (key_override_idx >= key_override_count_raw()) {
|
||||
return NULL;
|
||||
|
|
|
|||
100
quantum/layer_lock.c
Normal file
100
quantum/layer_lock.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// Copyright 2022-2023 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.
|
||||
|
||||
#include "layer_lock.h"
|
||||
#include "quantum_keycodes.h"
|
||||
|
||||
#ifndef NO_ACTION_LAYER
|
||||
// The current lock state. The kth bit is on if layer k is locked.
|
||||
layer_state_t locked_layers = 0;
|
||||
|
||||
// Layer Lock timer to disable layer lock after X seconds inactivity
|
||||
# if defined(LAYER_LOCK_IDLE_TIMEOUT) && LAYER_LOCK_IDLE_TIMEOUT > 0
|
||||
uint32_t layer_lock_timer = 0;
|
||||
|
||||
void layer_lock_timeout_task(void) {
|
||||
if (locked_layers && timer_elapsed32(layer_lock_timer) > LAYER_LOCK_IDLE_TIMEOUT) {
|
||||
layer_lock_all_off();
|
||||
layer_lock_timer = timer_read32();
|
||||
}
|
||||
}
|
||||
void layer_lock_activity_trigger(void) {
|
||||
layer_lock_timer = timer_read32();
|
||||
}
|
||||
# else
|
||||
void layer_lock_timeout_task(void) {}
|
||||
void layer_lock_activity_trigger(void) {}
|
||||
# endif // LAYER_LOCK_IDLE_TIMEOUT > 0
|
||||
|
||||
bool is_layer_locked(uint8_t layer) {
|
||||
return locked_layers & ((layer_state_t)1 << layer);
|
||||
}
|
||||
|
||||
void layer_lock_invert(uint8_t layer) {
|
||||
const layer_state_t mask = (layer_state_t)1 << layer;
|
||||
if ((locked_layers & mask) == 0) { // Layer is being locked.
|
||||
# ifndef NO_ACTION_ONESHOT
|
||||
if (layer == get_oneshot_layer()) {
|
||||
reset_oneshot_layer(); // Reset so that OSL doesn't turn layer off.
|
||||
}
|
||||
# endif // NO_ACTION_ONESHOT
|
||||
layer_on(layer);
|
||||
layer_lock_activity_trigger();
|
||||
} else { // Layer is being unlocked.
|
||||
layer_off(layer);
|
||||
}
|
||||
layer_lock_set_kb(locked_layers ^= mask);
|
||||
}
|
||||
|
||||
// Implement layer_lock_on/off by deferring to layer_lock_invert.
|
||||
void layer_lock_on(uint8_t layer) {
|
||||
if (!is_layer_locked(layer)) {
|
||||
layer_lock_invert(layer);
|
||||
}
|
||||
}
|
||||
|
||||
void layer_lock_off(uint8_t layer) {
|
||||
if (is_layer_locked(layer)) {
|
||||
layer_lock_invert(layer);
|
||||
}
|
||||
}
|
||||
|
||||
void layer_lock_all_off(void) {
|
||||
layer_and(~locked_layers);
|
||||
locked_layers = 0;
|
||||
layer_lock_set_kb(locked_layers);
|
||||
}
|
||||
|
||||
#else // NO_ACTION_LAYER
|
||||
bool is_layer_locked(uint8_t layer) {
|
||||
return false;
|
||||
}
|
||||
void layer_lock_on(uint8_t layer) {}
|
||||
void layer_lock_off(uint8_t layer) {}
|
||||
void layer_lock_all_off(void) {}
|
||||
void layer_lock_invert(uint8_t layer) {}
|
||||
void layer_lock_timeout_task(void) {}
|
||||
void layer_lock_activity_trigger(void) {}
|
||||
#endif // NO_ACTION_LAYER
|
||||
|
||||
__attribute__((weak)) bool layer_lock_set_kb(layer_state_t locked_layers) {
|
||||
return layer_lock_set_user(locked_layers);
|
||||
}
|
||||
__attribute__((weak)) bool layer_lock_set_user(layer_state_t locked_layers) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void layer_lock_task(void) {
|
||||
layer_lock_timeout_task();
|
||||
}
|
||||
98
quantum/layer_lock.h
Normal file
98
quantum/layer_lock.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
// Copyright 2022-2023 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.
|
||||
|
||||
/**
|
||||
* @file layer_lock.h
|
||||
* @brief Layer Lock, a key to stay in the current layer.
|
||||
*
|
||||
* Overview
|
||||
* --------
|
||||
*
|
||||
* Layers are often accessed by holding a button, e.g. with a momentary layer
|
||||
* switch `MO(layer)` or layer tap `LT(layer, key)` key. But you may sometimes
|
||||
* want to "lock" or "toggle" the layer so that it stays on without having to
|
||||
* hold down a button. One way to do that is with a tap-toggle `TT` layer key,
|
||||
* but here is an alternative.
|
||||
*
|
||||
* This library implements a "Layer Lock key". When tapped, it "locks" the
|
||||
* highest layer to stay active, assuming the layer was activated by one of the
|
||||
* following keys:
|
||||
*
|
||||
* * `MO(layer)` momentary layer switch
|
||||
* * `LT(layer, key)` layer tap
|
||||
* * `OSL(layer)` one-shot layer
|
||||
* * `TT(layer)` layer tap toggle
|
||||
* * `LM(layer, mod)` layer-mod key (the layer is locked, but not the mods)
|
||||
*
|
||||
* Tapping the Layer Lock key again unlocks and turns off the layer.
|
||||
*
|
||||
* @note When a layer is "locked", other layer keys such as `TO(layer)` or
|
||||
* manually calling `layer_off(layer)` will override and unlock the layer.
|
||||
*
|
||||
* Configuration
|
||||
* -------------
|
||||
*
|
||||
* Optionally, a timeout may be defined so that Layer Lock disables
|
||||
* automatically if not keys are pressed for `LAYER_LOCK_IDLE_TIMEOUT`
|
||||
* milliseconds. Define `LAYER_LOCK_IDLE_TIMEOUT` in your config.h, for instance
|
||||
*
|
||||
* #define LAYER_LOCK_IDLE_TIMEOUT 60000 // Turn off after 60 seconds.
|
||||
*
|
||||
* For full documentation, see
|
||||
* <https://getreuer.info/posts/keyboards/layer-lock>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "action_layer.h"
|
||||
#include "action_util.h"
|
||||
|
||||
/** Returns true if `layer` is currently locked. */
|
||||
bool is_layer_locked(uint8_t layer);
|
||||
|
||||
/** Locks and turns on `layer`. */
|
||||
void layer_lock_on(uint8_t layer);
|
||||
|
||||
/** Unlocks and turns off `layer`. */
|
||||
void layer_lock_off(uint8_t layer);
|
||||
|
||||
/** Unlocks and turns off all locked layers. */
|
||||
void layer_lock_all_off(void);
|
||||
|
||||
/** Toggles whether `layer` is locked. */
|
||||
void layer_lock_invert(uint8_t layer);
|
||||
|
||||
/**
|
||||
* Optional callback that gets called when a layer is locked or unlocked.
|
||||
*
|
||||
* This is useful to represent the current lock state, e.g. by setting an LED or
|
||||
* playing a sound. In your keymap, define
|
||||
*
|
||||
* void layer_lock_set_user(layer_state_t locked_layers) {
|
||||
* // Do something like `set_led(is_layer_locked(NAV));`
|
||||
* }
|
||||
*
|
||||
* @param locked_layers Bitfield in which the kth bit represents whether the
|
||||
* kth layer is on.
|
||||
*/
|
||||
bool layer_lock_set_kb(layer_state_t locked_layers);
|
||||
bool layer_lock_set_user(layer_state_t locked_layers);
|
||||
|
||||
/** Handle various background tasks */
|
||||
void layer_lock_task(void);
|
||||
|
||||
/** Update any configured timeouts */
|
||||
void layer_lock_activity_trigger(void);
|
||||
|
|
@ -2,17 +2,12 @@
|
|||
LED_MATRIX_EFFECT(BREATHING)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
bool BREATHING(effect_params_t* params) {
|
||||
LED_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
static uint8_t BREATHING_math(uint8_t val, uint8_t i, uint8_t time) {
|
||||
return scale8(abs8(sin8(time / 2) - 128) * 2, val);
|
||||
}
|
||||
|
||||
uint8_t val = led_matrix_eeconfig.val;
|
||||
uint16_t time = scale16by8(g_led_timer, led_matrix_eeconfig.speed / 8);
|
||||
val = scale8(abs8(sin8(time) - 128) * 2, val);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
LED_MATRIX_TEST_LED_FLAGS();
|
||||
led_matrix_set_value(i, val);
|
||||
}
|
||||
return led_matrix_check_finished_leds(led_max);
|
||||
bool BREATHING(effect_params_t* params) {
|
||||
return effect_runner_i(params, &BREATHING_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
|
|
|||
|
|
@ -139,11 +139,20 @@ void led_matrix_update_pwm_buffers(void) {
|
|||
led_matrix_driver.flush();
|
||||
}
|
||||
|
||||
__attribute__((weak)) int led_matrix_led_index(int index) {
|
||||
#if defined(LED_MATRIX_SPLIT)
|
||||
if (!is_keyboard_left() && index >= k_led_matrix_split[0]) {
|
||||
return index - k_led_matrix_split[0];
|
||||
}
|
||||
#endif
|
||||
return index;
|
||||
}
|
||||
|
||||
void led_matrix_set_value(int index, uint8_t value) {
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
value = pgm_read_byte(&CIE1931_CURVE[value]);
|
||||
#endif
|
||||
led_matrix_driver.set_value(index, value);
|
||||
led_matrix_driver.set_value(led_matrix_led_index(index), value);
|
||||
}
|
||||
|
||||
void led_matrix_set_value_all(uint8_t value) {
|
||||
|
|
@ -387,7 +396,6 @@ struct led_matrix_limits_t led_matrix_get_limits(uint8_t iter) {
|
|||
limits.led_min_index = LED_MATRIX_LED_PROCESS_LIMIT * (iter);
|
||||
limits.led_max_index = limits.led_min_index + LED_MATRIX_LED_PROCESS_LIMIT;
|
||||
if (limits.led_max_index > LED_MATRIX_LED_COUNT) limits.led_max_index = LED_MATRIX_LED_COUNT;
|
||||
uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;
|
||||
if (is_keyboard_left() && (limits.led_max_index > k_led_matrix_split[0])) limits.led_max_index = k_led_matrix_split[0];
|
||||
if (!(is_keyboard_left()) && (limits.led_min_index < k_led_matrix_split[0])) limits.led_min_index = k_led_matrix_split[0];
|
||||
# else
|
||||
|
|
@ -397,9 +405,8 @@ struct led_matrix_limits_t led_matrix_get_limits(uint8_t iter) {
|
|||
# endif
|
||||
#else
|
||||
# if defined(LED_MATRIX_SPLIT)
|
||||
limits.led_min_index = 0;
|
||||
limits.led_max_index = LED_MATRIX_LED_COUNT;
|
||||
const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;
|
||||
limits.led_min_index = 0;
|
||||
limits.led_max_index = LED_MATRIX_LED_COUNT;
|
||||
if (is_keyboard_left() && (limits.led_max_index > k_led_matrix_split[0])) limits.led_max_index = k_led_matrix_split[0];
|
||||
if (!(is_keyboard_left()) && (limits.led_min_index < k_led_matrix_split[0])) limits.led_min_index = k_led_matrix_split[0];
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ void eeconfig_debug_led_matrix(void);
|
|||
uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i);
|
||||
uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i);
|
||||
|
||||
int led_matrix_led_index(int index);
|
||||
|
||||
void led_matrix_set_value(int index, uint8_t value);
|
||||
void led_matrix_set_value_all(uint8_t value);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef PROTOCOL_ARM_ATSAM
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "print.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ static uint16_t usb_setups[STORED_USB_SETUPS];
|
|||
#endif
|
||||
|
||||
#ifndef OS_DETECTION_DEBOUNCE
|
||||
# define OS_DETECTION_DEBOUNCE 200
|
||||
# define OS_DETECTION_DEBOUNCE 250
|
||||
#endif
|
||||
|
||||
// 2s should always be more than enough (otherwise, you may have other issues)
|
||||
|
|
@ -59,25 +59,40 @@ struct setups_data_t setups_data = {
|
|||
};
|
||||
|
||||
static volatile os_variant_t detected_os = OS_UNSURE;
|
||||
static os_variant_t reported_os = OS_UNSURE;
|
||||
static volatile os_variant_t reported_os = OS_UNSURE;
|
||||
|
||||
// we need to be able to report OS_UNSURE if that is the stable result of the guesses
|
||||
static bool first_report = true;
|
||||
static volatile bool first_report = true;
|
||||
|
||||
// to react on USB state changes
|
||||
static volatile enum usb_device_state current_usb_device_state = USB_DEVICE_STATE_INIT;
|
||||
static enum usb_device_state reported_usb_device_state = USB_DEVICE_STATE_INIT;
|
||||
static volatile struct usb_device_state current_usb_device_state = {.configure_state = USB_DEVICE_STATE_NO_INIT};
|
||||
static volatile struct usb_device_state maxprev_usb_device_state = {.configure_state = USB_DEVICE_STATE_NO_INIT};
|
||||
|
||||
// the OS detection might be unstable for a while, "debounce" it
|
||||
static volatile bool debouncing = false;
|
||||
static volatile fast_timer_t last_time;
|
||||
static volatile fast_timer_t last_time = 0;
|
||||
|
||||
void os_detection_task(void) {
|
||||
if (current_usb_device_state == USB_DEVICE_STATE_CONFIGURED) {
|
||||
#ifdef OS_DETECTION_KEYBOARD_RESET
|
||||
// resetting the keyboard on the USB device state change callback results in instability, so delegate that to this task
|
||||
// only take action if it's been stable at least once, to avoid issues with some KVMs
|
||||
if (current_usb_device_state.configure_state <= USB_DEVICE_STATE_INIT && maxprev_usb_device_state.configure_state >= USB_DEVICE_STATE_CONFIGURED) {
|
||||
if (debouncing && timer_elapsed_fast(last_time) >= OS_DETECTION_DEBOUNCE) {
|
||||
soft_reset_keyboard();
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef OS_DETECTION_SINGLE_REPORT
|
||||
if (!first_report) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (current_usb_device_state.configure_state == USB_DEVICE_STATE_CONFIGURED) {
|
||||
// debouncing goes for both the detected OS as well as the USB state
|
||||
if (debouncing && timer_elapsed_fast(last_time) >= OS_DETECTION_DEBOUNCE) {
|
||||
debouncing = false;
|
||||
reported_usb_device_state = current_usb_device_state;
|
||||
debouncing = false;
|
||||
last_time = 0;
|
||||
if (detected_os != reported_os || first_report) {
|
||||
first_report = false;
|
||||
reported_os = detected_os;
|
||||
|
|
@ -85,13 +100,6 @@ void os_detection_task(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef OS_DETECTION_KEYBOARD_RESET
|
||||
// resetting the keyboard on the USB device state change callback results in instability, so delegate that to this task
|
||||
// only take action if it's been stable at least once, to avoid issues with some KVMs
|
||||
else if (current_usb_device_state == USB_DEVICE_STATE_INIT && reported_usb_device_state != USB_DEVICE_STATE_INIT) {
|
||||
soft_reset_keyboard();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool process_detected_host_os_kb(os_variant_t detected_os) {
|
||||
|
|
@ -125,7 +133,7 @@ void process_wlength(const uint16_t w_length) {
|
|||
} else if (setups_data.count == setups_data.cnt_ff) {
|
||||
// Linux has 3 packets with 0xFF.
|
||||
guessed = OS_LINUX;
|
||||
} else if (setups_data.count == 5 && setups_data.last_wlength == 0xFF && setups_data.cnt_ff == 1 && setups_data.cnt_02 == 2) {
|
||||
} else if (setups_data.count >= 5 && setups_data.last_wlength == 0xFF && setups_data.cnt_ff >= 1 && setups_data.cnt_02 >= 2) {
|
||||
guessed = OS_MACOS;
|
||||
} else if (setups_data.count == 4 && setups_data.cnt_ff == 0 && setups_data.cnt_02 == 2) {
|
||||
// iOS and iPadOS don't have the last 0xFF packet.
|
||||
|
|
@ -155,16 +163,20 @@ os_variant_t detected_host_os(void) {
|
|||
|
||||
void erase_wlength_data(void) {
|
||||
memset(&setups_data, 0, sizeof(setups_data));
|
||||
detected_os = OS_UNSURE;
|
||||
reported_os = OS_UNSURE;
|
||||
current_usb_device_state = USB_DEVICE_STATE_INIT;
|
||||
reported_usb_device_state = USB_DEVICE_STATE_INIT;
|
||||
debouncing = false;
|
||||
first_report = true;
|
||||
detected_os = OS_UNSURE;
|
||||
reported_os = OS_UNSURE;
|
||||
current_usb_device_state.configure_state = USB_DEVICE_STATE_NO_INIT;
|
||||
maxprev_usb_device_state.configure_state = USB_DEVICE_STATE_NO_INIT;
|
||||
debouncing = false;
|
||||
last_time = 0;
|
||||
first_report = true;
|
||||
}
|
||||
|
||||
void os_detection_notify_usb_device_state_change(enum usb_device_state usb_device_state) {
|
||||
void os_detection_notify_usb_device_state_change(struct usb_device_state usb_device_state) {
|
||||
// treat this like any other source of instability
|
||||
if (maxprev_usb_device_state.configure_state < current_usb_device_state.configure_state) {
|
||||
maxprev_usb_device_state.configure_state = current_usb_device_state.configure_state;
|
||||
}
|
||||
current_usb_device_state = usb_device_state;
|
||||
last_time = timer_read_fast();
|
||||
debouncing = true;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ typedef enum {
|
|||
void process_wlength(const uint16_t w_length);
|
||||
os_variant_t detected_host_os(void);
|
||||
void erase_wlength_data(void);
|
||||
void os_detection_notify_usb_device_state_change(enum usb_device_state usb_device_state);
|
||||
void os_detection_notify_usb_device_state_change(struct usb_device_state usb_device_state);
|
||||
|
||||
void os_detection_task(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,12 @@ ChibiOS:
|
|||
Windows 10: [FF, FF, 4, 24, 4, 24, 4, FF, 24, FF, 4, FF, 24, 4, 24, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A, 20A]
|
||||
Windows 10 (another host): [FF, FF, 4, 24, 4, 24, 4, 24, 4, 24, 4, 24]
|
||||
macOS 12.5: [2, 24, 2, 28, FF]
|
||||
macOS 15.1.x: [ 2, 4E, 2, 1C, 2, 1A, FF, FF]
|
||||
macOS 15.x (another host): [ 2, 0E, 2, 1E, 2, 42, FF]
|
||||
macOS 15.x (periodic weirdness): [ 2, 42, 2, 1C, 2, 1A, FF, 2, 42, 2, 1C, 2, 1A, FF ]
|
||||
iOS/iPadOS 15.6: [2, 24, 2, 28]
|
||||
Linux (including Android, Raspberry Pi and WebOS TV): [FF, FF, FF]
|
||||
Linux (another host): [FF, FF, FF, FF, FF, FF]
|
||||
PS5: [2, 4, 2, 28, 2, 24]
|
||||
Nintendo Switch: [82, FF, 40, 40, FF, 40, 40, FF, 40, 40, FF, 40, 40, FF, 40, 40]
|
||||
Quest 2: [FF, FF, FF, FE, FF, FE, FF, FE, FF, FE, FF]
|
||||
|
|
@ -79,6 +83,7 @@ Windows 10 (first connect): [12, FF, FF, 4, 10, FF, FF, FF, 4, 10, 20A, 20A, 20A
|
|||
Windows 10 (subsequent connect): [FF, FF, 4, 10, FF, 4, FF, 10, FF, 20A, 20A, 20A, 20A, 20A, 20A]
|
||||
Windows 10 (another host): [FF, FF, 4, 10, 4, 10]
|
||||
macOS: [2, 10, 2, E, FF]
|
||||
macOS 15.x: [ 2, 64, 2, 28, FF, FF]
|
||||
iOS/iPadOS: [2, 10, 2, E]
|
||||
Linux: [FF, FF, FF]
|
||||
PS5: [2, 4, 2, E, 2, 10]
|
||||
|
|
@ -109,18 +114,67 @@ TEST_F(OsDetectionTest, TestLinux) {
|
|||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosLinux) {
|
||||
EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}), OS_LINUX);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosMacos) {
|
||||
EXPECT_EQ(check_sequence({0x2, 0x24, 0x2, 0x28, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosMacos2) {
|
||||
EXPECT_EQ(check_sequence({0x2, 0x42, 0x2, 0x1C, 0x2, 0x1A, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosMacos3) {
|
||||
EXPECT_EQ(check_sequence({0x2, 0x42, 0x2, 0x1C, 0x2, 0x1A, 0xFF, 0x2, 0x42, 0x2, 0x1C, 0x2, 0x1A, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
// Regression reported in https://github.com/qmk/qmk_firmware/pull/21777#issuecomment-1922815841
|
||||
TEST_F(OsDetectionTest, TestChibiosMacM1) {
|
||||
EXPECT_EQ(check_sequence({0x02, 0x32, 0x02, 0x24, 0x101, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosMacSequoia) {
|
||||
EXPECT_EQ(check_sequence({0x02, 0x4E, 0x02, 0x1C, 0x02, 0x1A, 0xFF, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosMacSequoia2) {
|
||||
EXPECT_EQ(check_sequence({0x02, 0x4E, 0x02, 0x1C, 0x02, 0x1A, 0xFF, 0x02, 0x42, 0x02, 0x1C, 0x02, 0x1A, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestChibiosMacSequoia3) {
|
||||
EXPECT_EQ(check_sequence({0x02, 0x0E, 0x02, 0x1E, 0x02, 0x42, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestLufaMacos) {
|
||||
EXPECT_EQ(check_sequence({0x2, 0x10, 0x2, 0xE, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestDetectLufaMacSequoia2) {
|
||||
EXPECT_EQ(check_sequence({0x02, 0x64, 0x02, 0x28, 0xFF, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestVusbMacos) {
|
||||
EXPECT_EQ(check_sequence({0x2, 0xE, 0x2, 0xE, 0xFF}), OS_MACOS);
|
||||
os_detection_task();
|
||||
|
|
@ -235,13 +289,6 @@ TEST_F(OsDetectionTest, TestVusbQuest2) {
|
|||
assert_not_reported();
|
||||
}
|
||||
|
||||
// Regression reported in https://github.com/qmk/qmk_firmware/pull/21777#issuecomment-1922815841
|
||||
TEST_F(OsDetectionTest, TestDetectMacM1AsIOS) {
|
||||
EXPECT_EQ(check_sequence({0x02, 0x32, 0x02, 0x24, 0x101, 0xFF}), OS_IOS);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
}
|
||||
|
||||
TEST_F(OsDetectionTest, TestDoNotReportIfUsbUnstable) {
|
||||
EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFE}), OS_LINUX);
|
||||
os_detection_task();
|
||||
|
|
@ -253,9 +300,11 @@ TEST_F(OsDetectionTest, TestDoNotReportIfUsbUnstable) {
|
|||
EXPECT_EQ(detected_host_os(), OS_LINUX);
|
||||
}
|
||||
|
||||
static struct usb_device_state usb_device_state_configured = {.configure_state = USB_DEVICE_STATE_CONFIGURED};
|
||||
|
||||
TEST_F(OsDetectionTest, TestReportAfterDebounce) {
|
||||
EXPECT_EQ(check_sequence({0xFF, 0xFF, 0xFF, 0xFE}), OS_LINUX);
|
||||
os_detection_notify_usb_device_state_change(USB_DEVICE_STATE_CONFIGURED);
|
||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
|
||||
|
|
@ -291,7 +340,7 @@ TEST_F(OsDetectionTest, TestReportAfterDebounce) {
|
|||
|
||||
TEST_F(OsDetectionTest, TestReportAfterDebounceLongWait) {
|
||||
EXPECT_EQ(check_sequence({0x12, 0xFF, 0xFF, 0x4, 0x10, 0xFF, 0xFF, 0xFF, 0x4, 0x10, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A}), OS_WINDOWS);
|
||||
os_detection_notify_usb_device_state_change(USB_DEVICE_STATE_CONFIGURED);
|
||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
|
||||
|
|
@ -318,7 +367,7 @@ TEST_F(OsDetectionTest, TestReportAfterDebounceLongWait) {
|
|||
|
||||
TEST_F(OsDetectionTest, TestReportUnsure) {
|
||||
EXPECT_EQ(check_sequence({0x12, 0xFF}), OS_UNSURE);
|
||||
os_detection_notify_usb_device_state_change(USB_DEVICE_STATE_CONFIGURED);
|
||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
|
||||
|
|
@ -345,7 +394,7 @@ TEST_F(OsDetectionTest, TestReportUnsure) {
|
|||
|
||||
TEST_F(OsDetectionTest, TestDoNotReportIntermediateResults) {
|
||||
EXPECT_EQ(check_sequence({0x12, 0xFF}), OS_UNSURE);
|
||||
os_detection_notify_usb_device_state_change(USB_DEVICE_STATE_CONFIGURED);
|
||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
|
||||
|
|
@ -356,7 +405,7 @@ TEST_F(OsDetectionTest, TestDoNotReportIntermediateResults) {
|
|||
|
||||
// at this stage, the final result has not been reached yet
|
||||
EXPECT_EQ(check_sequence({0xFF}), OS_LINUX);
|
||||
os_detection_notify_usb_device_state_change(USB_DEVICE_STATE_CONFIGURED);
|
||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||
advance_time(OS_DETECTION_DEBOUNCE - 1);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
|
|
@ -365,7 +414,7 @@ TEST_F(OsDetectionTest, TestDoNotReportIntermediateResults) {
|
|||
|
||||
// the remainder is processed
|
||||
EXPECT_EQ(check_sequence({0x4, 0x10, 0xFF, 0xFF, 0xFF, 0x4, 0x10, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A, 0x20A}), OS_WINDOWS);
|
||||
os_detection_notify_usb_device_state_change(USB_DEVICE_STATE_CONFIGURED);
|
||||
os_detection_notify_usb_device_state_change(usb_device_state_configured);
|
||||
advance_time(OS_DETECTION_DEBOUNCE - 1);
|
||||
os_detection_task();
|
||||
assert_not_reported();
|
||||
|
|
|
|||
|
|
@ -557,6 +557,12 @@ int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, pai
|
|||
# define SH1106_NUM_DEVICES 0
|
||||
#endif // QUANTUM_PAINTER_SH1106_ENABLE
|
||||
|
||||
#ifdef QUANTUM_PAINTER_LD7032_ENABLE
|
||||
# include "qp_ld7032.h"
|
||||
#else // QUANTUM_PAINTER_LD7032_ENABLE
|
||||
# define LD7032_NUM_DEVICES 0
|
||||
#endif // QUANTUM_PAINTER_LD7032_ENABLE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Quantum Painter Extras
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ enum {
|
|||
+ (GC9107_NUM_DEVICES) // GC9107
|
||||
+ (SSD1351_NUM_DEVICES) // SSD1351
|
||||
+ (SH1106_NUM_DEVICES) // SH1106
|
||||
+ (LD7032_NUM_DEVICES) // LD7032
|
||||
};
|
||||
|
||||
static painter_device_t qp_devices[QP_NUM_DEVICES] = {NULL};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ VALID_QUANTUM_PAINTER_DRIVERS := \
|
|||
gc9107_spi \
|
||||
ssd1351_spi \
|
||||
sh1106_i2c \
|
||||
sh1106_spi
|
||||
sh1106_spi \
|
||||
ld7032_i2c \
|
||||
ld7032_spi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -182,6 +184,29 @@ define handle_quantum_painter_driver
|
|||
$(DRIVER_PATH)/painter/oled_panel/qp_oled_panel.c \
|
||||
$(DRIVER_PATH)/painter/sh1106/qp_sh1106.c
|
||||
|
||||
else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),ld7032_spi)
|
||||
QUANTUM_PAINTER_NEEDS_SURFACE := yes
|
||||
QUANTUM_PAINTER_NEEDS_COMMS_SPI := yes
|
||||
QUANTUM_PAINTER_NEEDS_COMMS_SPI_DC_RESET := yes
|
||||
OPT_DEFS += -DQUANTUM_PAINTER_LD7032_ENABLE -DQUANTUM_PAINTER_LD7032_SPI_ENABLE
|
||||
COMMON_VPATH += \
|
||||
$(DRIVER_PATH)/painter/oled_panel \
|
||||
$(DRIVER_PATH)/painter/ld7032
|
||||
SRC += \
|
||||
$(DRIVER_PATH)/painter/oled_panel/qp_oled_panel.c \
|
||||
$(DRIVER_PATH)/painter/ld7032/qp_ld7032.c
|
||||
|
||||
else ifeq ($$(strip $$(CURRENT_PAINTER_DRIVER)),ld7032_i2c)
|
||||
QUANTUM_PAINTER_NEEDS_SURFACE := yes
|
||||
QUANTUM_PAINTER_NEEDS_COMMS_I2C := yes
|
||||
OPT_DEFS += -DQUANTUM_PAINTER_LD7032_ENABLE -DQUANTUM_PAINTER_LD7032_I2C_ENABLE
|
||||
COMMON_VPATH += \
|
||||
$(DRIVER_PATH)/painter/oled_panel \
|
||||
$(DRIVER_PATH)/painter/ld7032
|
||||
SRC += \
|
||||
$(DRIVER_PATH)/painter/oled_panel/qp_oled_panel.c \
|
||||
$(DRIVER_PATH)/painter/ld7032/qp_ld7032.c
|
||||
|
||||
endif
|
||||
endef
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,28 @@ uint16_t pointing_device_get_shared_cpi(void) {
|
|||
static report_mouse_t local_mouse_report = {};
|
||||
static bool pointing_device_force_send = false;
|
||||
|
||||
extern const pointing_device_driver_t pointing_device_driver;
|
||||
#define POINTING_DEVICE_DRIVER_CONCAT(name) name##_pointing_device_driver
|
||||
#define POINTING_DEVICE_DRIVER(name) POINTING_DEVICE_DRIVER_CONCAT(name)
|
||||
|
||||
#ifdef POINTING_DEVICE_DRIVER_custom
|
||||
__attribute__((weak)) void pointing_device_driver_init(void) {}
|
||||
__attribute__((weak)) report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) {
|
||||
return mouse_report;
|
||||
}
|
||||
__attribute__((weak)) uint16_t pointing_device_driver_get_cpi(void) {
|
||||
return 0;
|
||||
}
|
||||
__attribute__((weak)) void pointing_device_driver_set_cpi(uint16_t cpi) {}
|
||||
|
||||
const pointing_device_driver_t custom_pointing_device_driver = {
|
||||
.init = pointing_device_driver_init,
|
||||
.get_report = pointing_device_driver_get_report,
|
||||
.get_cpi = pointing_device_driver_get_cpi,
|
||||
.set_cpi = pointing_device_driver_set_cpi,
|
||||
};
|
||||
#endif
|
||||
|
||||
const pointing_device_driver_t *pointing_device_driver = &POINTING_DEVICE_DRIVER(POINTING_DEVICE_DRIVER_NAME);
|
||||
|
||||
/**
|
||||
* @brief Keyboard level code pointing device initialisation
|
||||
|
|
@ -146,7 +167,7 @@ __attribute__((weak)) void pointing_device_init(void) {
|
|||
if ((POINTING_DEVICE_THIS_SIDE))
|
||||
#endif
|
||||
{
|
||||
pointing_device_driver.init();
|
||||
pointing_device_driver->init();
|
||||
#ifdef POINTING_DEVICE_MOTION_PIN
|
||||
# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
|
||||
gpio_set_pin_input_high(POINTING_DEVICE_MOTION_PIN);
|
||||
|
|
@ -258,15 +279,15 @@ __attribute__((weak)) bool pointing_device_task(void) {
|
|||
# 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);
|
||||
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;
|
||||
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);
|
||||
local_mouse_report = pointing_device_driver->get_report(local_mouse_report);
|
||||
#endif // defined(SPLIT_POINTING_ENABLE)
|
||||
|
||||
#ifdef POINTING_DEVICE_MOTION_PIN
|
||||
|
|
@ -331,9 +352,9 @@ void pointing_device_set_report(report_mouse_t mouse_report) {
|
|||
*/
|
||||
uint16_t pointing_device_get_cpi(void) {
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
return POINTING_DEVICE_THIS_SIDE ? pointing_device_driver.get_cpi() : shared_cpi;
|
||||
return POINTING_DEVICE_THIS_SIDE ? pointing_device_driver->get_cpi() : shared_cpi;
|
||||
#else
|
||||
return pointing_device_driver.get_cpi();
|
||||
return pointing_device_driver->get_cpi();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -347,12 +368,12 @@ uint16_t pointing_device_get_cpi(void) {
|
|||
void pointing_device_set_cpi(uint16_t cpi) {
|
||||
#if defined(SPLIT_POINTING_ENABLE)
|
||||
if (POINTING_DEVICE_THIS_SIDE) {
|
||||
pointing_device_driver.set_cpi(cpi);
|
||||
pointing_device_driver->set_cpi(cpi);
|
||||
} else {
|
||||
shared_cpi = cpi;
|
||||
}
|
||||
#else
|
||||
pointing_device_driver.set_cpi(cpi);
|
||||
pointing_device_driver->set_cpi(cpi);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -370,35 +391,35 @@ void pointing_device_set_cpi(uint16_t cpi) {
|
|||
void pointing_device_set_cpi_on_side(bool left, uint16_t cpi) {
|
||||
bool local = (is_keyboard_left() == left);
|
||||
if (local) {
|
||||
pointing_device_driver.set_cpi(cpi);
|
||||
pointing_device_driver->set_cpi(cpi);
|
||||
} else {
|
||||
shared_cpi = cpi;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief clamps int16_t to int8_t
|
||||
* @brief clamps int16_t to int8_t, or int32_t to int16_t
|
||||
*
|
||||
* @param[in] int16_t value
|
||||
* @return int8_t clamped value
|
||||
* @param[in] hv_clamp_range_t value
|
||||
* @return mouse_hv_report_t clamped value
|
||||
*/
|
||||
static inline int8_t pointing_device_hv_clamp(int16_t value) {
|
||||
if (value < INT8_MIN) {
|
||||
return INT8_MIN;
|
||||
} else if (value > INT8_MAX) {
|
||||
return INT8_MAX;
|
||||
static inline mouse_hv_report_t pointing_device_hv_clamp(hv_clamp_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 int16_t to int8_t
|
||||
* @brief clamps int16_t to int8_t, or int32_t to int16_t
|
||||
*
|
||||
* @param[in] clamp_range_t value
|
||||
* @param[in] xy_clamp_range_t value
|
||||
* @return mouse_xy_report_t clamped value
|
||||
*/
|
||||
static inline mouse_xy_report_t pointing_device_xy_clamp(clamp_range_t value) {
|
||||
static inline mouse_xy_report_t pointing_device_xy_clamp(xy_clamp_range_t value) {
|
||||
if (value < XY_REPORT_MIN) {
|
||||
return XY_REPORT_MIN;
|
||||
} else if (value > XY_REPORT_MAX) {
|
||||
|
|
@ -419,10 +440,10 @@ static inline mouse_xy_report_t pointing_device_xy_clamp(clamp_range_t value) {
|
|||
* @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_range_t)left_report.x + right_report.x);
|
||||
left_report.y = pointing_device_xy_clamp((clamp_range_t)left_report.y + right_report.y);
|
||||
left_report.h = pointing_device_hv_clamp((int16_t)left_report.h + right_report.h);
|
||||
left_report.v = pointing_device_hv_clamp((int16_t)left_report.v + right_report.v);
|
||||
left_report.x = pointing_device_xy_clamp((xy_clamp_range_t)left_report.x + right_report.x);
|
||||
left_report.y = pointing_device_xy_clamp((xy_clamp_range_t)left_report.y + right_report.y);
|
||||
left_report.h = pointing_device_hv_clamp((hv_clamp_range_t)left_report.h + right_report.h);
|
||||
left_report.v = pointing_device_hv_clamp((hv_clamp_range_t)left_report.v + right_report.v);
|
||||
left_report.buttons |= right_report.buttons;
|
||||
return left_report;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "host.h"
|
||||
#include "report.h"
|
||||
|
||||
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;
|
||||
|
||||
#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
|
||||
# include "pointing_device_auto_mouse.h"
|
||||
#endif
|
||||
|
|
@ -44,7 +51,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
# include "drivers/sensors/azoteq_iqs5xx.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"
|
||||
|
|
@ -74,13 +80,6 @@ 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,
|
||||
|
|
@ -95,13 +94,26 @@ typedef enum {
|
|||
#ifdef MOUSE_EXTENDED_REPORT
|
||||
# define XY_REPORT_MIN INT16_MIN
|
||||
# define XY_REPORT_MAX INT16_MAX
|
||||
typedef int32_t clamp_range_t;
|
||||
typedef int32_t xy_clamp_range_t;
|
||||
#else
|
||||
# define XY_REPORT_MIN INT8_MIN
|
||||
# define XY_REPORT_MAX INT8_MAX
|
||||
typedef int16_t clamp_range_t;
|
||||
typedef int16_t xy_clamp_range_t;
|
||||
#endif
|
||||
|
||||
#ifdef WHEEL_EXTENDED_REPORT
|
||||
# define HV_REPORT_MIN INT16_MIN
|
||||
# define HV_REPORT_MAX INT16_MAX
|
||||
typedef int32_t hv_clamp_range_t;
|
||||
#else
|
||||
# define HV_REPORT_MIN INT8_MIN
|
||||
# define HV_REPORT_MAX INT8_MAX
|
||||
typedef int16_t hv_clamp_range_t;
|
||||
#endif
|
||||
|
||||
#define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt)))
|
||||
#define CONSTRAIN_HID_XY(amt) ((amt) < XY_REPORT_MIN ? XY_REPORT_MIN : ((amt) > XY_REPORT_MAX ? XY_REPORT_MAX : (amt)))
|
||||
|
||||
void pointing_device_init(void);
|
||||
bool pointing_device_task(void);
|
||||
bool pointing_device_send(void);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue