diff options
Diffstat (limited to 'modules/qmk')
| -rw-r--r-- | modules/qmk/hello_world/hello_world.c | 33 | ||||
| -rw-r--r-- | modules/qmk/hello_world/introspection.c | 10 | ||||
| -rw-r--r-- | modules/qmk/hello_world/introspection.h | 10 | ||||
| -rw-r--r-- | modules/qmk/hello_world/qmk_module.json | 13 | ||||
| -rw-r--r-- | modules/qmk/hello_world/rules.mk | 2 |
5 files changed, 68 insertions, 0 deletions
diff --git a/modules/qmk/hello_world/hello_world.c b/modules/qmk/hello_world/hello_world.c new file mode 100644 index 0000000000..d9dd366100 --- /dev/null +++ b/modules/qmk/hello_world/hello_world.c | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | // Copyright 2025 Nick Brassel (@tzarc) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | #include QMK_KEYBOARD_H | ||
| 4 | |||
| 5 | #include "introspection.h" | ||
| 6 | |||
| 7 | ASSERT_COMMUNITY_MODULES_MIN_API_VERSION(1, 0, 0); | ||
| 8 | |||
| 9 | uint32_t delayed_hello_world(uint32_t trigger_time, void *cb_arg) { | ||
| 10 | printf("Hello, world! I'm a QMK based keyboard! The keymap array size is %d bytes.\n", (int)hello_world_introspection().total_size); | ||
| 11 | return 0; | ||
| 12 | } | ||
| 13 | |||
| 14 | void keyboard_post_init_hello_world(void) { | ||
| 15 | keyboard_post_init_hello_world_kb(); | ||
| 16 | defer_exec(10000, delayed_hello_world, NULL); | ||
| 17 | } | ||
| 18 | |||
| 19 | bool process_record_hello_world(uint16_t keycode, keyrecord_t *record) { | ||
| 20 | if (!process_record_hello_world_kb(keycode, record)) { | ||
| 21 | return false; | ||
| 22 | } | ||
| 23 | |||
| 24 | switch (keycode) { | ||
| 25 | case COMMUNITY_MODULE_HELLO: | ||
| 26 | if (record->event.pressed) { | ||
| 27 | SEND_STRING("Hello there."); | ||
| 28 | break; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | return true; | ||
| 33 | } | ||
diff --git a/modules/qmk/hello_world/introspection.c b/modules/qmk/hello_world/introspection.c new file mode 100644 index 0000000000..2c32a074f5 --- /dev/null +++ b/modules/qmk/hello_world/introspection.c | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | // Copyright 2025 Nick Brassel (@tzarc) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | hello_world_introspection_t hello_world_introspection(void) { | ||
| 5 | hello_world_introspection_t introspection = { | ||
| 6 | .total_size = sizeof(keymaps), | ||
| 7 | .layer_count = sizeof(keymaps) / sizeof(keymaps[0]), | ||
| 8 | }; | ||
| 9 | return introspection; | ||
| 10 | } | ||
diff --git a/modules/qmk/hello_world/introspection.h b/modules/qmk/hello_world/introspection.h new file mode 100644 index 0000000000..fd3d7f24a0 --- /dev/null +++ b/modules/qmk/hello_world/introspection.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | // Copyright 2025 Nick Brassel (@tzarc) | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | #include QMK_KEYBOARD_H | ||
| 4 | |||
| 5 | typedef struct hello_world_introspection_t { | ||
| 6 | int16_t total_size; | ||
| 7 | int16_t layer_count; | ||
| 8 | } hello_world_introspection_t; | ||
| 9 | |||
| 10 | hello_world_introspection_t hello_world_introspection(void); | ||
diff --git a/modules/qmk/hello_world/qmk_module.json b/modules/qmk/hello_world/qmk_module.json new file mode 100644 index 0000000000..4f269cb4e9 --- /dev/null +++ b/modules/qmk/hello_world/qmk_module.json | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | { | ||
| 2 | "module_name": "Hello World", | ||
| 3 | "maintainer": "QMK Maintainers", | ||
| 4 | "features": { | ||
| 5 | "deferred_exec": true | ||
| 6 | }, | ||
| 7 | "keycodes": [ | ||
| 8 | { | ||
| 9 | "key": "COMMUNITY_MODULE_HELLO", | ||
| 10 | "aliases": ["CM_HELO"] | ||
| 11 | } | ||
| 12 | ] | ||
| 13 | } | ||
diff --git a/modules/qmk/hello_world/rules.mk b/modules/qmk/hello_world/rules.mk new file mode 100644 index 0000000000..91806fb1e3 --- /dev/null +++ b/modules/qmk/hello_world/rules.mk | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # Just a simple rules.mk which tests that they work from a community module. | ||
| 2 | $(shell $(QMK_BIN) hello -n "from QMK's hello world community module") | ||
