Pete Johanson
5 years ago
8 changed files with 189 additions and 47 deletions
@ -1,5 +1,72 @@ |
|||||||
|
|
||||||
#define KC_A 4 |
#pragma once |
||||||
#define KC_B 5 |
|
||||||
#define KC_C 6 |
#define KC_A 0x04 |
||||||
#define KC_D 7 |
#define KC_B 0x05 |
||||||
|
#define KC_C 0x06 |
||||||
|
#define KC_D 0x07 |
||||||
|
#define KC_E 0x08 |
||||||
|
#define KC_F 0x09 |
||||||
|
#define KC_G 0x0A |
||||||
|
#define KC_H 0x0B |
||||||
|
#define KC_I 0x0C |
||||||
|
#define KC_J 0x0D |
||||||
|
#define KC_K 0x0E |
||||||
|
#define KC_L 0x0F |
||||||
|
#define KC_M 0x10 |
||||||
|
#define KC_N 0x11 |
||||||
|
#define KC_O 0x12 |
||||||
|
#define KC_P 0x13 |
||||||
|
#define KC_Q 0x14 |
||||||
|
#define KC_R 0x15 |
||||||
|
#define KC_S 0x16 |
||||||
|
#define KC_T 0x17 |
||||||
|
#define KC_U 0x18 |
||||||
|
#define KC_V 0x19 |
||||||
|
#define KC_W 0x1A |
||||||
|
#define KC_X 0x1B |
||||||
|
#define KC_Y 0x1C |
||||||
|
#define KC_Z 0x1D |
||||||
|
#define KC_1 0x1E |
||||||
|
#define KC_2 0x1F |
||||||
|
#define KC_3 0x20 |
||||||
|
#define KC_4 0x21 |
||||||
|
#define KC_5 0x22 |
||||||
|
#define KC_6 0x23 |
||||||
|
#define KC_7 0x24 |
||||||
|
#define KC_8 0x25 |
||||||
|
#define KC_9 0x26 |
||||||
|
#define KC_0 0x27 |
||||||
|
#define KC_RET 0x28 |
||||||
|
#define KC_ESC 0x29 |
||||||
|
#define KC_DEL 0x2A |
||||||
|
#define KC_TAB 0x2B |
||||||
|
#define KC_SPC 0x2C |
||||||
|
#define KC_MIN 0x2D |
||||||
|
#define KC_EQL 0x2E |
||||||
|
#define KC_LBKT 0x2F |
||||||
|
#define KC_RBKT 0x30 |
||||||
|
#define KC_FSLH 0x31 |
||||||
|
|
||||||
|
#define KC_SCLN 0x33 |
||||||
|
#define KC_QUOT 0x34 |
||||||
|
#define KC_GRAV 0x35 |
||||||
|
#define KC_CMMA 0x36 |
||||||
|
#define KC_DOT 0x37 |
||||||
|
#define KC_BSLH 0x38 |
||||||
|
#define KC_CLCK 0x39 |
||||||
|
#define KC_F1 0x3A |
||||||
|
#define KC_F2 0x3B |
||||||
|
|
||||||
|
#define KC_APP 0x65 |
||||||
|
|
||||||
|
#define MD_SHFT 0x01 |
||||||
|
#define KC_ALT 0x02 |
||||||
|
#define KC_CTRL 0x03 |
||||||
|
|
||||||
|
#define ZC_RAIS 0xF0 |
||||||
|
#define ZC_LOWR 0xF1 |
||||||
|
#define ZC_TRNS 0xF2 |
||||||
|
#define ZC_NOOP 0xF3 |
||||||
|
|
||||||
|
#define ZC_CSTM(n) (0xFF + n) |
@ -0,0 +1,25 @@ |
|||||||
|
|
||||||
|
#include "handlers.h" |
||||||
|
|
||||||
|
#include "usb_hid.h" |
||||||
|
|
||||||
|
__attribute__((weak)) bool zmk_handle_key_user(struct zmk_key_event key_event) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
}; |
||||||
|
|
||||||
|
void zmk_handle_key(struct zmk_key_event key_event) |
||||||
|
{ |
||||||
|
if (!zmk_handle_key_user(key_event)) |
||||||
|
{ |
||||||
|
return; |
||||||
|
} |
||||||
|
if (key_event.pressed) |
||||||
|
{ |
||||||
|
zmk_usb_hid_press_key(key_event.key); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
zmk_usb_hid_release_key(key_event.key); |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,12 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
#include "keymap.h" |
||||||
|
#include <dt-bindings/zmk/keys.h> |
||||||
|
|
||||||
|
struct zmk_key_event |
||||||
|
{ |
||||||
|
zmk_key key; |
||||||
|
bool pressed; |
||||||
|
}; |
||||||
|
|
||||||
|
void zmk_handle_key(struct zmk_key_event key_event); |
@ -1,16 +1,19 @@ |
|||||||
#ifndef ZMK_KEYMAP_H |
#pragma once |
||||||
#define ZMK_KEYMAP_H |
|
||||||
|
|
||||||
#include <devicetree.h> |
#include <devicetree.h> |
||||||
#include <usb/usb_device.h> |
#include <usb/usb_device.h> |
||||||
#include <usb/class/usb_hid.h> |
#include <usb/class/usb_hid.h> |
||||||
|
#include "dt-bindings/zmk/keys.h" |
||||||
|
|
||||||
#include "zmk.h" |
#include "zmk.h" |
||||||
|
|
||||||
#define ZMK_KEYMAP_NODE DT_CHOSEN(zmk_keymap) |
#define ZMK_KEYMAP_NODE DT_CHOSEN(zmk_keymap) |
||||||
#define ZMK_KEYMAP_LAYERS_LEN DT_PROP_LEN(ZMK_KEYMAP_NODE, layers) |
#define ZMK_KEYMAP_LAYERS_LEN DT_PROP_LEN(ZMK_KEYMAP_NODE, layers) |
||||||
|
|
||||||
|
typedef u64_t zmk_key; |
||||||
|
|
||||||
enum hid_kbd_code zmk_keymap_keycode_from_position(u32_t row, u32_t column); |
bool zmk_keymap_layer_activate(u8_t layer); |
||||||
|
bool zmk_keymap_layer_deactivate(u8_t layer); |
||||||
|
|
||||||
#endif |
zmk_key |
||||||
|
zmk_keymap_keycode_from_position(u32_t row, u32_t column); |
||||||
|
Loading…
Reference in new issue