summaryrefslogtreecommitdiff
path: root/app/include/zmk
diff options
context:
space:
mode:
Diffstat (limited to 'app/include/zmk')
-rw-r--r--app/include/zmk/behavior.h8
-rw-r--r--app/include/zmk/endpoints.h3
-rw-r--r--app/include/zmk/events.h15
-rw-r--r--app/include/zmk/hid.h57
-rw-r--r--app/include/zmk/keymap.h28
-rw-r--r--app/include/zmk/matrix.h2
-rw-r--r--app/include/zmk/matrix_transform.h3
7 files changed, 49 insertions, 67 deletions
diff --git a/app/include/zmk/behavior.h b/app/include/zmk/behavior.h
new file mode 100644
index 0000000..63edcc9
--- /dev/null
+++ b/app/include/zmk/behavior.h
@@ -0,0 +1,8 @@
+
+#pragma once
+
+struct zmk_behavior_binding {
+ char *behavior_dev;
+ u32_t param1;
+ u32_t param2;
+}; \ No newline at end of file
diff --git a/app/include/zmk/endpoints.h b/app/include/zmk/endpoints.h
index 255ca54..624bb4e 100644
--- a/app/include/zmk/endpoints.h
+++ b/app/include/zmk/endpoints.h
@@ -4,5 +4,4 @@
#include <zmk/hid.h>
int zmk_endpoints_init();
-int zmk_endpoints_send_report(enum zmk_hid_report_changes changes);
-int zmk_endpoints_send_key_event(struct zmk_key_event key_event);
+int zmk_endpoints_send_report(u8_t usage_report);
diff --git a/app/include/zmk/events.h b/app/include/zmk/events.h
new file mode 100644
index 0000000..5be2beb
--- /dev/null
+++ b/app/include/zmk/events.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <zmk/keys.h>
+
+int zmk_events_position_pressed(u32_t position);
+int zmk_events_position_released(u32_t position);
+int zmk_events_keycode_pressed(u8_t usage_page, u32_t keycode);
+int zmk_events_keycode_released(u8_t usage_page, u32_t keycode);
+int zmk_events_modifiers_pressed(zmk_mod_flags modifiers);
+int zmk_events_modifiers_released(zmk_mod_flags modifiers);
+int zmk_events_consumer_key_pressed(u32_t usage);
+int zmk_events_consumer_key_released(u32_t usage);
+
+// TODO: Encoders?
+// TODO: Sensors? \ No newline at end of file
diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h
index 7e3560d..138606a 100644
--- a/app/include/zmk/hid.h
+++ b/app/include/zmk/hid.h
@@ -9,7 +9,7 @@
#define COLLECTION_REPORT 0x03
-#define ZMK_HID_MAX_KEYCODE KC_APP
+#define ZMK_HID_MAX_KEYCODE GUI
static const u8_t zmk_hid_report_desc[] = {
/* USAGE_PAGE (Generic Desktop) */
@@ -108,40 +108,21 @@ static const u8_t zmk_hid_report_desc[] = {
0x00,
/* LOGICAL_MAXIMUM (1) */
HID_GI_LOGICAL_MAX(1),
- 0x01,
- /* USAGE (Scan Next Track) */
- HID_LI_USAGE,
- 0xB5,
- /* USAGE (Scan Previous Track) */
- HID_LI_USAGE,
- 0xB6,
- /* USAGE (Stop) */
- HID_LI_USAGE,
- 0xB7,
- /* USAGE (Eject) */
- HID_LI_USAGE,
- 0xB8,
- /* USAGE (Media Play/Pause) */
- HID_LI_USAGE,
- 0xCD,
- /* USAGE (Mute) */
- HID_LI_USAGE,
- 0xE2,
- /* USAGE (Volume Increment) */
- HID_LI_USAGE,
- 0xE9,
- /* USAGE (Volume Decrement) */
- HID_LI_USAGE,
- 0xEA,
+ 0xFF,
+ HID_LI_USAGE_MIN(1),
+ 0x00,
+ /* USAGE_MAXIMUM (Keyboard Application) */
+ HID_LI_USAGE_MAX(1),
+ 0xFF,
/* INPUT (Data,Ary,Abs) */
- /* REPORT_SIZE (1) */
+ /* REPORT_SIZE (8) */
HID_GI_REPORT_SIZE,
- 0x01,
+ 0x08,
/* REPORT_COUNT (8) */
HID_GI_REPORT_COUNT,
- 0x08,
+ 0x06,
HID_MI_INPUT,
- 0x02,
+ 0x00,
/* END COLLECTION */
HID_MI_COLLECTION_END,
};
@@ -167,7 +148,7 @@ struct zmk_hid_keypad_report
struct zmk_hid_consumer_report_body
{
- u8_t keys;
+ u8_t keys[6];
} __packed;
struct zmk_hid_consumer_report
@@ -176,19 +157,15 @@ struct zmk_hid_consumer_report
struct zmk_hid_consumer_report_body body;
} __packed;
-enum zmk_hid_report_changes
-{
- None = 0x00,
- Keypad = (0x01 << 0x00),
- Consumer = (0x01 << 0x01)
-};
-
int zmk_hid_register_mod(zmk_mod modifier);
int zmk_hid_unregister_mod(zmk_mod modifier);
int zmk_hid_register_mods(zmk_mod_flags modifiers);
int zmk_hid_unregister_mods(zmk_mod_flags modifiers);
-enum zmk_hid_report_changes zmk_hid_press_key(zmk_key key);
-enum zmk_hid_report_changes zmk_hid_release_key(zmk_key key);
+int zmk_hid_keypad_press(zmk_key key);
+int zmk_hid_keypad_release(zmk_key key);
+
+int zmk_hid_consumer_press(zmk_key key);
+int zmk_hid_consumer_release(zmk_key key);
struct zmk_hid_keypad_report *zmk_hid_get_keypad_report();
struct zmk_hid_consumer_report *zmk_hid_get_consumer_report();
diff --git a/app/include/zmk/keymap.h b/app/include/zmk/keymap.h
index 285b071..4a6bb37 100644
--- a/app/include/zmk/keymap.h
+++ b/app/include/zmk/keymap.h
@@ -1,28 +1,6 @@
#pragma once
-#include <devicetree.h>
-#include <usb/usb_device.h>
-#include <usb/class/usb_hid.h>
-#include <dt-bindings/zmk/keys.h>
+int zmk_keymap_layer_activate(u8_t layer);
+int zmk_keymap_layer_deactivate(u8_t layer);
-#include <zmk/matrix.h>
-#include <zmk/keys.h>
-
-#define ZMK_KEYMAP_NODE DT_CHOSEN(zmk_keymap)
-#define ZMK_KEYMAP_LAYERS_LEN DT_PROP_LEN(ZMK_KEYMAP_NODE, layers)
-
-/* TODO: Need to actually be able to get a NODELABEL from a node id
-#define _ZMK_KEYMAP_GENERATE_LAYER_CONST(node_id) \
- DT_NODELABEL_FOR_NODE(node_id)_layer,
-
-enum zmk_keymap_layer
-{
- DT_FOREACH_CHILD(DT_INST(0, zmk_layers), _ZMK_KEYMAP_GENERATE_LAYER_CONST)
-};
-*/
-
-bool zmk_keymap_layer_activate(u8_t layer);
-bool zmk_keymap_layer_deactivate(u8_t layer);
-
-zmk_key
-zmk_keymap_keycode_from_position(u32_t row, u32_t column);
+int zmk_keymap_position_state_changed(u32_t position, bool pressed);
diff --git a/app/include/zmk/matrix.h b/app/include/zmk/matrix.h
index 5397cfb..9fe1a85 100644
--- a/app/include/zmk/matrix.h
+++ b/app/include/zmk/matrix.h
@@ -1,5 +1,7 @@
#pragma once
+#include <devicetree.h>
+
#define ZMK_MATRIX_NODE_ID DT_CHOSEN(zmk_kscan)
#if DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID,row_gpios)
diff --git a/app/include/zmk/matrix_transform.h b/app/include/zmk/matrix_transform.h
new file mode 100644
index 0000000..e9e969a
--- /dev/null
+++ b/app/include/zmk/matrix_transform.h
@@ -0,0 +1,3 @@
+#pragma once
+
+u32_t zmk_matrix_transform_row_column_to_position(u32_t row, u32_t column); \ No newline at end of file