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"
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 ] ) )
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 ] ) )
## 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
### Parsing ###
+
## Containers
+
class Capabilities:
# Container for capabilities dictionary and convenience functions
def __init__( self ):
self.triggersIndexSorted = []
self.triggerList = []
self.maxScanCode = []
+ self.firstScanCode = []
# USBCode Assignment Cache
self.assignmentCache = []
# Shrink triggerList to actual max size
self.triggerList[ layer ] = self.triggerList[ layer ][ : self.maxScanCode[ layer ] + 1 ]
+ # Calculate first scan code for layer, useful for uC implementations trying to save RAM
+ firstScanCode = 0
+ for triggerList in range( 0, len( self.triggerList[ layer ] ) ):
+ firstScanCode = triggerList
+
+ # Break if triggerList has items
+ if len( self.triggerList[ layer ][ triggerList ] ) > 0:
+ break;
+ self.firstScanCode.append( firstScanCode )
+
# Determine overall maxScanCode
self.overallMaxScanCode = 0x00
for maxVal in self.maxScanCode:
if maxVal > self.overallMaxScanCode:
self.overallMaxScanCode = maxVal
+
+class Variables:
+ # Container for variables
+ # Stores three sets of variables, the overall combined set, per layer, and per file
+ def __init__( self ):
+ pass
+
+ def baseLayerFinished( self ):
+ pass
+
+ def setCurrentFile( self, name ):
+ # Store using filename and current layer
+ pass
+
+ def setCurrentLayer( self, layer ):
+ # Store using layer index
+ pass
+
+ def assignVariable( self, key, value ):
+ pass
+