Update library to support FT232H I2C device.

This commit is contained in:
Tony DiCola 2014-11-20 21:17:22 -08:00
parent f4973e7d02
commit b604dd81ce
2 changed files with 10 additions and 6 deletions

View file

@ -18,10 +18,10 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import logging
import math
import Adafruit_GPIO.I2C as I2C
# Default I2C address for device.
MCP9808_I2CADDR_DEFAULT = 0x18
@ -52,13 +52,17 @@ class MCP9808(object):
board.
"""
def __init__(self, address=MCP9808_I2CADDR_DEFAULT, busnum=I2C.get_default_bus()):
def __init__(self, address=MCP9808_I2CADDR_DEFAULT, i2c=None, **kwargs):
"""Initialize MCP9808 device on the specified I2C address and bus number.
Address defaults to 0x18 and bus number defaults to the appropriate bus
for the hardware.
"""
self._logger = logging.getLogger('Adafruit_MCP9808.MCP9808')
self._device = I2C.Device(address, busnum)
if i2c is None:
import Adafruit_GPIO.I2C as I2C
i2c = I2C
self._device = i2c.get_i2c_device(address, **kwargs)
def begin(self):
"""Start taking temperature measurements. Returns True if the device is

View file

@ -3,12 +3,12 @@ use_setuptools()
from setuptools import setup, find_packages
setup(name = 'Adafruit_MCP9808',
version = '1.0.0',
version = '1.5.0',
author = 'Tony DiCola',
author_email = 'tdicola@adafruit.com',
description = 'Library for accessing the MCP9808 precision temperature sensor on a Raspberry Pi or Beaglebone Black.',
license = 'MIT',
url = 'https://github.com/adafruit/Adafruit_Python_MCP9808/',
dependency_links = ['https://github.com/adafruit/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.5.0'],
install_requires = ['Adafruit-GPIO>=0.5.0'],
dependency_links = ['https://github.com/adafruit/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.6.5'],
install_requires = ['Adafruit-GPIO>=0.6.5'],
packages = find_packages())