def __init__(self, parent=None, address=0x60, **kwargs): Device.__init__(self, parent, address, **kwargs) #MPL3115A register address self.MPL3115_STATUS = 0x00 self.MPL3115_PRESSURE_DATA = 0x01 self.MPL3115_DR_STATUS = 0x06 self.MPL3115_DELTA_DATA = 0x07 self.MPL3115_WHO_AM_I = 0x0c self.MPL3115_FIFO_STATUS = 0x0d self.MPL3115_FIFO_DATA = 0x0e self.MPL3115_FIFO_SETUP = 0x0e self.MPL3115_TIME_DELAY = 0x10 self.MPL3115_SYS_MODE = 0x11 self.MPL3115_INT_SORCE = 0x12 self.MPL3115_PT_DATA_CFG = 0x13 self.MPL3115_BAR_IN_MSB = 0x14 self.MPL3115_P_ARLARM_MSB = 0x16 self.MPL3115_T_ARLARM = 0x18 self.MPL3115_P_ARLARM_WND_MSB = 0x19 self.MPL3115_T_ARLARM_WND = 0x1b self.MPL3115_P_MIN_DATA = 0x1c self.MPL3115_T_MIN_DATA = 0x1f self.MPL3115_P_MAX_DATA = 0x21 self.MPL3115_T_MAX_DATA = 0x24 self.MPL3115_CTRL_REG1 = 0x26 self.MPL3115_CTRL_REG2 = 0x27 self.MPL3115_CTRL_REG3 = 0x28 self.MPL3115_CTRL_REG4 = 0x29 self.MPL3115_CTRL_REG5 = 0x2a self.MPL3115_OFFSET_P = 0x2b self.MPL3115_OFFSET_T = 0x2c self.MPL3115_OFFSET_H = 0x2d
def __init__(self, parent = None, address = 0x60, **kwargs): Device.__init__(self, parent, address, **kwargs) #MPL3115A register address self.MPL3115_STATUS =0x00 self.MPL3115_PRESSURE_DATA =0x01 self.MPL3115_DR_STATUS =0x06 self.MPL3115_DELTA_DATA =0x07 self.MPL3115_WHO_AM_I =0x0c self.MPL3115_FIFO_STATUS =0x0d self.MPL3115_FIFO_DATA =0x0e self.MPL3115_FIFO_SETUP =0x0e self.MPL3115_TIME_DELAY =0x10 self.MPL3115_SYS_MODE =0x11 self.MPL3115_INT_SORCE =0x12 self.MPL3115_PT_DATA_CFG =0x13 self.MPL3115_BAR_IN_MSB =0x14 self.MPL3115_P_ARLARM_MSB =0x16 self.MPL3115_T_ARLARM =0x18 self.MPL3115_P_ARLARM_WND_MSB =0x19 self.MPL3115_T_ARLARM_WND =0x1b self.MPL3115_P_MIN_DATA =0x1c self.MPL3115_T_MIN_DATA =0x1f self.MPL3115_P_MAX_DATA =0x21 self.MPL3115_T_MAX_DATA =0x24 self.MPL3115_CTRL_REG1 =0x26 self.MPL3115_CTRL_REG2 =0x27 self.MPL3115_CTRL_REG3 =0x28 self.MPL3115_CTRL_REG4 =0x29 self.MPL3115_CTRL_REG5 =0x2a self.MPL3115_OFFSET_P =0x2b self.MPL3115_OFFSET_T =0x2c self.MPL3115_OFFSET_H =0x2d
def __init__(self, parent=None, address=0x01, fault_queue=1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.MODE1 = 0x00 self.MODE2 = 0x01 self.LEDOUT0 = 0x14 self.LEDOUT1 = 0x15 self.LEDOUT2 = 0x16 self.LEDOUT3 = 0x17 self.PWM00 = 0x02 self.PWM01 = 0x03 self.PWM02 = 0x04 self.PWM03 = 0x05 self.PWM04 = 0x06 self.PWM05 = 0x07 self.PWM06 = 0x08 self.PWM07 = 0x09 self.PWM08 = 0x0A self.PWM09 = 0x0B self.PWM10 = 0x0C self.PWM11 = 0x0D self.PWM12 = 0x0E self.PWM13 = 0x0F self.PWM14 = 0x10 self.PWM15 = 0x11 ## config parameters self.led00_config = (0xAA) self.led01_config = (0xAA) self.mode1_config = (0x00) self.mode2_config = (0x01)
def __init__(self, parent = None, address = 0x01, fault_queue = 1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.MODE1 = 0x00 self.MODE2 = 0x01 self.LEDOUT0 = 0x14 self.LEDOUT1 = 0x15 self.LEDOUT2 = 0x16 self.LEDOUT3 = 0x17 self.PWM00 = 0x02 self.PWM01 = 0x03 self.PWM02 = 0x04 self.PWM03 = 0x05 self.PWM04 = 0x06 self.PWM05 = 0x07 self.PWM06 = 0x08 self.PWM07 = 0x09 self.PWM08 = 0x0A self.PWM09 = 0x0B self.PWM10 = 0x0C self.PWM11 = 0x0D self.PWM12 = 0x0E self.PWM13 = 0x0F self.PWM14 = 0x10 self.PWM15 = 0x11 ## config parameters self.led00_config = (0xAA) self.led01_config = (0xAA) self.mode1_config = (0x00) self.mode2_config = (0x01)
def initialize(self): Device.initialize(self) for channel, bus in self.channels.iteritems(): self.setup(1 << channel) bus.initialize() self.setup(self.ALL_CHANNELS)
def __init__(self, parent=None, address=0x14, configuration=[0b10111000, 0b10011000], **kwargs): Device.__init__(self, parent, address, **kwargs) self.config = configuration
def __init__(self, parent = None, address = 0x29, **kwargs): Device.__init__(self, parent, address, **kwargs) self.TCS3771_ENABLE =0x00 self.TCS3771_ATIME =0x01 self.TCS3771_PTIME =0x02 self.TCS3771_WTIME =0x03 self.TCS3771_PDATA =0x1C self.TCS3771_PDATAH =0x1D
def __init__(self, parent=None, address=0x29, **kwargs): Device.__init__(self, parent, address, **kwargs) self.TCS3771_ENABLE = 0x00 self.TCS3771_ATIME = 0x01 self.TCS3771_PTIME = 0x02 self.TCS3771_WTIME = 0x03 self.TCS3771_PDATA = 0x1C self.TCS3771_PDATAH = 0x1D
def __init__(self, parent=None, address=0x27, fault_queue=1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.backlight = 0b00000000 ## config parameters self.LCD_RS = 0b00000001 self.LCD_RW = 0b00000010 self.LCD_EN = 0b00000100 self.LCD_BL = 0b00001000
def __init__(self, parent = None, address = 0x27, fault_queue = 1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.backlight = 0b00000000 ## config parameters self.LCD_RS = 0b00000001 self.LCD_RW = 0b00000010 self.LCD_EN = 0b00000100 self.LCD_BL = 0b00001000
def __init__(self, parent = None, address = 0x27, **kwargs): Device.__init__(self, parent, address, **kwargs) self.IO_INPUT0 = 0x00 self.IO_INPUT1 = 0x01 self.IO_OUTPUT0 = 0x02 self.IO_OUTPUT1 = 0x03 self.IO_POLARITY0 = 0x04 self.IO_POLARITY1 = 0x05 self.IO_CONFIGURATION0 = 0x06 self.IO_CONFIGURATION1 = 0x07
def __init__(self, parent=None, address=0x27, **kwargs): Device.__init__(self, parent, address, **kwargs) self.IO_INPUT0 = 0x00 self.IO_INPUT1 = 0x01 self.IO_OUTPUT0 = 0x02 self.IO_OUTPUT1 = 0x03 self.IO_POLARITY0 = 0x04 self.IO_POLARITY1 = 0x05 self.IO_CONFIGURATION0 = 0x06 self.IO_CONFIGURATION1 = 0x07
def __init__(self, parent=None, address=0x68, gain=1, sample_rate=240, **kwargs): Device.__init__(self, parent, address, **kwargs) self.rate = sample_rate self.gain = gain self.address = address
def __init__(self, parent = None, address=0x70, **kwargs): Device.__init__(self, parent, address, **kwargs) self.channels = {} for channel in range(8): self.channels[channel] = SimpleBus( self, None, channel = channel, ) self._status = None
def __init__(self, parent=None, **kwargs): Device.__init__(self, parent, address, **kwargs) #AD7730 register address self.AD7730_COMM_REG = 0b000 self.AD7730_STATUS_REG = 0b000 self.AD7730_DATA_REG = 0b001 self.AD7730_MODE_REG = 0b010 self.AD7730_FILTER_REG = 0b011 self.AD7730_DAC_REG = 0b100 self.AD7730_OFFSET_REG = 0b101 self.AD7730_GAIN_REG = 0b110 self.AD7730_TEST_REG = 0b111 # do not change state of this register
def __init__(self, parent = None, address = 0x21, **kwargs): Device.__init__(self, parent, address, **kwargs) self.STATUS_PORT0 = 0x00 self.STATUS_PORT1 = 0x01 self.OUTPUT_PORT0 = 0x02 self.OUTPUT_PORT1 = 0x03 self.POLARITY_PORT0 = 0x04 self.POLARITY_PORT1 = 0x05 self.CONTROL_PORT0 = 0x06 self.CONTROL_PORT1 = 0x07
def __init__(self, parent=None, address=0x21, **kwargs): Device.__init__(self, parent, address, **kwargs) self.STATUS_PORT0 = 0x00 self.STATUS_PORT1 = 0x01 self.OUTPUT_PORT0 = 0x02 self.OUTPUT_PORT1 = 0x03 self.POLARITY_PORT0 = 0x04 self.POLARITY_PORT1 = 0x05 self.CONTROL_PORT0 = 0x06 self.CONTROL_PORT1 = 0x07
def __init__(self, parent = None, address = 0x40, fault_queue = 1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.programming_control = 0x03 self.address_reg = 0x15 self.zero_position_MSB = 0x16 self.zero_position_LSB = 0x17 self.AGC_reg = 0xFA self.diagnostics_reg = 0xFB self.magnitude_MSB = 0xFC self.magnitude_LSB = 0xFD self.angle_MSB = 0xFE self.angle_LSB = 0xFF
def __init__(self, parent=None, address=0x68, sensitivity_corr=(8.75, 8.75, 8.75), datarate=0b00, bandwidth=0b00, FIFO=True, HPF=True, **kwargs): Device.__init__(self, parent, address, **kwargs) self.sensitivity = (sensitivity_corr[0] / 1000, sensitivity_corr[1] / 1000, sensitivity_corr[2] / 1000) self.data_rate = datarate self.band_width = bandwidth self.FIFO_EN = FIFO self.HPen = HPF self.A3G4250D_WHO_AM_I = 0x0F self.A3G4250D_CTRL_REG1 = 0x20 self.A3G4250D_CTRL_REG2 = 0x21 self.A3G4250D_CTRL_REG3 = 0x22 self.A3G4250D_CTRL_REG4 = 0x23 self.A3G4250D_CTRL_REG5 = 0x24 self.A3G4250D_REFERENCE = 0x25 self.A3G4250D_OUT_TEMP = 0x26 self.A3G4250D_STATUS_REG = 0x27 self.A3G4250D_OUT_X_L = 0x28 self.A3G4250D_OUT_X_H = 0x29 self.A3G4250D_OUT_Y_L = 0x2A self.A3G4250D_OUT_Y_H = 0x2B self.A3G4250D_OUT_Z_L = 0x2C self.A3G4250D_OUT_Z_H = 0x2D self.A3G4250D_FIFO_CTRL_REG = 0x2e self.A3G4250D_FIFO_SRC_REG = 0x2F self.A3G4250D_INT1_CFG = 0x30 self.A3G4250D_INT1_SRC = 0x31 self.A3G4250D_INT1_TSH_XH = 0x32 self.A3G4250D_INT1_TSH_XL = 0x33 self.A3G4250D_INT1_TSH_YH = 0x34 self.A3G4250D_INT1_TSH_YL = 0x35 self.A3G4250D_INT1_TSH_ZH = 0x36 self.A3G4250D_INT1_TSH_ZL = 0x37 self.A3G4250D_INT1_DURATION = 0x38 self.A3G4250D_FIFO_BYPASS_MODE = 0b000 self.A3G4250D_FIFO_MODE = 0b001 self.A3G4250D_FIFO_STREAM_MODE = 0b010
def __init__(self, parent=None, address=0x40, **kwargs): Device.__init__(self, parent, address, **kwargs) self.TRIGGER_MEASUREMENT = 0xF1 # command: trigger differential pressure measurement self.SOFT_RESET = 0xFE # command: soft reset self.READ_USER_REGISTER = 0xE5 # command: read advanced user register self.WRITE_USER_REGISTER = 0xE4 # command: write advanced user register self.RESOLUTION_9BIT = 0x00 self.RESOLUTION_10BIT = 0x01 self.RESOLUTION_11BIT = 0x02 self.RESOLUTION_12BIT = 0x03 self.RESOLUTION_13BIT = 0x04 self.RESOLUTION_14BIT = 0x05 self.RESOLUTION_15BIT = 0x06 self.RESOLUTION_16BIT = 0x07
def __init__(self, parent=None, address=0b1100011, **kwargs): Device.__init__(self, parent, address, **kwargs) 'The INPUT register reflects the state of the device pins. Writes to this register will be acknowledged but will have no effect.' self.PWM_INPUT = 0x00 'PSC0 is used to program the period of the PWM output.' self.PWM_PSC0 = 0x01 'The PWM0 register determines the duty cycle of BLINK0. The outputs are LOW (LED on) when the count is less than the value in PWM0 and HIGH (LED off) when it is greater. If PWM0 is programmed with 00h, then the PWM0 output is always HIGH (LED off).' self.PWM_PWM0 = 0x02 'PSC1 is used to program the period of the PWM output.' self.PWM_PSC1 = 0x03 'The PWM1 register determines the duty cycle of BLINK1. The outputs are LOW (LED on) when the count is less than the value in PWM1 and HIGH (LED off) when it is greater. If PWM1 is programmed with 00h, then the PWM1 output is always HIGH (LED off).' self.PWM_PWM1 = 0x04 'The LSn LED select registers determine the source of the LED data.' self.PWM_LS0 = 0x05 self.PWM_LS1 = 0x06
def __init__(self, parent = None, address = 0x40, **kwargs): Device.__init__(self, parent, address, **kwargs) self.TRIGGER_MEASUREMENT = 0xF1 # command: trigger differential pressure measurement self.SOFT_RESET = 0xFE # command: soft reset self.READ_USER_REGISTER = 0xE5 # command: read advanced user register self.WRITE_USER_REGISTER = 0xE4 # command: write advanced user register self.RESOLUTION_9BIT = 0x00 self.RESOLUTION_10BIT = 0x01 self.RESOLUTION_11BIT = 0x02 self.RESOLUTION_12BIT = 0x03 self.RESOLUTION_13BIT = 0x04 self.RESOLUTION_14BIT = 0x05 self.RESOLUTION_15BIT = 0x06 self.RESOLUTION_16BIT = 0x07
def __init__(self, parent = None, address = 0b1100011, **kwargs): Device.__init__(self, parent, address, **kwargs) 'The INPUT register reflects the state of the device pins. Writes to this register will be acknowledged but will have no effect.' self.PWM_INPUT = 0x00 'PSC0 is used to program the period of the PWM output.' self.PWM_PSC0 = 0x01 'The PWM0 register determines the duty cycle of BLINK0. The outputs are LOW (LED on) when the count is less than the value in PWM0 and HIGH (LED off) when it is greater. If PWM0 is programmed with 00h, then the PWM0 output is always HIGH (LED off).' self.PWM_PWM0 = 0x02 'PSC1 is used to program the period of the PWM output.' self.PWM_PSC1 = 0x03 'The PWM1 register determines the duty cycle of BLINK1. The outputs are LOW (LED on) when the count is less than the value in PWM1 and HIGH (LED off) when it is greater. If PWM1 is programmed with 00h, then the PWM1 output is always HIGH (LED off).' self.PWM_PWM1 = 0x04 'The LSn LED select registers determine the source of the LED data.' self.PWM_LS0 = 0x05 self.PWM_LS1 = 0x06
def __init__(self, parent = None, address = 0x27, **kwargs): Device.__init__(self, parent, address, **kwargs) 'The Input Port registers (registers 0 and 1) reflect the incoming logic levels of the pins, regardless of whether thepin is defined as an input or an output by the Configuration Register. It only acts on read operation. Writes to these registers have no effect. The default value, X, is determined by the externally applied logic level. Before a read operation, a write transmission is sent with the command byte to let the I 2 C device know that the Input Port registers will be accessed next.' self.INPUT_PORT0 = 0x00 self.INPUT_PORT1 = 0x01 'The Output Port registers (registers 2 and 3) show the outgoing logic levels of the pins defined as outputs by the Configuration register. Bit values in this register have no effect on pins defined as inputs. In turn, reads from this register reflect the value that is in the flip-flop controlling the output selection, not the actual pin value.' self.OUTPUT_PORT0 = 0x02 self.OUTPUT_PORT1 = 0x03 'The Polarity Inversion registers (registers 4 and 5) allow polarity inversion of pins defined as inputs by the Configuration register. If a bit in this register is set (written with 1), the corresponding pins polarity is inverted. If a bit in this register is cleared (written with a 0), the corresponding pins original polarity is retained.' self.POLARITY_PORT0 = 0x04 self.POLARITY_PORT1 = 0x05 'The Configuration registers (registers 6 and 7) configure the directions of the I/O pins. If a bit in this register is set to 1, the corresponding port pin is enabled as an input with a high-impedance output driver. If a bit in this register is cleared to 0, the corresponding port pin is enabled as an output.' self.CONTROL_PORT0 = 0x06 self.CONTROL_PORT1 = 0x07
def __init__(self, parent=None, address=0x27, **kwargs): Device.__init__(self, parent, address, **kwargs) 'The Input Port registers (registers 0 and 1) reflect the incoming logic levels of the pins, regardless of whether thepin is defined as an input or an output by the Configuration Register. It only acts on read operation. Writes to these registers have no effect. The default value, X, is determined by the externally applied logic level. Before a read operation, a write transmission is sent with the command byte to let the I 2 C device know that the Input Port registers will be accessed next.' self.INPUT_PORT0 = 0x00 self.INPUT_PORT1 = 0x01 'The Output Port registers (registers 2 and 3) show the outgoing logic levels of the pins defined as outputs by the Configuration register. Bit values in this register have no effect on pins defined as inputs. In turn, reads from this register reflect the value that is in the flip-flop controlling the output selection, not the actual pin value.' self.OUTPUT_PORT0 = 0x02 self.OUTPUT_PORT1 = 0x03 'The Polarity Inversion registers (registers 4 and 5) allow polarity inversion of pins defined as inputs by the Configuration register. If a bit in this register is set (written with 1), the corresponding pins polarity is inverted. If a bit in this register is cleared (written with a 0), the corresponding pins original polarity is retained.' self.POLARITY_PORT0 = 0x04 self.POLARITY_PORT1 = 0x05 'The Configuration registers (registers 6 and 7) configure the directions of the I/O pins. If a bit in this register is set to 1, the corresponding port pin is enabled as an input with a high-impedance output driver. If a bit in this register is cleared to 0, the corresponding port pin is enabled as an output.' self.CONTROL_PORT0 = 0x06 self.CONTROL_PORT1 = 0x07
def __init__(self, parent=None, address=0x50, **kwargs): Device.__init__(self, parent, address, **kwargs) """ I/O control for I/O_0 to I/O_7. I/O_0 is the LSB and I/O_7 is the MSB. Clearing the corresponding bit of the register pulls the selected I/O pin low; setting the bit places the pulldown transistor into a high-impedance state. When the pulldown is high impedance, the output floats if no pullup/down is connected to the pin""" self.CONTROL_PORT0 = 0xF2 self.CONTROL_PORT1 = 0xF3 'Pullup enable for I/O_8. I/O_8 is the LSB. Only the LSB is used. Set the LSB bit to enable the pullup on I/O_8; clear the LSB to disable the pullup' self.PULLUP_PORT0 = 0xF0 self.PULLUP_PORT1 = 0xF1 'I/O status for I/O_0 to I/O_7. I/O_0 is the LSB and I/O_7 is the MSB. Writing to this register has no effect. Read this register to determine the state of the I/O_0 to I/O_7 pins.' self.STATUS_PORT0 = 0xF8 self.STATUS_PORT1 = 0xF9
def __init__(self, parent = None, address = 0x40, **kwargs): Device.__init__(self, parent, address, **kwargs) self.SHT25_HEATER_ON = 0x04 self.SHT25_HEATER_OFF = 0x00 self.SHT25_OTP_reload_off = 0x02 self.SHT25_RH12_T14 = 0x00 self.SHT25_RH8_T12 = 0x01 self.SHT25_RH10_T13 = 0x80 self.SHT25_RH11_T11 = 0x81 #self.address = 0x40 # SHT25 has only one device address (factory set) self.TRIG_T_HOLD = 0b11100011 self.TRIG_RH_HOLD = 0b11100101 self.TRIG_T_noHOLD = 0b11110011 self.TRIG_RH_noHOLD = 0b11110101 self.WRITE_USR_REG = 0b11100110 self.READ_USR_REG = 0b11100111 self.SOFT_RESET = 0b11111110
def __init__(self, parent = None, address = 0x1E, gauss = 4.0, **kwargs): Device.__init__(self, parent, address, **kwargs) self._gauss = gauss (reg, self._scale) = self.SCALES[gauss] self.HMC5883L_CRA =0x00 self.HMC5883L_CRB =0x01 self.HMC5883L_MR =0x02 self.HMC5883L_DXRA =0x03 self.HMC5883L_DXRB =0x04 self.HMC5883L_DYRA =0x05 self.HMC5883L_DYRB =0x06 self.HMC5883L_DZRA =0x07 self.HMC5883L_DZRB =0x08 self.HMC5883L_SR =0x09 self.HMC5883L_IRA =0x0A self.HMC5883L_IRB =0x0B self.HMC5883L_IRC =0x0C
def __init__(self, parent = None, address = 0x50, **kwargs): Device.__init__(self, parent, address, **kwargs) """ I/O control for I/O_0 to I/O_7. I/O_0 is the LSB and I/O_7 is the MSB. Clearing the corresponding bit of the register pulls the selected I/O pin low; setting the bit places the pulldown transistor into a high-impedance state. When the pulldown is high impedance, the output floats if no pullup/down is connected to the pin""" self.CONTROL_PORT0 = 0xF2 self.CONTROL_PORT1 = 0xF3 'Pullup enable for I/O_8. I/O_8 is the LSB. Only the LSB is used. Set the LSB bit to enable the pullup on I/O_8; clear the LSB to disable the pullup' self.PULLUP_PORT0 = 0xF0 self.PULLUP_PORT1 = 0xF1 'I/O status for I/O_0 to I/O_7. I/O_0 is the LSB and I/O_7 is the MSB. Writing to this register has no effect. Read this register to determine the state of the I/O_0 to I/O_7 pins.' self.STATUS_PORT0 = 0xF8 self.STATUS_PORT1 = 0xF9
def __init__(self, parent=None, address=0x1E, gauss=4.0, **kwargs): Device.__init__(self, parent, address, **kwargs) self._gauss = gauss (reg, self._scale) = self.SCALES[gauss] self.HMC5883L_CRA = 0x00 self.HMC5883L_CRB = 0x01 self.HMC5883L_MR = 0x02 self.HMC5883L_DXRA = 0x03 self.HMC5883L_DXRB = 0x04 self.HMC5883L_DYRA = 0x05 self.HMC5883L_DYRB = 0x06 self.HMC5883L_DZRA = 0x07 self.HMC5883L_DZRB = 0x08 self.HMC5883L_SR = 0x09 self.HMC5883L_IRA = 0x0A self.HMC5883L_IRB = 0x0B self.HMC5883L_IRC = 0x0C
def __init__(self, parent=None, address=0x40, **kwargs): Device.__init__(self, parent, address, **kwargs) self.SHT25_HEATER_ON = 0x04 self.SHT25_HEATER_OFF = 0x00 self.SHT25_OTP_reload_off = 0x02 self.SHT25_RH12_T14 = 0x00 self.SHT25_RH8_T12 = 0x01 self.SHT25_RH10_T13 = 0x80 self.SHT25_RH11_T11 = 0x81 #self.address = 0x40 # SHT25 has only one device address (factory set) self.TRIG_T_HOLD = 0b11100011 self.TRIG_RH_HOLD = 0b11100101 self.TRIG_T_noHOLD = 0b11110011 self.TRIG_RH_noHOLD = 0b11110101 self.WRITE_USR_REG = 0b11100110 self.READ_USR_REG = 0b11100111 self.SOFT_RESET = 0b11111110
def __init__(self, parent = None, address = 0x48, fault_queue = 1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.Reg_temp = 0x00 self.Reg_conf = 0x01 self.Reg_Thys = 0x02 self.Reg_Tos = 0x03 ## config parameters self.SHUTDOWN = (1 << 0) self.INTERRUPT_Mode = (1 << 1) self.COMPARATOR_Mode = (0 << 1) self.OS_POLARITY_1 = (1 << 2) self.OS_POLARITY_0 = (0 << 2) # self.FQ_num = (int(self.FAULTS[fault_queue]) << 3) self.FORMAT_2complement = (0 << 5) self.FORMAT_extended = (1 << 5) self.Timeout_on = (0 << 6) self.Timeout_off = (1 << 6)
def __init__(self, parent=None, address=0x48, fault_queue=1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.Reg_temp = 0x00 self.Reg_conf = 0x01 self.Reg_Thys = 0x02 self.Reg_Tos = 0x03 ## config parameters self.SHUTDOWN = (1 << 0) self.INTERRUPT_Mode = (1 << 1) self.COMPARATOR_Mode = (0 << 1) self.OS_POLARITY_1 = (1 << 2) self.OS_POLARITY_0 = (0 << 2) # self.FQ_num = (int(self.FAULTS[fault_queue]) << 3) self.FORMAT_2complement = (0 << 5) self.FORMAT_extended = (1 << 5) self.Timeout_on = (0 << 6) self.Timeout_off = (1 << 6)
def __init__(self, parent = None, address = 0x68, sensitivity_corr = (8.75, 8.75, 8.75), datarate = 0b00, bandwidth = 0b00, FIFO = True, HPF = True, **kwargs): Device.__init__(self, parent, address, **kwargs) self.sensitivity = (sensitivity_corr[0]/1000 , sensitivity_corr[1]/1000, sensitivity_corr[2]/1000) self.data_rate = datarate self.band_width = bandwidth self.FIFO_EN = FIFO self.HPen = HPF self.A3G4250D_WHO_AM_I = 0x0F self.A3G4250D_CTRL_REG1 = 0x20 self.A3G4250D_CTRL_REG2 = 0x21 self.A3G4250D_CTRL_REG3 = 0x22 self.A3G4250D_CTRL_REG4 = 0x23 self.A3G4250D_CTRL_REG5 = 0x24 self.A3G4250D_REFERENCE = 0x25 self.A3G4250D_OUT_TEMP = 0x26 self.A3G4250D_STATUS_REG = 0x27 self.A3G4250D_OUT_X_L = 0x28 self.A3G4250D_OUT_X_H = 0x29 self.A3G4250D_OUT_Y_L = 0x2A self.A3G4250D_OUT_Y_H = 0x2B self.A3G4250D_OUT_Z_L = 0x2C self.A3G4250D_OUT_Z_H = 0x2D self.A3G4250D_FIFO_CTRL_REG = 0x2e self.A3G4250D_FIFO_SRC_REG = 0x2F self.A3G4250D_INT1_CFG = 0x30 self.A3G4250D_INT1_SRC = 0x31 self.A3G4250D_INT1_TSH_XH = 0x32 self.A3G4250D_INT1_TSH_XL = 0x33 self.A3G4250D_INT1_TSH_YH = 0x34 self.A3G4250D_INT1_TSH_YL = 0x35 self.A3G4250D_INT1_TSH_ZH = 0x36 self.A3G4250D_INT1_TSH_ZL = 0x37 self.A3G4250D_INT1_DURATION = 0x38 self.A3G4250D_FIFO_BYPASS_MODE = 0b000 self.A3G4250D_FIFO_MODE = 0b001 self.A3G4250D_FIFO_STREAM_MODE = 0b010
def __init__(self, parent = None, address = 0x2E, **kwargs): Device.__init__(self, parent, address, **kwargs) self.I2CSPI_SS0 = 0b0001 self.I2CSPI_SS1 = 0b0010 self.I2CSPI_SS2 = 0b0100 self.I2CSPI_SS3 = 0b1000 self.SS0_BIDIRECT = 0b00 self.SS0_PUSHPULL = 0b01 self.SS0_INPUT = 0b10 self.SS0_OPENDRAIN = 0b11 self.SS1_BIDIRECT = 0b0000 self.SS1_PUSHPULL = 0b0100 self.SS1_INPUT = 0b1000 self.SS1_OPENDRAIN = 0b1100 self.SS2_BIDIRECT = 0b000000 self.SS2_PUSHPULL = 0b010000 self.SS2_INPUT = 0b100000 self.SS2_OPENDRAIN = 0b110000 self.SS3_BIDIRECT = 0b00000000 self.SS3_PUSHPULL = 0b01000000 self.SS3_INPUT = 0b10000000 self.SS3_OPENDRAIN = 0b11000000 self.I2CSPI_MSB_FIRST = 0b0 self.I2CSPI_LSB_FIRST = 0b100000 self.I2CSPI_MODE_CLK_IDLE_LOW_DATA_EDGE_LEADING = 0b0000 # SPICLK LOW when idle; data clocked in on leading edge (CPOL = 0, CPHA = 0) self.I2CSPI_MODE_CLK_IDLE_LOW_DATA_EDGE_TRAILING = 0b0100 # SPICLK LOW when idle; data clocked in on trailing edge (CPOL = 0, CPHA = 1) self.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_TRAILING = 0b1000 # SPICLK HIGH when idle; data clocked in on trailing edge (CPOL = 1, CPHA = 0) self.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_LEADING = 0b1100 # SPICLK HIGH when idle; data clocked in on leading edge (CPOL = 1, CPHA = 1) self.I2CSPI_CLK_1843kHz = 0b00 self.I2CSPI_CLK_461kHz = 0b01 self.I2CSPI_CLK_115kHz = 0b10 self.I2CSPI_CLK_58kHz = 0b11
def __init__(self, parent=None, address=0x10, fault_queue=1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.command = 0x00 self.Data_lsb = 0x04 ##self.Data_msb = 0x02 ## config parameters self.SHUTDOWN = (1 << 7) self.continuous_measurement = (1 << 6) self.IR_sense = (1 << 5) self.VIS_sense = (0 << 5) self.clock_INT_16bit = (0b000 << 4) self.clock_INT_12bit = (0b001 << 4) self.clock_INT_8bit = (0b010 << 4) self.clock_INT_4bit = (0b011 << 4) self.clock_EXT_ADC = (0b100 << 4) self.clock_EXT_Timer = (0b101 << 4) self.range_1kLUX = 0b00 self.range_4kLUX = 0b01 self.range_16kLUX = 0b10 self.range_64kLUX = 0b11
def __init__(self, parent = None, address = 0x10, fault_queue = 1, **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.command = 0x00 self.Data_lsb = 0x04 ##self.Data_msb = 0x02 ## config parameters self.SHUTDOWN = (1 << 7) self.continuous_measurement = (1 << 6) self.IR_sense = (1 << 5) self.VIS_sense = (0 << 5) self.clock_INT_16bit = (0b000 << 4) self.clock_INT_12bit = (0b001 << 4) self.clock_INT_8bit = (0b010 << 4) self.clock_INT_4bit = (0b011 << 4) self.clock_EXT_ADC = (0b100 << 4) self.clock_EXT_Timer = (0b101 << 4) self.range_1kLUX = 0b00 self.range_4kLUX = 0b01 self.range_16kLUX = 0b10 self.range_64kLUX = 0b11
def __init__(self, parent=None, address=0x2E, **kwargs): Device.__init__(self, parent, address, **kwargs) self.I2CSPI_SS0 = 0b0001 self.I2CSPI_SS1 = 0b0010 self.I2CSPI_SS2 = 0b0100 self.I2CSPI_SS3 = 0b1000 self.SS0_BIDIRECT = 0b00 self.SS0_PUSHPULL = 0b01 self.SS0_INPUT = 0b10 self.SS0_OPENDRAIN = 0b11 self.SS1_BIDIRECT = 0b0000 self.SS1_PUSHPULL = 0b0100 self.SS1_INPUT = 0b1000 self.SS1_OPENDRAIN = 0b1100 self.SS2_BIDIRECT = 0b000000 self.SS2_PUSHPULL = 0b010000 self.SS2_INPUT = 0b100000 self.SS2_OPENDRAIN = 0b110000 self.SS3_BIDIRECT = 0b00000000 self.SS3_PUSHPULL = 0b01000000 self.SS3_INPUT = 0b10000000 self.SS3_OPENDRAIN = 0b11000000 self.I2CSPI_MSB_FIRST = 0b0 self.I2CSPI_LSB_FIRST = 0b100000 self.I2CSPI_MODE_CLK_IDLE_LOW_DATA_EDGE_LEADING = 0b0000 # SPICLK LOW when idle; data clocked in on leading edge (CPOL = 0, CPHA = 0) self.I2CSPI_MODE_CLK_IDLE_LOW_DATA_EDGE_TRAILING = 0b0100 # SPICLK LOW when idle; data clocked in on trailing edge (CPOL = 0, CPHA = 1) self.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_TRAILING = 0b1000 # SPICLK HIGH when idle; data clocked in on trailing edge (CPOL = 1, CPHA = 0) self.I2CSPI_MODE_CLK_IDLE_HIGH_DATA_EDGE_LEADING = 0b1100 # SPICLK HIGH when idle; data clocked in on leading edge (CPOL = 1, CPHA = 1) self.I2CSPI_CLK_1843kHz = 0b00 self.I2CSPI_CLK_461kHz = 0b01 self.I2CSPI_CLK_115kHz = 0b10 self.I2CSPI_CLK_58kHz = 0b11
def __init__(self, parent=None, address=0x55, **kwargs): Device.__init__(self, parent, address, **kwargs) self.R_HS = 7 self.R_RFREQ4 = 8 self.R_RFREQ3 = 9 self.R_RFREQ2 = 10 self.R_RFREQ1 = 11 self.R_RFREQ0 = 12 self.R_RFMC = 135 self.R_FDCO = 137 self.HS_DIV_MASK = 0xE0 self.N1_H_MASK = 0x1F self.N1_L_MASK = 0xC0 self.RFREQ4_MASK = 0x3F self.RFMC_RST = (1 << 7) self.RFMC_NEW_FREQ = (1 << 6) self.RFMC_FREEZE_M = (1 << 5) self.RFMC_FREEZE_VCADC = (1 << 4) self.RFMC_RECALL = (1 << 0) self.FDCO_FREEZE_DCO = (1 << 4)
def route(self, child = None): if self.routing_disabled: return False if child is None: return Device.route(self) LOGGER.debug("Routing multiplexer to %r" % (child, )) if child.channel is None: LOGGER.error("Child doesn't have a channel: %r" % (child, )) return False self.routing_disabled = True mask = 1 << child.channel if (self.status != mask): self.setup(mask) self.routing_disabled = False #self.setup(child.channel) return True
def __init__(self, parent = None, address = 0x51, **kwargs): Device.__init__(self, parent, address, **kwargs)
def __init__(self, parent = None, address = 0x44, **kwargs): Device.__init__(self, parent, address, **kwargs) self.SOFT_RESET = [0x30, 0xA2] self.STATUS_REG = [0xF3, 0x2D] self.MEASURE_H_CLKSD = [0x24, 0x00]
def __init__(self, parent=None, address=0x1C, sensitivity=4.0, highres=True, **kwargs): Device.__init__(self, parent, address, **kwargs) self.MMA_845XQ_STATUS = 0x00 self.MMA_845XQ_OUT_X_MSB = 0x1 self.MMA_845XQ_OUT_Y_MSB = 0x3 self.MMA_845XQ_OUT_Z_MSB = 0x5 self.MMA_845XQ_CTRL_REG1 = 0x2A self.MMA_845XQ_CTRL_REG1_VALUE_ACTIVE = 0x01 self.MMA_845XQ_CTRL_REG1_VALUE_F_READ = 0x02 self.MMA_845XQ_CTRL_REG2 = 0x2B self.MMA_845XQ_CTRL_REG2_RESET = 0x40 self.MMA_845XQ_CTRL_REG3 = 0x2C self.MMA_845XQ_CTRL_REG4 = 0x2D self.MMA_845XQ_CTRL_REG5 = 0x2E self.MMA_845XQ_WHO_AM_I = 0x0D self.MMA_845XQ_PL_STATUS = 0x10 self.MMA_845XQ_PL_CFG = 0x11 self.MMA_845XQ_PL_EN = 0x40 self.MMA_845XQ_XYZ_DATA_CFG = 0x0E self.MMA_845XQ_2G_MODE = 0x00 # Set Sensitivity to 2g self.MMA_845XQ_4G_MODE = 0x01 # Set Sensitivity to 4g self.MMA_845XQ_8G_MODE = 0x02 # Set Sensitivity to 8g self.MMA_845XQ_FF_MT_CFG = 0x15 self.MMA_845XQ_FF_MT_CFG_ELE = 0x80 self.MMA_845XQ_FF_MT_CFG_OAE = 0x40 self.MMA_845XQ_FF_MT_SRC = 0x16 self.MMA_845XQ_FF_MT_SRC_EA = 0x80 self.MMA_845XQ_PULSE_CFG = 0x21 self.MMA_845XQ_PULSE_CFG_ELE = 0x80 self.MMA_845XQ_PULSE_SRC = 0x22 self.MMA_845XQ_PULSE_SRC_EA = 0x80 ## Interrupts # Auto SLEEP/WAKE interrupt self.INT_ASLP = (1 << 7) # Transient interrupt self.INT_TRANS = (1 << 5) # Orientation = (landscape/portrait) interrupt self.INT_LNDPRT = (1 << 4) # Pulse detection interrupt self.INT_PULSE = (1 << 3) # Freefall/Motion interrupt self.INT_FF_MT = (1 << 2) # Data ready interrupt self.INT_DRDY = (1 << 0) SCALES = { 2.0: self.MMA_845XQ_2G_MODE, 4.0: self.MMA_845XQ_4G_MODE, 8.0: self.MMA_845XQ_8G_MODE, } self._sensitivity = sensitivity self._highres = highres self._scale = SCALES[sensitivity]
def __init__(self, parent = None, address = 0x68, possible_adresses = [0x68, 0x69], **kwargs): Device.__init__(self, parent, address, **kwargs)
def __init__(self, parent=None, address=0x44, **kwargs): Device.__init__(self, parent, address, **kwargs) self.SOFT_RESET = [0x30, 0xA2] self.STATUS_REG = [0xF3, 0x2D] self.MEASURE_H_CLKSD = [0x24, 0x00]
def __init__(self, parent = None, address = 0x1C, sensitivity = 4.0, highres = True, **kwargs): Device.__init__(self, parent, address, **kwargs) self.MMA_845XQ_STATUS = 0x00 self.MMA_845XQ_OUT_X_MSB = 0x1 self.MMA_845XQ_OUT_Y_MSB = 0x3 self.MMA_845XQ_OUT_Z_MSB = 0x5 self.MMA_845XQ_CTRL_REG1 = 0x2A self.MMA_845XQ_CTRL_REG1_VALUE_ACTIVE = 0x01 self.MMA_845XQ_CTRL_REG1_VALUE_F_READ = 0x02 self.MMA_845XQ_CTRL_REG2 = 0x2B self.MMA_845XQ_CTRL_REG2_RESET = 0x40 self.MMA_845XQ_CTRL_REG3 = 0x2C self.MMA_845XQ_CTRL_REG4 = 0x2D self.MMA_845XQ_CTRL_REG5 = 0x2E self.MMA_845XQ_WHO_AM_I = 0x0D self.MMA_845XQ_PL_STATUS = 0x10 self.MMA_845XQ_PL_CFG = 0x11 self.MMA_845XQ_PL_EN = 0x40 self.MMA_845XQ_XYZ_DATA_CFG = 0x0E self.MMA_845XQ_2G_MODE = 0x00 # Set Sensitivity to 2g self.MMA_845XQ_4G_MODE = 0x01 # Set Sensitivity to 4g self.MMA_845XQ_8G_MODE = 0x02 # Set Sensitivity to 8g self.MMA_845XQ_FF_MT_CFG = 0x15 self.MMA_845XQ_FF_MT_CFG_ELE = 0x80 self.MMA_845XQ_FF_MT_CFG_OAE = 0x40 self.MMA_845XQ_FF_MT_SRC = 0x16 self.MMA_845XQ_FF_MT_SRC_EA = 0x80 self.MMA_845XQ_PULSE_CFG = 0x21 self.MMA_845XQ_PULSE_CFG_ELE = 0x80 self.MMA_845XQ_PULSE_SRC = 0x22 self.MMA_845XQ_PULSE_SRC_EA = 0x80 ## Interrupts # Auto SLEEP/WAKE interrupt self.INT_ASLP = (1<<7) # Transient interrupt self.INT_TRANS = (1<<5) # Orientation = (landscape/portrait) interrupt self.INT_LNDPRT = (1<<4) # Pulse detection interrupt self.INT_PULSE = (1<<3) # Freefall/Motion interrupt self.INT_FF_MT = (1<<2) # Data ready interrupt self.INT_DRDY = (1<<0) SCALES = { 2.0: self.MMA_845XQ_2G_MODE, 4.0: self.MMA_845XQ_4G_MODE, 8.0: self.MMA_845XQ_8G_MODE, } self._sensitivity = sensitivity self._highres = highres self._scale = SCALES[sensitivity]
def __init__(self, parent = None, address = 0x50, possible_adresses = [0x50, 0x51], **kwargs): Device.__init__(self, parent, address, **kwargs) ## register definitions self.CONTROL_STATUS = 0x00
def __init__(self, parent = None, address = 0x01, fault_queue = 1, **kwargs): Device.__init__(self, parent, address, **kwargs)