aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/common
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/action_layer.c2
-rw-r--r--tmk_core/common/eeconfig.h2
-rw-r--r--tmk_core/common/keycode.h8
-rw-r--r--tmk_core/common/mousekey.c14
4 files changed, 22 insertions, 4 deletions
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c
index 58d919a04..c6a166a82 100644
--- a/tmk_core/common/action_layer.c
+++ b/tmk_core/common/action_layer.c
@@ -188,10 +188,10 @@ action_t store_or_get_action(bool pressed, keypos_t key)
int8_t layer_switch_get_layer(keypos_t key)
{
+#ifndef NO_ACTION_LAYER
action_t action;
action.code = ACTION_TRANSPARENT;
-#ifndef NO_ACTION_LAYER
uint32_t layers = layer_state | default_layer_state;
/* check top layer first */
for (int8_t i = 31; i >= 0; i--) {
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h
index ce60ca866..1397a90c7 100644
--- a/tmk_core/common/eeconfig.h
+++ b/tmk_core/common/eeconfig.h
@@ -35,6 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 */
diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h
index 54e9c322c..a1e0bc9a4 100644
--- a/tmk_core/common/keycode.h
+++ b/tmk_core/common/keycode.h
@@ -94,6 +94,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 <http://www.gnu.org/licenses/>.
#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
diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c
index 23469476e..aa128f0e8 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();