aboutsummaryrefslogtreecommitdiffstats
path: root/keyboard/planck/keymap_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/planck/keymap_common.c')
-rw-r--r--keyboard/planck/keymap_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/keyboard/planck/keymap_common.c b/keyboard/planck/keymap_common.c
index 886bfe23c..dd6639113 100644
--- a/keyboard/planck/keymap_common.c
+++ b/keyboard/planck/keymap_common.c
@@ -28,6 +28,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static action_t keycode_to_action(uint16_t keycode);
+uint16_t hextokeycode(int hex) {
+ if (hex == 0x0) {
+ return KC_0;
+ } else if (hex < 0xA) {
+ return KC_1 + (hex - 0x1);
+ } else {
+ return KC_A + (hex - 0xA);
+ }
+}
+
/* converts key to action */
action_t action_for_key(uint8_t layer, keypos_t key)
{
@@ -78,6 +88,11 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action_t action;
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
return action;
+ } else if (keycode >= 0x8000 && keycode < 0x9000) {
+ action_t action;
+ uint16_t unicode = keycode & ~(0x8000);
+ action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
+ return action;
}
switch (keycode) {