当前位置: 首页>>代码示例>>Python>>正文


Python I2C.reverseByteOrder方法代码示例

本文整理汇总了Python中Adafruit_GPIO.I2C.reverseByteOrder方法的典型用法代码示例。如果您正苦于以下问题:Python I2C.reverseByteOrder方法的具体用法?Python I2C.reverseByteOrder怎么用?Python I2C.reverseByteOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Adafruit_GPIO.I2C的用法示例。


在下文中一共展示了I2C.reverseByteOrder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: activate_ready

# 需要导入模块: from Adafruit_GPIO import I2C [as 别名]
# 或者: from Adafruit_GPIO.I2C import reverseByteOrder [as 别名]
def activate_ready():
	"""
	swaps the high and low threshold registers so that the conversion
	ready pin will be activated on the ADC
	"""
	high = I2C.reverseByteOrder(0x8000)
	low = I2C.reverseByteOrder(0x7fff)
	D.dut.write16(D.highThreshReg, high)
	D.dut.write16(D.lowThreshReg,low)
开发者ID:shermanlam,项目名称:RaspberryPiROS,代码行数:11,代码来源:ADS1015.py

示例2: dry_sensor

# 需要导入模块: from Adafruit_GPIO import I2C [as 别名]
# 或者: from Adafruit_GPIO.I2C import reverseByteOrder [as 别名]
    def dry_sensor(self):
        """
        Cribbed from the Adafruit Arduino code. Guess it makes sure the
        sensor is ready for reading after normalizing in a room.
        """
        orig_config = self._device.readU16BE(HDC1000_CONFIG)

        # reset, heat up, and select 14 bit temp & humidity
        #
        new_config = I2C.reverseByteOrder(HDC1000_CONFIG_RST |
                                          HDC1000_CONFIG_HEAT |
                                          HDC1000_CONFIG_MODE |
                                          HDC1000_CONFIG_TRES_14 |
                                          HDC1000_CONFIG_HRES_14)
        self._device.write16(HDC1000_CONFIG, new_config)

        time.sleep(0.015)

        # Take 1000 readings and toss the results.
        #
        for i in range(1000):
            self._read32(HDC1000_TEMP)
            time.sleep(0.001)

        # Write our original config back out to the device.
        #
        self._device.write16(HDC1000_CONFIG, orig_config)
        time.sleep(0.015)
开发者ID:scanner,项目名称:HDC100X_Python,代码行数:30,代码来源:HDC100x.py

示例3: write_config

# 需要导入模块: from Adafruit_GPIO import I2C [as 别名]
# 或者: from Adafruit_GPIO.I2C import reverseByteOrder [as 别名]
def write_config():
	"""
	Write the desired options to the ADC configuration register.
	Get data from global options
	"""
	global D
	
	# bit shift everything into its right place in the message. Check datasheet.
	# Some options were not broken out for changing. The "magic bits" are 
	# those options. Combine all the options through bit-wise OR
	newConfig = (	1 << 15		|	# OS - trigger conversion
			D.mux << 12	|	# MUX
			D.pga << 9	|	# PGA
			1 << 8		|	# MODE - singal shot
			D.dr << 5	|	# DR
			0 << 4		|	# COMP_MODE
			0 << 3 		|	# COMP_POL
			0 << 2		|	# COMP_LAT
			0 << 1 	)		# COMP_QUE
	
	# print "mux: ", bin(D.mux)
	# print "pga: ", bin(D.pga)
	# print "dr: ", bin(D.dr)

	# due to something with byte-writing order, we need to flip
	# the bytes before writing. I don't know the full details
	# print "config: %s"%bin(newConfig)
	# print "length: %d"%len(bin(newConfig))
	rev = I2C.reverseByteOrder(newConfig)
	# print "Reversed byte order: ", bin(rev)

	# write it!
	D.dut.write16(D.configReg,rev)	
开发者ID:shermanlam,项目名称:RaspberryPiROS,代码行数:35,代码来源:ADS1015.py

示例4: set_config

# 需要导入模块: from Adafruit_GPIO import I2C [as 别名]
# 或者: from Adafruit_GPIO.I2C import reverseByteOrder [as 别名]
    def set_config(self):
        """Set the 16 bit Big Endian INA219 configuration register (0x00)
        """

        reg_00 = self.reg_00
        if self.host_endian_is_little:
            reg_00 = I2C.reverseByteOrder(reg_00)
        self.device.write16(0x00, reg_00)
开发者ID:crdietrich,项目名称:pyINA219,代码行数:10,代码来源:ina219.py

示例5: reset

# 需要导入模块: from Adafruit_GPIO import I2C [as 别名]
# 或者: from Adafruit_GPIO.I2C import reverseByteOrder [as 别名]
 def reset(self):
     """
     reset, and select 14 bit temp & humidity
     """
     self._device.write16(HDC1000_CONFIG,
                          I2C.reverseByteOrder(HDC1000_CONFIG_RST |
                                               HDC1000_CONFIG_MODE |
                                               HDC1000_CONFIG_TRES_14 |
                                               HDC1000_CONFIG_HRES_14))
     time.sleep(0.015)
开发者ID:scanner,项目名称:HDC100X_Python,代码行数:12,代码来源:HDC100x.py

示例6: _load_calibration

# 需要导入模块: from Adafruit_GPIO import I2C [as 别名]
# 或者: from Adafruit_GPIO.I2C import reverseByteOrder [as 别名]
 def _load_calibration(self):
         #load calibration               
         self._device.write16(TMP007_CONFIG, I2C.reverseByteOrder(TMP007_CFG_MODEON | TMP007_CFG_ALERTEN | TMP007_CFG_TRANSC | self._mode))
         #set alert status
         self._device.write16(TMP007_STATMASK, I2C.reverseByteOrder(TMP007_STAT_ALERTEN |TMP007_STAT_CRTEN))
开发者ID:THP-JOE,项目名称:Python_TMP007,代码行数:7,代码来源:TMP007.py


注:本文中的Adafruit_GPIO.I2C.reverseByteOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。