Community modules (#24848)
This commit is contained in:
		
							parent
							
								
									63b095212b
								
							
						
					
					
						commit
						1efc82403b
					
				
					 37 changed files with 987 additions and 84 deletions
				
			
		
							
								
								
									
										33
									
								
								modules/qmk/hello_world/hello_world.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								modules/qmk/hello_world/hello_world.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
// Copyright 2025 Nick Brassel (@tzarc)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
#include "introspection.h"
 | 
			
		||||
 | 
			
		||||
ASSERT_COMMUNITY_MODULES_MIN_API_VERSION(1, 0, 0);
 | 
			
		||||
 | 
			
		||||
uint32_t delayed_hello_world(uint32_t trigger_time, void *cb_arg) {
 | 
			
		||||
    printf("Hello, world! I'm a QMK based keyboard! The keymap array size is %d bytes.\n", (int)hello_world_introspection().total_size);
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_hello_world(void) {
 | 
			
		||||
    keyboard_post_init_hello_world_kb();
 | 
			
		||||
    defer_exec(10000, delayed_hello_world, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_hello_world(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    if (!process_record_hello_world_kb(keycode, record)) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
        case COMMUNITY_MODULE_HELLO:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                SEND_STRING("Hello there.");
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								modules/qmk/hello_world/introspection.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								modules/qmk/hello_world/introspection.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
// Copyright 2025 Nick Brassel (@tzarc)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
 | 
			
		||||
hello_world_introspection_t hello_world_introspection(void) {
 | 
			
		||||
    hello_world_introspection_t introspection = {
 | 
			
		||||
        .total_size  = sizeof(keymaps),
 | 
			
		||||
        .layer_count = sizeof(keymaps) / sizeof(keymaps[0]),
 | 
			
		||||
    };
 | 
			
		||||
    return introspection;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								modules/qmk/hello_world/introspection.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								modules/qmk/hello_world/introspection.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
// Copyright 2025 Nick Brassel (@tzarc)
 | 
			
		||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
typedef struct hello_world_introspection_t {
 | 
			
		||||
    int16_t total_size;
 | 
			
		||||
    int16_t layer_count;
 | 
			
		||||
} hello_world_introspection_t;
 | 
			
		||||
 | 
			
		||||
hello_world_introspection_t hello_world_introspection(void);
 | 
			
		||||
							
								
								
									
										13
									
								
								modules/qmk/hello_world/qmk_module.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								modules/qmk/hello_world/qmk_module.json
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
{
 | 
			
		||||
    "module_name": "Hello World",
 | 
			
		||||
    "maintainer": "QMK Maintainers",
 | 
			
		||||
    "features": {
 | 
			
		||||
        "deferred_exec": true
 | 
			
		||||
    },
 | 
			
		||||
    "keycodes": [
 | 
			
		||||
        {
 | 
			
		||||
            "key": "COMMUNITY_MODULE_HELLO",
 | 
			
		||||
            "aliases": ["CM_HELO"]
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								modules/qmk/hello_world/rules.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								modules/qmk/hello_world/rules.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
# Just a simple rules.mk which tests that they work from a community module.
 | 
			
		||||
$(shell $(QMK_BIN) hello -n "from QMK's hello world community module")
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue