Browse Source

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
dev
Jacob Alexander 7 years ago
parent
commit
a008e03b22
4 changed files with 68 additions and 12 deletions
  1. 3
    2
      common/organization.py
  2. 23
    6
      emitters/kiibohd/kiibohd.py
  3. 16
    4
      kll.py
  4. 26
    0
      templates/kiibohdPixelmap.c

+ 3
- 2
common/organization.py View File

@@ -20,6 +20,7 @@ KLL Data Organization

### Imports ###

import copy
import re


@@ -429,8 +430,8 @@ class MappingData( Data ):
# 2)

#TODO
print("YAY")
print( scan_code_lookup )
#print("YAY")
#print( scan_code_lookup )


class AnimationData( Data ):

+ 23
- 6
emitters/kiibohd/kiibohd.py View File

@@ -63,10 +63,12 @@ class Kiibohd( Emitter, TextEmitter ):
TextEmitter.__init__( self )

# Defaults
self.map_template = "templates/kiibohdKeymap.h"
self.def_template = "templates/kiibohdDefs.h"
self.map_output = "generatedKeymap.h"
self.def_output = "kll_defs.h"
self.map_template = "templates/kiibohdKeymap.h"
self.pixel_template = "templates/kiibohdPixelmap.c"
self.def_template = "templates/kiibohdDefs.h"
self.map_output = "generatedKeymap.h"
self.pixel_output = "generatedPixelmap.c"
self.def_output = "kll_defs.h"

self.fill_dict = {}

@@ -78,8 +80,10 @@ class Kiibohd( Emitter, TextEmitter ):
'''
self.def_template = args.def_template
self.map_template = args.map_template
self.pixel_template = args.pixel_template
self.def_output = args.def_output
self.map_output = args.map_output
self.pixel_output = args.pixel_output

def command_line_flags( self, parser ):
'''
@@ -98,6 +102,10 @@ class Kiibohd( Emitter, TextEmitter ):
help="Specify KLL map .h file template.\n"
"\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,
help="Specify KLL define .h file output.\n"
"\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"
"\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 ):
'''
@@ -118,8 +130,13 @@ class Kiibohd( Emitter, TextEmitter ):
self.generate( self.def_output )

# Load keymap template and generate
self.load_template( self.map_template )
self.generate( self.map_output )
# TODO
#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 ):
'''

+ 16
- 4
kll.py View File

@@ -96,6 +96,12 @@ def processCommandLineArgs():
"Default: <backend specific>" )
pArgs.add_argument( '-h', '--help', action="help",
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
args = pArgs.parse_args()
@@ -722,23 +728,29 @@ def gitRevision( kllPath ):

# Get list of files that have changed since the commit
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:
revision = "<no git>"
changed = []
date = "<no date>"

# Change back to the old working directory
os.chdir( origPath )

return revision, changed
return revision, changed, date


### Main Entry Point ###

if __name__ == '__main__':
(baseFiles, defaultFiles, partialFileSets, backend_name, templates, outputs) = processCommandLineArgs()

# 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
global backend

+ 26
- 0
templates/kiibohdPixelmap.c View 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