#!/usr/bin/env python import re import sys import argparse field_file = "nodes.ads" kind_file = "iirs.ads" node_file = "iirs.ads" template_file = "iirs.adb.in" meta_base_file = "nodes_meta" prefix_name = "Iir_Kind_" prefix_range_name = "Iir_Kinds_" type_name = "Iir_Kind" node_type = "Iir" conversions = ['uc', 'pos', 'grp'] class FuncDesc: def __init__(self, name, fields, conv, acc, pname, ptype, rname, rtype): self.name = name self.fields = fields # List of physical fields used self.conv = conv self.acc = acc # access: Chain, Chain_Next, Ref, Of_Ref, Maybe_Ref, # Forward_Ref, Maybe_Forward_Ref self.pname = pname # Parameter mame self.ptype = ptype # Parameter type self.rname = rname # value name (for procedure) self.rtype = rtype # value type class NodeDesc: def __init__(self, name, format, fields, attrs): self.name = name self.format = format self.fields = fields # {field: FuncDesc} dict, defined for all fields self.attrs = attrs # A {attr: FuncDesc} dict self.order = [] # List of fields name, in order of appearance. class line: def __init__(self, string, no): self.l = string self.n = no class EndOfFile(Exception): def __init__(self, filename): self.filename = filename def __str__(self): return "end of file " + self.filename class linereader: def __init__(self, filename): self.filename = filename self.f = open(filename) self.lineno = 0 self.l = '' def get(self): self.l = self.f.readline() if not self.l: raise EndOfFile(self.filename) self.lineno = self.lineno + 1 return self.l class ParseError(Exception): def __init__(self, lr, msg): self.lr = lr self.msg = msg def __str__(self): return 'Error: ' + self.msg return 'Parse error at ' + self.lr.filname + ':' + self.lr.lineno + \ ': ' + self.msg # Return fields description. # This is a dictionary. The keys represent the possible format of a node. # The values are dictionnaries representing fields. Keys are fields name, and # values are fields type. def read_fields(file): fields = {} formats = [] lr = linereader(file) # Search for 'type Format_Type is' while lr.get() != ' type Format_Type is\n': pass # Skip '(' if lr.get() != ' (\n': raise 'no open parenthesis after Format_Type' # Read formats l = lr.get() pat_field_name = re.compile(' Format_(\w+),?\n') while l != ' );\n': m = pat_field_name.match(l) if m is None: print l raise 'bad literal within Format_Type' name = m.group(1) formats.append(name) fields[name] = {} l = lr.get() # Read fields l = lr.get() pat_fields = re.compile(' -- Fields of Format_(\w+):\n') pat_field_desc = re.compile(' -- (\w+) : (\w+).*\n') format_name = '' common_desc = {} # Read until common fields. while l != ' -- Common fields are:\n': l = lr.get() format_name = 'Common' nbr_formats = 0 while True: # 1) Read field description l = lr.get() desc = common_desc.copy() while True: m = pat_field_desc.match(l) if m is None: break desc[m.group(1)] = m.group(2) l = lr.get() # print 'For: ' + format_name + ': ' + m.group(1) # 2) Disp if format_name == 'Common': common_desc = desc else: fields[format_name] = desc # 3) Read next format if l == '\n': if nbr_formats == len(fields): break else: l = lr.get()
# Atmel AVR
QMK should run on any Atmel AVR processor with enough Flash. It has been tested on the following:
* ATmega32U4 ([PJRC Teensy 2.0](http://www.pjrc.com/teensy/))
* AT90USB1286 ([PJRC Teensy++ 2.0](http://www.pjrc.com/teensy/))
* AT90USB1287 ([Atmel USBKEY](http://www.atmel.com/tools/AT90USBKEY.aspx))
* ATmega168P with using [V-USB](http://www.obdev.at/products/vusb/index.html)
* ATmega328P with using [V-USB](http://www.obdev.at/products/vusb/index.html)
* ATmega32U2
* AT90USB1286, 646, 647 should work
* AT90USB162 testing...
NOTE: To enable full features of firmware you'll need 32KB flash size.
Please add any tested microcontrollers to this list.
# ARM
You can also use any ARM processor that [ChibiOS](http://www.chibios.org) supports. The following processors have been tested:
* [Kinetis MKL26Z64](http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x)
* [Kinetis MK20DX128](http://www.nxp.com/assets/documents/data/en/data-sheets/K20P64M50SF0.pdf)
* [Kinetis MK20DX128](http://www.nxp.com/assets/documents/data/en/data-sheets/K20P64M50SF0.pdf)
* [Kinetis MK20DX256](http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/k-series-performance-m4/k2x-usb/kinetis-k20-72-mhz-full-speed-usb-mixed-signal-integration-microcontrollers-mcus-based-on-arm-cortex-m4-core:K20_72)