X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=kll.py;h=6d79b2e0295e75f077c0e57b401394a8c912bf80;hb=b4e4a13811f38b2ba6b36b0fd194c4dd399f61f8;hp=7844b8266a0d1b33e12b1aedef644e52197afa5b;hpb=bbf2c3ffaf4d579a5865c36c986720202d11f04a;p=kiibohd-kll.git
diff --git a/kll.py b/kll.py
index 7844b82..6d79b2e 100755
--- a/kll.py
+++ b/kll.py
@@ -107,7 +107,7 @@ def processCommandLineArgs():
defaultFiles = args.default
partialFileSets = args.partial
if defaultFiles is None:
- partialFileSets = []
+ defaultFiles = []
if partialFileSets is None:
partialFileSets = [[]]
@@ -321,6 +321,21 @@ def oneLayerFlatten( items ):
return mainList
+ # Capability arguments may need to be expanded (e.g. 1 16 bit argument needs to be 2 8 bit arguments for the state machine)
+def capArgExpander( items ):
+ newArgs = []
+ # For each defined argument in the capability definition
+ for arg in range( 0, len( capabilities_dict[ items[0] ][1] ) ):
+ argLen = capabilities_dict[ items[0] ][1][ arg ][1]
+ num = items[1][ arg ]
+ byteForm = num.to_bytes( argLen, byteorder='little' ) # XXX Yes, little endian from how the uC structs work
+
+ # For each sub-argument, split into byte-sized chunks
+ for byte in range( 0, argLen ):
+ newArgs.append( byteForm[ byte ] )
+
+ return tuple( [ items[0], tuple( newArgs ) ] )
+
# Expand ranges of values in the 3rd dimension of the list, to a list of 2nd lists
# i.e. [ sequence, [ combo, [ range ] ] ] --> [ [ sequence, [ combo ] ],