def parse_af_file(self, filename):
    with open(filename, 'r') as f:
        for line in f.readlines():
            match = re.match('#define PORT([ABCD])_PIN(\\d+)_GPIO', line)
            if match:
                name = (('P' + match.group(1)) + match.group(2))
                for pin in self.pins:
                    if (pin.name == name):
                        break
                else:
                    preg = ('PIN_BIT_BAND(%s, %2s)' % (('GPIO' + match.group(1)), match.group(2)))
                    pin = Pin(name, ('GPIO' + match.group(1)), ('PIN' + match.group(2)), preg, ('GPIO%s_IRQn' % match.group(1)))
                    self.pins.append(pin)
def parse_af_file(self, filename):
    with open(filename, 'r') as f:
        for line in f.readlines():
            match = re.match('#define PORT([ABCD])_PIN(\\d+)_GPIO', line)
            if match:
                name = (('P' + match.group(1)) + match.group(2))
                for pin in self.pins:
                    if (pin.name == name):
                        break
                else:
                    preg = ('PIN_BIT_BAND(%s, %2s)' % (('GPIO' + match.group(1)), match.group(2)))
                    pin = Pin(name, ('GPIO' + match.group(1)), ('PIN' + match.group(2)), preg, ('GPIO%s_IRQn' % match.group(1)))
                    self.pins.append(pin)