def start(self): self.running = True self.start_button["command"] = self.stop self.start_button["text"] = "Stop" try: ul.d_config_bit(self.board_num, self.port.type, self.port.first_bit, DigitalIODirection.IN) except ULError as e: self.stop() self.show_ul_error(e) return self.update_value()
def is_bit_configurable(self): bit_configurable = False if self.in_mask & self.out_mask == 0: # AUXPORT type ports might be configurable, check if d_config_bit # completes without error if self.type == DigitalPortType.AUXPORT: try: ul.d_config_bit(self._board_num, self.type, self.first_bit, DigitalIODirection.OUT) ul.d_config_bit(self._board_num, self.type, self.first_bit, DigitalIODirection.IN) bit_configurable = True except ULError: bit_configurable = False return bit_configurable
def _get_is_bit_configurable(self, port_type, first_bit, in_mask, out_mask): if in_mask & out_mask > 0: return False # AUXPORT type ports might be configurable, check if d_config_bit # completes without error if port_type == DigitalPortType.AUXPORT: try: ul.d_config_bit(self._board_num, port_type, first_bit, DigitalIODirection.OUT) ul.d_config_bit(self._board_num, port_type, first_bit, DigitalIODirection.IN) except ULError: return False return True return False