|
|
@@ -65,8 +65,28 @@ class Backend: |
|
|
|
return "usbKeyOut"; |
|
|
|
|
|
|
|
|
|
|
|
def layerInformation( self, name, date, author ): |
|
|
|
self.fill_dict['Information'] += "// Name: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "// Version: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "// Date: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "// Author: {0}\n".format( "TODO" ) |
|
|
|
|
|
|
|
|
|
|
|
# Processes content for fill tags and does any needed dataset calculations |
|
|
|
def process( self, capabilities, macros ): |
|
|
|
## Information ## |
|
|
|
# TODO |
|
|
|
self.fill_dict['Information'] = "// This file was generated by the kll compiler, DO NOT EDIT.\n" |
|
|
|
self.fill_dict['Information'] += "// Generation Date: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "// Compiler arguments: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "// KLL Backend: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "// KLL Git Rev: {0}\n".format( "TODO" ) |
|
|
|
self.fill_dict['Information'] += "//\n" |
|
|
|
self.fill_dict['Information'] += "// - Base Layer -\n" |
|
|
|
self.fill_dict['Information'] += "// - Default Layer -\n" |
|
|
|
self.fill_dict['Information'] += "// - Partial Layers -\n" |
|
|
|
|
|
|
|
|
|
|
|
## Capabilities ## |
|
|
|
self.fill_dict['CapabilitiesList'] = "const Capability CapabilitiesList[] = {\n" |
|
|
|
|
|
|
@@ -162,7 +182,7 @@ class Backend: |
|
|
|
self.fill_dict['DefaultLayerScanMap'] = "const nat_ptr_t *default_scanMap[] = {\n" |
|
|
|
|
|
|
|
# Iterate over triggerList and generate a C trigger array for the default map and default map array |
|
|
|
for triggerList in range( 0, len( macros.triggerList[ 0 ] ) ): |
|
|
|
for triggerList in range( macros.firstScanCode[ 0 ], len( macros.triggerList[ 0 ] ) ): |
|
|
|
# Generate ScanCode index and triggerList length |
|
|
|
self.fill_dict['DefaultLayerTriggerList'] += "Define_TL( default, 0x{0:02X} ) = {{ {1}".format( triggerList, len( macros.triggerList[ 0 ][ triggerList ] ) ) |
|
|
|
|
|
|
@@ -191,7 +211,7 @@ class Backend: |
|
|
|
self.fill_dict['PartialLayerTriggerLists'] += "// Partial Layer {0}\n".format( layer ) |
|
|
|
|
|
|
|
# Iterate over triggerList and generate a C trigger array for the layer |
|
|
|
for triggerList in range( 0, len( macros.triggerList[ layer ] ) ): |
|
|
|
for triggerList in range( macros.firstScanCode[ layer ], len( macros.triggerList[ layer ] ) ): |
|
|
|
# Generate ScanCode index and triggerList length |
|
|
|
self.fill_dict['PartialLayerTriggerLists'] += "Define_TL( layer{0}, 0x{1:02X} ) = {{ {2}".format( layer, triggerList, len( macros.triggerList[ layer ][ triggerList ] ) ) |
|
|
|
|
|
|
@@ -211,19 +231,26 @@ class Backend: |
|
|
|
|
|
|
|
|
|
|
|
## Layer Index List ## |
|
|
|
self.fill_dict['LayerIndexList'] = "Layer LayerIndex[] = {\n" |
|
|
|
self.fill_dict['LayerIndexList'] = "const Layer LayerIndex[] = {\n" |
|
|
|
|
|
|
|
# Iterate over each layer, adding it to the list |
|
|
|
for layer in range( 0, len( macros.triggerList ) ): |
|
|
|
# Lookup first scancode in map |
|
|
|
firstScanCode = macros.firstScanCode[ layer ] |
|
|
|
|
|
|
|
# Default map is a special case, always the first index |
|
|
|
# TODO Fix names |
|
|
|
if layer == 0: |
|
|
|
self.fill_dict['LayerIndexList'] += '\tLayer_IN( default_scanMap, "DefaultMap" ),\n' |
|
|
|
self.fill_dict['LayerIndexList'] += '\tLayer_IN( default_scanMap, "DefaultMap", 0x{0:02X} ),\n'.format( firstScanCode ) |
|
|
|
else: |
|
|
|
self.fill_dict['LayerIndexList'] += '\tLayer_IN( layer{0}_scanMap, "Layer {0}" ),\n'.format( layer ) |
|
|
|
self.fill_dict['LayerIndexList'] += '\tLayer_IN( layer{0}_scanMap, "Layer {0}", 0x{1:02X} ),\n'.format( layer, firstScanCode ) |
|
|
|
self.fill_dict['LayerIndexList'] += "};" |
|
|
|
|
|
|
|
|
|
|
|
## Layer State ## |
|
|
|
self.fill_dict['LayerState'] = "uint8_t LayerState[ LayerNum ];" |
|
|
|
|
|
|
|
|
|
|
|
# Generates the output keymap with fill tags filled |
|
|
|
def generate( self, filepath ): |
|
|
|
# Process each line of the template, outputting to the target path |