Merge remote-tracking branch 'upstream/master'

f13
Jacob McIntosh 2015-07-14 15:55:20 -05:00
commit 49279dfd98
2 changed files with 75 additions and 70 deletions

View File

@ -142,80 +142,82 @@ def gen_static(current_date=None, git_commit_date=None, git_commit_id=None):
} }
def gen_derived(data): def gen_derived(data):
""" return {} # don't really need this info anymore
Generate derived information # """
Should be called last # Generate derived information
""" # Should be called last
return { # """
'miscellaneous': { # return {
'number-of-layers': # 'miscellaneous': {
int( data['layout-matrices']['_kb_layout']['length']/(6*14) ), # 'number-of-layers':
# because 6*14 is the number of bytes/layer for '_kb_layout' # int( data['layout-matrices']['_kb_layout']['length']/(6*14) ),
# (which is a uint8_t matrix) # # because 6*14 is the number of bytes/layer for '_kb_layout'
}, # # (which is a uint8_t matrix)
} # },
# }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def parse_mapfile(map_file_path): def parse_mapfile(map_file_path):
"""Parse the '.map' file""" return {} # don't really need this info anymore
# """Parse the '.map' file"""
def parse_keyboard_function(f, line): #
"""Parse keyboard-functions in the '.map' file""" # def parse_keyboard_function(f, line):
# """Parse keyboard-functions in the '.map' file"""
search = re.search(r'(0x\S+)\s+(0x\S+)', next(f)) #
position = int( search.group(1), 16 ) # search = re.search(r'(0x\S+)\s+(0x\S+)', next(f))
length = int( search.group(2), 16 ) # position = int( search.group(1), 16 )
# length = int( search.group(2), 16 )
search = re.search(r'0x\S+\s+(\S+)', next(f)) #
name = search.group(1) # search = re.search(r'0x\S+\s+(\S+)', next(f))
# name = search.group(1)
return { #
'keyboard-functions': { # return {
name: { # 'keyboard-functions': {
'position': position, # name: {
'length': length, # 'position': position,
}, # 'length': length,
}, # },
} # },
# }
def parse_layout_matrices(f, line): #
"""Parse layout matrix information in the '.map' file""" # def parse_layout_matrices(f, line):
# """Parse layout matrix information in the '.map' file"""
name = re.search(r'.progmem.data.(_kb_layout\S*)', line).group(1) #
# name = re.search(r'.progmem.data.(_kb_layout\S*)', line).group(1)
search = re.search(r'(0x\S+)\s+(0x\S+)', next(f)) #
position = int( search.group(1), 16 ) # search = re.search(r'(0x\S+)\s+(0x\S+)', next(f))
length = int( search.group(2), 16 ) # position = int( search.group(1), 16 )
# length = int( search.group(2), 16 )
return { #
'layout-matrices': { # return {
name: { # 'layout-matrices': {
'position': position, # name: {
'length': length, # 'position': position,
}, # 'length': length,
}, # },
} # },
# }
# --- parse_mapfile() --- #
# # --- parse_mapfile() ---
# normalize paths #
map_file_path = os.path.abspath(map_file_path) # # normalize paths
# check paths # map_file_path = os.path.abspath(map_file_path)
if not os.path.exists(map_file_path): # # check paths
raise ValueError("invalid 'map_file_path' given") # if not os.path.exists(map_file_path):
# raise ValueError("invalid 'map_file_path' given")
output = {} #
# output = {}
f = open(map_file_path) #
# f = open(map_file_path)
for line in f: #
if re.search(r'^\s*\.text\.kbfun_', line): # for line in f:
dict_merge(output, parse_keyboard_function(f, line)) # if re.search(r'^\s*\.text\.kbfun_', line):
elif re.search(r'^\s*\.progmem\.data.*layout', line): # dict_merge(output, parse_keyboard_function(f, line))
dict_merge(output, parse_layout_matrices(f, line)) # elif re.search(r'^\s*\.progmem\.data.*layout', line):
# dict_merge(output, parse_layout_matrices(f, line))
return output #
# return output
def find_keyboard_functions(source_code_path): def find_keyboard_functions(source_code_path):

View File

@ -34,6 +34,9 @@ changed since this document was last properly updated:
* Oleg Kostyuk (cub-uanic) [ported the TMK firmware] * Oleg Kostyuk (cub-uanic) [ported the TMK firmware]
(https://github.com/cub-uanic/tmk_keyboard) (https://github.com/cub-uanic/tmk_keyboard)
(written by "hasu") to the ErgoDox! (written by "hasu") to the ErgoDox!
* Jacob McIntosh ([nacitar](https://github.com/nacitar)) implemented 4 more
media keys (stop, mute, vol_up, and vol_down) in rev-1, fixed a media key
bug, and implemented workman-p.