當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。