aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate/community_modules.py
diff options
context:
space:
mode:
authorDrashna Jaelre <[email protected]>2025-05-04 17:21:47 -0700
committerGitHub <[email protected]>2025-05-05 10:21:47 +1000
commit12caf0be4eab171ffeb041cc153f9addb68f404e (patch)
tree0b89fa2aa4c5ce4a525d1385a10489844e413ee9 /lib/python/qmk/cli/generate/community_modules.py
parentbb9dd05c6ae0a53ced5591c70a898feef037b31c (diff)
downloadqmk_firmware-12caf0be4eab171ffeb041cc153f9addb68f404e.tar.gz
qmk_firmware-12caf0be4eab171ffeb041cc153f9addb68f404e.zip
Add additional hooks for Community modules (#25050)
Diffstat (limited to 'lib/python/qmk/cli/generate/community_modules.py')
-rw-r--r--lib/python/qmk/cli/generate/community_modules.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/generate/community_modules.py b/lib/python/qmk/cli/generate/community_modules.py
index e12daccf1c..61e24077d3 100644
--- a/lib/python/qmk/cli/generate/community_modules.py
+++ b/lib/python/qmk/cli/generate/community_modules.py
@@ -76,6 +76,8 @@ def _render_api_implementations(api, module):
lines.append(f'__attribute__((weak)) {api.ret_type} {api.name}_{module_name}_user({api.args}) {{')
if api.ret_type == 'bool':
lines.append(' return true;')
+ elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
+ lines.append(f' return {api.call_params};')
else:
pass
lines.append('}')
@@ -86,6 +88,8 @@ def _render_api_implementations(api, module):
if api.ret_type == 'bool':
lines.append(f' if(!{api.name}_{module_name}_user({api.call_params})) {{ return false; }}')
lines.append(' return true;')
+ elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
+ lines.append(f' return {api.name}_{module_name}_user({api.call_params});')
else:
lines.append(f' {api.name}_{module_name}_user({api.call_params});')
lines.append('}')
@@ -96,6 +100,8 @@ def _render_api_implementations(api, module):
if api.ret_type == 'bool':
lines.append(f' if(!{api.name}_{module_name}_kb({api.call_params})) {{ return false; }}')
lines.append(' return true;')
+ elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
+ lines.append(f' return {api.name}_{module_name}_kb({api.call_params});')
else:
lines.append(f' {api.name}_{module_name}_kb({api.call_params});')
lines.append('}')
@@ -113,10 +119,14 @@ def _render_core_implementation(api, modules):
module_name = Path(module).name
if api.ret_type == 'bool':
lines.append(f' && {api.name}_{module_name}({api.call_params})')
+ elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
+ lines.append(f' {api.call_params} = {api.name}_{module_name}({api.call_params});')
else:
lines.append(f' {api.name}_{module_name}({api.call_params});')
if api.ret_type == 'bool':
lines.append(' ;')
+ elif api.ret_type in ['layer_state_t', 'report_mouse_t']:
+ lines.append(f' return {api.call_params};')
lines.append('}')
return lines