Adding support for pixelmap output and backporting features to 0.3d
- Enables support for running both kll 0.3d and 0.5c at the same time - Adds output support for generatedPixelmap.c - Adds a --version to 0.3d
This commit is contained in:
parent
44addcf031
commit
a008e03b22
@ -20,6 +20,7 @@ KLL Data Organization
|
|||||||
|
|
||||||
### Imports ###
|
### Imports ###
|
||||||
|
|
||||||
|
import copy
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
@ -429,8 +430,8 @@ class MappingData( Data ):
|
|||||||
# 2)
|
# 2)
|
||||||
|
|
||||||
#TODO
|
#TODO
|
||||||
print("YAY")
|
#print("YAY")
|
||||||
print( scan_code_lookup )
|
#print( scan_code_lookup )
|
||||||
|
|
||||||
|
|
||||||
class AnimationData( Data ):
|
class AnimationData( Data ):
|
||||||
|
@ -64,8 +64,10 @@ class Kiibohd( Emitter, TextEmitter ):
|
|||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
self.map_template = "templates/kiibohdKeymap.h"
|
self.map_template = "templates/kiibohdKeymap.h"
|
||||||
|
self.pixel_template = "templates/kiibohdPixelmap.c"
|
||||||
self.def_template = "templates/kiibohdDefs.h"
|
self.def_template = "templates/kiibohdDefs.h"
|
||||||
self.map_output = "generatedKeymap.h"
|
self.map_output = "generatedKeymap.h"
|
||||||
|
self.pixel_output = "generatedPixelmap.c"
|
||||||
self.def_output = "kll_defs.h"
|
self.def_output = "kll_defs.h"
|
||||||
|
|
||||||
self.fill_dict = {}
|
self.fill_dict = {}
|
||||||
@ -78,8 +80,10 @@ class Kiibohd( Emitter, TextEmitter ):
|
|||||||
'''
|
'''
|
||||||
self.def_template = args.def_template
|
self.def_template = args.def_template
|
||||||
self.map_template = args.map_template
|
self.map_template = args.map_template
|
||||||
|
self.pixel_template = args.pixel_template
|
||||||
self.def_output = args.def_output
|
self.def_output = args.def_output
|
||||||
self.map_output = args.map_output
|
self.map_output = args.map_output
|
||||||
|
self.pixel_output = args.pixel_output
|
||||||
|
|
||||||
def command_line_flags( self, parser ):
|
def command_line_flags( self, parser ):
|
||||||
'''
|
'''
|
||||||
@ -98,6 +102,10 @@ class Kiibohd( Emitter, TextEmitter ):
|
|||||||
help="Specify KLL map .h file template.\n"
|
help="Specify KLL map .h file template.\n"
|
||||||
"\033[1mDefault\033[0m: {0}\n".format( self.map_template )
|
"\033[1mDefault\033[0m: {0}\n".format( self.map_template )
|
||||||
)
|
)
|
||||||
|
group.add_argument( '--pixel-template', type=str, default=self.pixel_template,
|
||||||
|
help="Specify KLL pixel map .c file template.\n"
|
||||||
|
"\033[1mDefault\033[0m: {0}\n".format( self.pixel_template )
|
||||||
|
)
|
||||||
group.add_argument( '--def-output', type=str, default=self.def_output,
|
group.add_argument( '--def-output', type=str, default=self.def_output,
|
||||||
help="Specify KLL define .h file output.\n"
|
help="Specify KLL define .h file output.\n"
|
||||||
"\033[1mDefault\033[0m: {0}\n".format( self.def_output )
|
"\033[1mDefault\033[0m: {0}\n".format( self.def_output )
|
||||||
@ -106,6 +114,10 @@ class Kiibohd( Emitter, TextEmitter ):
|
|||||||
help="Specify KLL map .h file output.\n"
|
help="Specify KLL map .h file output.\n"
|
||||||
"\033[1mDefault\033[0m: {0}\n".format( self.map_output )
|
"\033[1mDefault\033[0m: {0}\n".format( self.map_output )
|
||||||
)
|
)
|
||||||
|
group.add_argument( '--pixel-output', type=str, default=self.pixel_output,
|
||||||
|
help="Specify KLL map .h file output.\n"
|
||||||
|
"\033[1mDefault\033[0m: {0}\n".format( self.pixel_output )
|
||||||
|
)
|
||||||
|
|
||||||
def output( self ):
|
def output( self ):
|
||||||
'''
|
'''
|
||||||
@ -118,8 +130,13 @@ class Kiibohd( Emitter, TextEmitter ):
|
|||||||
self.generate( self.def_output )
|
self.generate( self.def_output )
|
||||||
|
|
||||||
# Load keymap template and generate
|
# Load keymap template and generate
|
||||||
self.load_template( self.map_template )
|
# TODO
|
||||||
self.generate( self.map_output )
|
#self.load_template( self.map_template )
|
||||||
|
#self.generate( self.map_output )
|
||||||
|
|
||||||
|
# Load pixelmap template and generate
|
||||||
|
self.load_template( self.pixel_template )
|
||||||
|
self.generate( self.pixel_output )
|
||||||
|
|
||||||
def process( self ):
|
def process( self ):
|
||||||
'''
|
'''
|
||||||
|
20
kll.py
20
kll.py
@ -96,6 +96,12 @@ def processCommandLineArgs():
|
|||||||
"Default: <backend specific>" )
|
"Default: <backend specific>" )
|
||||||
pArgs.add_argument( '-h', '--help', action="help",
|
pArgs.add_argument( '-h', '--help', action="help",
|
||||||
help="This message." )
|
help="This message." )
|
||||||
|
pArgs.add_argument(
|
||||||
|
'-v', '--version',
|
||||||
|
action="version",
|
||||||
|
version="%(prog)s {0}".format( version ),
|
||||||
|
help="Show program's version number and exit"
|
||||||
|
)
|
||||||
|
|
||||||
# Process Arguments
|
# Process Arguments
|
||||||
args = pArgs.parse_args()
|
args = pArgs.parse_args()
|
||||||
@ -722,23 +728,29 @@ def gitRevision( kllPath ):
|
|||||||
|
|
||||||
# Get list of files that have changed since the commit
|
# Get list of files that have changed since the commit
|
||||||
changed = subprocess.check_output( ['git', 'diff-index', '--name-only', 'HEAD', '--'] ).decode().splitlines()
|
changed = subprocess.check_output( ['git', 'diff-index', '--name-only', 'HEAD', '--'] ).decode().splitlines()
|
||||||
|
|
||||||
|
# Get commit date
|
||||||
|
date = subprocess.check_output( ['git', 'show', '-s', '--format=%ci'] ).decode()[:-1]
|
||||||
except:
|
except:
|
||||||
revision = "<no git>"
|
revision = "<no git>"
|
||||||
changed = []
|
changed = []
|
||||||
|
date = "<no date>"
|
||||||
|
|
||||||
# Change back to the old working directory
|
# Change back to the old working directory
|
||||||
os.chdir( origPath )
|
os.chdir( origPath )
|
||||||
|
|
||||||
return revision, changed
|
return revision, changed, date
|
||||||
|
|
||||||
|
|
||||||
### Main Entry Point ###
|
### Main Entry Point ###
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
(baseFiles, defaultFiles, partialFileSets, backend_name, templates, outputs) = processCommandLineArgs()
|
|
||||||
|
|
||||||
# Look up git information on the compiler
|
# Look up git information on the compiler
|
||||||
gitRev, gitChanges = gitRevision( os.path.dirname( os.path.realpath( __file__ ) ) )
|
gitRev, gitChanges, gitDate = gitRevision( os.path.dirname( os.path.realpath( __file__ ) ) )
|
||||||
|
global version
|
||||||
|
version = "BACKPORT 0.3d.{0} - {1}".format( gitRev, gitDate )
|
||||||
|
|
||||||
|
(baseFiles, defaultFiles, partialFileSets, backend_name, templates, outputs) = processCommandLineArgs()
|
||||||
|
|
||||||
# Load backend module
|
# Load backend module
|
||||||
global backend
|
global backend
|
||||||
|
26
templates/kiibohdPixelmap.c
Normal file
26
templates/kiibohdPixelmap.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/* Copyright (C) 2016 by Jacob Alexander
|
||||||
|
*
|
||||||
|
* This file is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this file. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
<|Information|>
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// ----- Includes -----
|
||||||
|
|
||||||
|
// KLL Include
|
||||||
|
// TODO
|
||||||
|
|
Reference in New Issue
Block a user