def getGpio(self, card, channel): for gpio in card['gpios']: if(gpio['name'] == channel): return gpio raise GPIO.InvalidChannelException("Gpio %s does not exists on card %s" % (channel, card['name']))
def checkDigitalChannelExported(self, channel): if not channel in self.export: raise GPIO.InvalidChannelException("Channel %d is not allowed" % channel)
def findCard(self, cardname): for card in self.cards: if card['name'] == cardname: return card #TODO Create a new exception for this case raise GPIO.InvalidChannelException("Card %s does not exists" % cardname)