def __init__(self, chip, channelCount, vref): SPI.__init__(self, toint(chip), 0, 8, 10000000) DAC.__init__(self, channelCount, 12, float(vref)) self.buffered = False self.gain = False self.shutdown = False self.values = [0 for i in range(channelCount)]
def __init__(self, chip, channel_count, resolution): SPI.__init__(self, int(chip), 0, 8, 10000000) DAC.__init__(self, channel_count, resolution, 2.048) self.buffered=False self.gain=False self.shutdown=True self.values = [0 for i in range(channel_count)]
def __init__(self, chip, channel_count, vref): """Initializes MCP492X device. Arguments: chip: The chip select channel_count: Number of channels on the device vref: The reference voltage """ SPI.__init__(self, int(chip), 0, 8, 10000000) DAC.__init__(self, channel_count, 12, float(vref)) self.buffered = False self.gain = False self.shutdown = False self.values = [0 for i in range(channel_count)]
def __init__(self, chip, vref, channel_count, resolution): """Initializes MCP3XXX device. Arguments: chip: The chip select vref: The reference voltage channel_count: Number of channels on the device resolution: Bits of resolution """ self.channel_count = channel_count self.resolution = resolution SPI.__init__(self, chip, 0, 8, 10000) ADC.__init__(self, self.channel_count, self.resolution, float(vref)) self.msb_mask = 2**(self.resolution - 8) - 1
def __init__(self, chip, slave, channelCount, name): global MCP23S_SLAVES index = toint(chip) << 7 | toint(slave) print(MCP23S_SLAVES[index]) if MCP23S_SLAVES[index] != None: raise Exception("SLAVE_ADDRESS_USED") SPI.__init__(self, toint(chip), 0, 8, 10000000) MCP23XXX.__init__(self, channelCount) self.slave = self.SLAVE iocon_value = 0x08 # Hardware Address Enable iocon_addr = self.getAddress(self.IOCON) self.writeRegister(iocon_addr, iocon_value) self.slave = toint(slave) self.name = name MCP23S_SLAVES[index] = self print(MCP23S_SLAVES[index])
def __init__(self, chip, slave, channel_count): """Initializes MCP23SXX device. Arguments: chip: The chip select slave: The slave address channel_count: Number of channels on the device """ global MCP23S_SLAVES index = int(chip) << 7 | int(slave) print(MCP23S_SLAVES[index]) if MCP23S_SLAVES[index] != None: raise Exception("SLAVE_ADDRESS_USED") SPI.__init__(self, int(chip), 0, 8, 10000000) MCP23XXX.__init__(self, channel_count) self.slave = self.SLAVE iocon_value = 0x08 # Hardware Address Enable iocon_addr = self.getAddress(self.IOCON) self.writeRegister(iocon_addr, iocon_value) self.slave = int(slave) MCP23S_SLAVES[index] = self print(MCP23S_SLAVES[index])
def __init__(self, chip, channelCount, resolution, vref, name): SPI.__init__(self, toint(chip), 0, 8, 10000) ADC.__init__(self, channelCount, resolution, float(vref)) self.name = name self.MSB_MASK = 2**(resolution-8) - 1