aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quantum/process_keycode/process_combo.c6
-rw-r--r--quantum/rgb_matrix.c1
-rw-r--r--quantum/split_common/transport.c4
-rw-r--r--quantum/wpm.c39
-rw-r--r--quantum/wpm.h4
-rw-r--r--tmk_core/protocol/vusb/vusb.c28
6 files changed, 39 insertions, 43 deletions
diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c
index 25a606063..c4e299958 100644
--- a/quantum/process_keycode/process_combo.c
+++ b/quantum/process_keycode/process_combo.c
@@ -20,8 +20,8 @@
20#ifndef COMBO_VARIABLE_LEN 20#ifndef COMBO_VARIABLE_LEN
21__attribute__((weak)) combo_t key_combos[COMBO_COUNT] = {}; 21__attribute__((weak)) combo_t key_combos[COMBO_COUNT] = {};
22#else 22#else
23extern combo_t key_combos[]; 23extern combo_t key_combos[];
24extern int COMBO_LEN; 24extern int COMBO_LEN;
25#endif 25#endif
26 26
27__attribute__((weak)) void process_combo_event(uint8_t combo_index, bool pressed) {} 27__attribute__((weak)) void process_combo_event(uint8_t combo_index, bool pressed) {}
@@ -146,7 +146,7 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
146 } 146 }
147#ifndef COMBO_VARIABLE_LEN 147#ifndef COMBO_VARIABLE_LEN
148 for (current_combo_index = 0; current_combo_index < COMBO_COUNT; ++current_combo_index) { 148 for (current_combo_index = 0; current_combo_index < COMBO_COUNT; ++current_combo_index) {
149#else 149#else
150 for (current_combo_index = 0; current_combo_index < COMBO_LEN; ++current_combo_index) { 150 for (current_combo_index = 0; current_combo_index < COMBO_LEN; ++current_combo_index) {
151#endif 151#endif
152 combo_t *combo = &key_combos[current_combo_index]; 152 combo_t *combo = &key_combos[current_combo_index];
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 1a9cf82e5..3fae9d737 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -111,7 +111,6 @@ const point_t k_rgb_matrix_center = RGB_MATRIX_CENTER;
111# define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2 111# define RGB_MATRIX_STARTUP_SPD UINT8_MAX / 2
112#endif 112#endif
113 113
114
115bool g_suspend_state = false; 114bool g_suspend_state = false;
116 115
117rgb_config_t rgb_matrix_config; 116rgb_config_t rgb_matrix_config;
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index 3234a3ef5..467ff81a9 100644
--- a/quantum/split_common/transport.c
+++ b/quantum/split_common/transport.c
@@ -85,7 +85,7 @@ bool transport_master(matrix_row_t matrix[]) {
85 85
86# ifdef WPM_ENABLE 86# ifdef WPM_ENABLE
87 uint8_t current_wpm = get_current_wpm(); 87 uint8_t current_wpm = get_current_wpm();
88 if(current_wpm != i2c_buffer->current_wpm) { 88 if (current_wpm != i2c_buffer->current_wpm) {
89 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WPM_START, (void *)&current_wpm, sizeof(current_wpm), TIMEOUT) >= 0) { 89 if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_WPM_START, (void *)&current_wpm, sizeof(current_wpm), TIMEOUT) >= 0) {
90 i2c_buffer->current_wpm = current_wpm; 90 i2c_buffer->current_wpm = current_wpm;
91 } 91 }
@@ -269,7 +269,7 @@ void transport_slave(matrix_row_t matrix[]) {
269# endif 269# endif
270 270
271# ifdef WPM_ENABLE 271# ifdef WPM_ENABLE
272 set_current_wpm(serial_m2s_buffer.current_wpm); 272 set_current_wpm(serial_m2s_buffer.current_wpm);
273# endif 273# endif
274} 274}
275 275
diff --git a/quantum/wpm.c b/quantum/wpm.c
index d4c971f31..da30bd252 100644
--- a/quantum/wpm.c
+++ b/quantum/wpm.c
@@ -17,12 +17,12 @@
17 17
18#include "wpm.h" 18#include "wpm.h"
19 19
20//WPM Stuff 20// WPM Stuff
21static uint8_t current_wpm = 0; 21static uint8_t current_wpm = 0;
22static uint8_t latest_wpm = 0; 22static uint8_t latest_wpm = 0;
23static uint16_t wpm_timer = 0; 23static uint16_t wpm_timer = 0;
24 24
25//This smoothing is 40 keystrokes 25// This smoothing is 40 keystrokes
26static const float wpm_smoothing = 0.0487; 26static const float wpm_smoothing = 0.0487;
27 27
28void set_current_wpm(uint8_t new_wpm) { current_wpm = new_wpm; } 28void set_current_wpm(uint8_t new_wpm) { current_wpm = new_wpm; }
@@ -34,34 +34,31 @@ bool wpm_keycode(uint16_t keycode) { return wpm_keycode_kb(keycode); }
34__attribute__((weak)) bool wpm_keycode_kb(uint16_t keycode) { return wpm_keycode_user(keycode); } 34__attribute__((weak)) bool wpm_keycode_kb(uint16_t keycode) { return wpm_keycode_user(keycode); }
35 35
36__attribute__((weak)) bool wpm_keycode_user(uint16_t keycode) { 36__attribute__((weak)) bool wpm_keycode_user(uint16_t keycode) {
37
38 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)) { 37 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)) {
39 keycode = keycode & 0xFF; 38 keycode = keycode & 0xFF;
40 } else if (keycode > 0xFF) { 39 } else if (keycode > 0xFF) {
41 keycode = 0; 40 keycode = 0;
42 } 41 }
43 if((keycode >= KC_A && keycode <= KC_0) || (keycode >= KC_TAB && keycode <= KC_SLASH)) { 42 if ((keycode >= KC_A && keycode <= KC_0) || (keycode >= KC_TAB && keycode <= KC_SLASH)) {
44 return true; 43 return true;
45 } 44 }
46 45
47 return false; 46 return false;
48} 47}
49 48
50
51void update_wpm(uint16_t keycode) { 49void update_wpm(uint16_t keycode) {
52 if(wpm_keycode(keycode)) { 50 if (wpm_keycode(keycode)) {
53 if(wpm_timer > 0) { 51 if (wpm_timer > 0) {
54 latest_wpm = 60000 / timer_elapsed(wpm_timer) / 5; 52 latest_wpm = 60000 / timer_elapsed(wpm_timer) / 5;
55 current_wpm = (latest_wpm - current_wpm) * wpm_smoothing + current_wpm; 53 current_wpm = (latest_wpm - current_wpm) * wpm_smoothing + current_wpm;
56 } 54 }
57 wpm_timer = timer_read(); 55 wpm_timer = timer_read();
58 } 56 }
59} 57}
60 58
61void decay_wpm(void) { 59void decay_wpm(void) {
62 if (timer_elapsed(wpm_timer) > 1000) { 60 if (timer_elapsed(wpm_timer) > 1000) {
63 current_wpm = (0 - current_wpm) * wpm_smoothing + 61 current_wpm = (0 - current_wpm) * wpm_smoothing + current_wpm;
64 current_wpm; 62 wpm_timer = timer_read();
65 wpm_timer = timer_read(); 63 }
66 }
67} 64}
diff --git a/quantum/wpm.h b/quantum/wpm.h
index fa0b6d128..15ab4ffcd 100644
--- a/quantum/wpm.h
+++ b/quantum/wpm.h
@@ -23,8 +23,8 @@ bool wpm_keycode(uint16_t keycode);
23bool wpm_keycode_kb(uint16_t keycode); 23bool wpm_keycode_kb(uint16_t keycode);
24bool wpm_keycode_user(uint16_t keycode); 24bool wpm_keycode_user(uint16_t keycode);
25 25
26void set_current_wpm(uint8_t); 26void set_current_wpm(uint8_t);
27uint8_t get_current_wpm(void); 27uint8_t get_current_wpm(void);
28void update_wpm(uint16_t); 28void update_wpm(uint16_t);
29 29
30void decay_wpm(void); 30void decay_wpm(void);
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index abf723952..79e8cf71b 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -354,19 +354,19 @@ const PROGMEM char usbDescriptorConfiguration[] = {
354 /* USB configuration descriptor */ 354 /* USB configuration descriptor */
355 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ 355 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
356 USBDESCR_CONFIG, /* descriptor type */ 356 USBDESCR_CONFIG, /* descriptor type */
357# if defined (MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) 357# if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
358 59, // 9 + (9 + 9 + 7) + (9 + 9 + 7) 358 59, // 9 + (9 + 9 + 7) + (9 + 9 + 7)
359#else 359# else
360 34, // 9 + (9 + 9 + 7) 360 34, // 9 + (9 + 9 + 7)
361# endif 361# endif
362 0, 362 0,
363 // 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + 9, 0, 363// 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT3 + 9, 0,
364 /* total length of data returned (including inlined descriptors) */ 364/* total length of data returned (including inlined descriptors) */
365# if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) 365# if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
366 2, /* number of interfaces in this configuration */ 366 2, /* number of interfaces in this configuration */
367# else 367# else
368 1, 368 1,
369#endif 369# endif
370 1, /* index of this configuration */ 370 1, /* index of this configuration */
371 0, /* configuration name string index */ 371 0, /* configuration name string index */
372# if USB_CFG_IS_SELF_POWERED 372# if USB_CFG_IS_SELF_POWERED
@@ -419,13 +419,13 @@ const PROGMEM char usbDescriptorConfiguration[] = {
419 0, /* PROTOCOL: none */ 419 0, /* PROTOCOL: none */
420 0, /* string index for interface */ 420 0, /* string index for interface */
421 /* HID descriptor */ 421 /* HID descriptor */
422 9, /* sizeof(usbDescrHID): length of descriptor in bytes */ 422 9, /* sizeof(usbDescrHID): length of descriptor in bytes */
423 USBDESCR_HID, /* descriptor type: HID */ 423 USBDESCR_HID, /* descriptor type: HID */
424 0x01, 0x01, /* BCD representation of HID version */ 424 0x01, 0x01, /* BCD representation of HID version */
425 0x00, /* target country code */ 425 0x00, /* target country code */
426 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */ 426 0x01, /* number of HID Report (or other HID class) Descriptor infos to follow */
427 0x22, /* descriptor type: report */ 427 0x22, /* descriptor type: report */
428 sizeof(mouse_extra_hid_report), 0, /* total length of report descriptor */ 428 sizeof(mouse_extra_hid_report), 0, /* total length of report descriptor */
429# if USB_CFG_HAVE_INTRIN_ENDPOINT3 /* endpoint descriptor for endpoint 3 */ 429# if USB_CFG_HAVE_INTRIN_ENDPOINT3 /* endpoint descriptor for endpoint 3 */
430 /* Endpoint descriptor */ 430 /* Endpoint descriptor */
431 7, /* sizeof(usbDescrEndpoint) */ 431 7, /* sizeof(usbDescrEndpoint) */