From 4e69a8bda6c4003c6b9e33de7db89fe073c970f5 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 1 Jul 2017 22:25:06 +0300 Subject: Add basic timing support, and SFT_T tests Also expose some bugs... --- tmk_core/common/test/timer.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/test/timer.c b/tmk_core/common/test/timer.c index 09ea91a891..49efc1c1e4 100644 --- a/tmk_core/common/test/timer.c +++ b/tmk_core/common/test/timer.c @@ -16,15 +16,16 @@ #include "timer.h" -// TODO: the timer should work, but at a much faster rate than realtime -// It should also have some kind of integration with the testing system +static uint32_t current_time = 0; -void timer_init(void) {} +void timer_init(void) {current_time = 0;} -void timer_clear(void) {} +void timer_clear(void) {current_time = 0;} -uint16_t timer_read(void) { return 0; } -uint32_t timer_read32(void) { return 0; } -uint16_t timer_elapsed(uint16_t last) { return 0; } -uint32_t timer_elapsed32(uint32_t last) { return 0; } +uint16_t timer_read(void) { return current_time & 0xFFFF; } +uint32_t timer_read32(void) { return current_time; } +uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); } +uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } +void set_time(uint32_t t) { current_time = t; } +void advance_time(uint32_t ms) { current_time += ms; } \ No newline at end of file -- cgit v1.2.3 From 4087d6da0d60f51735f6ec2c34e5fdabcf9c4447 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 2 Jul 2017 01:06:39 +0300 Subject: Add wait support for tests --- tmk_core/common/test/timer.c | 6 +++++- tmk_core/common/wait.h | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/test/timer.c b/tmk_core/common/test/timer.c index 49efc1c1e4..19e79e1f54 100644 --- a/tmk_core/common/test/timer.c +++ b/tmk_core/common/test/timer.c @@ -28,4 +28,8 @@ uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last) uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } void set_time(uint32_t t) { current_time = t; } -void advance_time(uint32_t ms) { current_time += ms; } \ No newline at end of file +void advance_time(uint32_t ms) { current_time += ms; } + +void wait_ms(uint32_t ms) { + advance_time(ms); +} \ No newline at end of file diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index 911c9ddb5d..bdcb3f2a41 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h @@ -1,6 +1,8 @@ #ifndef WAIT_H #define WAIT_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -16,8 +18,8 @@ extern "C" { #elif defined(__arm__) # include "wait_api.h" #else // Unit tests -#define wait_ms(ms) -#define wait_us(us) +void wait_ms(uint32_t ms); +#define wait_us(us) wait_ms(us / 1000) #endif #ifdef __cplusplus -- cgit v1.2.3 From f30f12ec8122b7c025ff83c5e38e171c4107052b Mon Sep 17 00:00:00 2001 From: Joe Wasson Date: Wed, 26 Jul 2017 21:51:41 -0700 Subject: Add support for GeminiPR steno protocol. This protocol breaks out "duplicate" keys into their own entry in the packet so that more complicated logic can be done on the software side, including support for additional languages and alternative theories. --- tmk_core/common/eeconfig.c | 3 +++ tmk_core/common/eeconfig.h | 1 + tmk_core/common/keyboard.c | 6 ++++++ 3 files changed, 10 insertions(+) (limited to 'tmk_core/common') diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index 140d2b85bb..e2eb4a38e3 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c @@ -19,6 +19,9 @@ void eeconfig_init(void) #ifdef RGBLIGHT_ENABLE eeprom_update_dword(EECONFIG_RGBLIGHT, 0); #endif +#ifdef STENO_ENABLE + eeprom_update_byte(EECONFIG_STENOMODE, 0); +#endif } void eeconfig_enable(void) diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index 280dc7ab67..ce60ca8661 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -34,6 +34,7 @@ along with this program. If not, see . #define EECONFIG_AUDIO (uint8_t *)7 #define EECONFIG_RGBLIGHT (uint32_t *)8 #define EECONFIG_UNICODEMODE (uint8_t *)12 +#define EECONFIG_STENOMODE (uint8_t *)13 /* debug bit */ diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 97a8f1cd8c..9466e10e2d 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -51,6 +51,9 @@ along with this program. If not, see . #ifdef RGBLIGHT_ENABLE # include "rgblight.h" #endif +#ifdef STENO_ENABLE +# include "process_steno.h" +#endif #ifdef FAUXCLICKY_ENABLE # include "fauxclicky.h" #endif @@ -139,6 +142,9 @@ void keyboard_init(void) { #ifdef RGBLIGHT_ENABLE rgblight_init(); #endif +#ifdef STENO_ENABLE + steno_init(); +#endif #ifdef FAUXCLICKY_ENABLE fauxclicky_init(); #endif -- cgit v1.2.3 From 26650731d1825d8ca8c5e96d10a80bc8cd7b78e4 Mon Sep 17 00:00:00 2001 From: That-Canadian Date: Sun, 13 Aug 2017 14:24:04 -0400 Subject: Added "EECONFIG_HANDEDNESS" to the eeconfig.h , because when RGB was enabled it was overwritting the old EECONFIG_HANDEDNESS address (10), so it is now on a non-conflicting addres (14). Updated MiniDox split_util.h and eeprom files to reflect this change. I recommend adding this to any split board that used these files, my changes will not effect them currently. --- tmk_core/common/eeconfig.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tmk_core/common') diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index ce60ca8661..1397a90c79 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -35,6 +35,8 @@ along with this program. If not, see . #define EECONFIG_RGBLIGHT (uint32_t *)8 #define EECONFIG_UNICODEMODE (uint8_t *)12 #define EECONFIG_STENOMODE (uint8_t *)13 +// EEHANDS for two handed boards +#define EECONFIG_HANDEDNESS (uint8_t *)14 /* debug bit */ -- cgit v1.2.3 From c6224236682c2ac40ccfe752c57fd3ec4905757f Mon Sep 17 00:00:00 2001 From: Martin Sandiford Date: Tue, 15 Aug 2017 10:38:29 +0930 Subject: Remove floating point calculation in mouse move. Saves approx 650 bytes if no other floating point used. --- tmk_core/common/mousekey.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tmk_core/common') diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c index 23469476e2..aa128f0e87 100644 --- a/tmk_core/common/mousekey.c +++ b/tmk_core/common/mousekey.c @@ -55,6 +55,14 @@ uint8_t mk_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX; static uint16_t last_timer = 0; +inline int8_t times_inv_sqrt2(int8_t x) +{ + // 181/256 is pretty close to 1/sqrt(2) + // 0.70703125 0.707106781 + // 1 too small for x=99 and x=198 + // This ends up being a mult and discard lower 8 bits + return (x * 181) >> 8; +} static uint8_t move_unit(void) { @@ -111,10 +119,10 @@ void mousekey_task(void) if (mouse_report.y > 0) mouse_report.y = move_unit(); if (mouse_report.y < 0) mouse_report.y = move_unit() * -1; - /* diagonal move [1/sqrt(2) = 0.7] */ + /* diagonal move [1/sqrt(2)] */ if (mouse_report.x && mouse_report.y) { - mouse_report.x *= 0.7; - mouse_report.y *= 0.7; + mouse_report.x = times_inv_sqrt2(mouse_report.x); + mouse_report.y = times_inv_sqrt2(mouse_report.y); } if (mouse_report.v > 0) mouse_report.v = wheel_unit(); -- cgit v1.2.3 From 2aa5e4464010a9292b50571243d8ef6e749a5ca4 Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Sat, 12 Aug 2017 18:24:15 +0200 Subject: some major steps toward making the usb-usb converter work --- tmk_core/common/keycode.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tmk_core/common') diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 54e9c322c1..a1e0bc9a47 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -94,6 +94,9 @@ along with this program. If not, see . #define KC_JYEN KC_INT3 #define KC_HENK KC_INT4 #define KC_MHEN KC_INT5 +/* Korean specific */ +#define KC_HAEN KC_LANG1 +#define KC_HANJ KC_LANG2 /* Keypad */ #define KC_P1 KC_KP_1 #define KC_P2 KC_KP_2 @@ -113,6 +116,11 @@ along with this program. If not, see . #define KC_PPLS KC_KP_PLUS #define KC_PEQL KC_KP_EQUAL #define KC_PENT KC_KP_ENTER +/* Unix function key */ +#define KC_EXEC KC_EXECUTE +#define KC_SLCT KC_SELECT +#define KC_AGIN KC_AGAIN +#define KC_PSTE KC_PASTE /* Mousekey */ #define KC_MS_U KC_MS_UP #define KC_MS_D KC_MS_DOWN -- cgit v1.2.3