From 296fc5946cb1bb2a309f69cbe0819ea1e4d38fcc Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Tue, 18 Aug 2015 01:09:52 -0700 Subject: [PATCH] Adding convenience capability function declarations. - This makes it easier to define capabilties in any C file --- backends/kiibohd.py | 2 ++ templates/kiibohdKeymap.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/backends/kiibohd.py b/backends/kiibohd.py index ae7d97f..4eb427f 100644 --- a/backends/kiibohd.py +++ b/backends/kiibohd.py @@ -129,6 +129,7 @@ class Backend( BackendBase ): ## Capabilities ## + self.fill_dict['CapabilitiesFuncDecl'] = "" self.fill_dict['CapabilitiesList'] = "const Capability CapabilitiesList[] = {\n" # Keys are pre-sorted @@ -136,6 +137,7 @@ class Backend( BackendBase ): funcName = capabilities.funcName( key ) argByteWidth = capabilities.totalArgBytes( key ) self.fill_dict['CapabilitiesList'] += "\t{{ {0}, {1} }},\n".format( funcName, argByteWidth ) + self.fill_dict['CapabilitiesFuncDecl'] += "void {0}( uint8_t state, uint8_t stateType, uint8_t *args );\n".format( funcName ) self.fill_dict['CapabilitiesList'] += "};" diff --git a/templates/kiibohdKeymap.h b/templates/kiibohdKeymap.h index 2a8c6d6..bb78ede 100644 --- a/templates/kiibohdKeymap.h +++ b/templates/kiibohdKeymap.h @@ -28,6 +28,10 @@ // ----- Capabilities ----- +// Capability function declarations +<|CapabilitiesFuncDecl|> + + // Indexed Capabilities Table <|CapabilitiesList|>