Beispiel #1
0
    def __init__(self,
                 altitude=0,
                 external=None,
                 oversampling=0,
                 filter=0,
                 standby=0.5,
                 slave=0x76):
        I2C.__init__(self, toint(slave))
        Pressure.__init__(self, altitude, external)

        self.t1 = self.readUnsigned(0x88, 2)
        self.t2 = self.readSigned(0x8A, 2)
        self.t3 = self.readSigned(0x8C, 2)

        self.p1 = self.readUnsigned(0x8E, 2)
        self.p2 = self.readSigned(0x90, 2)
        self.p3 = self.readSigned(0x92, 2)
        self.p4 = self.readSigned(0x94, 2)
        self.p5 = self.readSigned(0x96, 2)
        self.p6 = self.readSigned(0x98, 2)
        self.p7 = self.readSigned(0x9A, 2)
        self.p8 = self.readSigned(0x9C, 2)
        self.p9 = self.readSigned(0x9E, 2)

        self.h1 = self.readUnsigned(0xA1, 1)
        self.h2 = self.readSigned(0xE1, 2)
        self.h3 = self.readUnsigned(0xE3, 1)
        self.h4 = (self.readUnsigned(0xE4, 1) << 4) | (
            self.readUnsigned(0xE5, 1) & 0x0F)
        self.h5 = (self.readSigned(0xE6, 1) << 4) | (
            self.readSigned(0xE5, 1) >> 4)
        self.h6 = self.readSigned(0xE7, 1)

        oversamplingBits = toint(oversampling).bit_length()
        self.writeRegister(
            0xF2, oversamplingBits
        )  # Humidity oversampling. Must be set before temp/press oversampling (see datasheet 5.4.3).
        self.writeRegister(
            0xF4, (oversamplingBits << 5) | (oversamplingBits << 2)
            | 0x03)  # Pressure, temperature oversampling, sensor normal mode.

        standbyValues = {
            '0.5': 0,
            '10': 6,
            '20': 7,
            '62.5': 1,
            '125': 2,
            '250': 3,
            '500': 4,
            '1000': 5
        }
        if standby in standbyValues:
            tStandbyBits = standbyValues[standby]
        else:
            tStandbyBits = 0  # Default to 0.5ms t_standby
            # logger.warn('Invalid value for standby: %s' % standby)
        spiBits = 0  # No SPI of course.
        filterBits = toint(filter) >> 1
        self.writeRegister(0xF5,
                           (tStandbyBits << 5) | (filterBits << 2) | spiBits)
Beispiel #2
0
    def __init__(self, altitude=0, external=None, reset_pin_bcm=None):
        NativeGPIO.__init__(self)

        self._reset_pin_bcm = reset_pin_bcm
        self.resetHardware()

        I2C.__init__(self, 0x60)
        Pressure.__init__(self, altitude, external)

        coef_values = self._getCoefValues()
        self._coef_a0 = coef_values[0]
        self._coef_b1 = coef_values[1]
        self._coef_b2 = coef_values[2]
        self._coef_c12 = coef_values[3]
Beispiel #3
0
    def __init__(self, altitude=0, external=None, reset_pin_bcm=None):
        NativeGPIO.__init__(self)

        self._reset_pin_bcm = reset_pin_bcm
        self.resetHardware()

        I2C.__init__(self, 0x60)
        Pressure.__init__(self, altitude, external)

        coef_values = self._getCoefValues()
        self._coef_a0 = coef_values[0]
        self._coef_b1 = coef_values[1]
        self._coef_b2 = coef_values[2]
        self._coef_c12 = coef_values[3]
Beispiel #4
0
    def __init__(self, altitude=0, external=None, name="BMP085"):
        I2C.__init__(self, 0x77, name)
        Pressure.__init__(self, altitude, external)

        self.ac1 = self.readSignedInteger(0xAA)
        self.ac2 = self.readSignedInteger(0xAC)
        self.ac3 = self.readSignedInteger(0xAE)
        self.ac4 = self.readUnsignedInteger(0xB0)
        self.ac5 = self.readUnsignedInteger(0xB2)
        self.ac6 = self.readUnsignedInteger(0xB4)
        self.b1 = self.readSignedInteger(0xB6)
        self.b2 = self.readSignedInteger(0xB8)
        self.mb = self.readSignedInteger(0xBA)
        self.mc = self.readSignedInteger(0xBC)
        self.md = self.readSignedInteger(0xBE)
Beispiel #5
0
 def __init__(self, altitude=0, external=None):
     I2C.__init__(self, 0x77)
     Pressure.__init__(self, altitude, external)
     
     self.ac1 = self.readSignedInteger(0xAA)
     self.ac2 = self.readSignedInteger(0xAC)
     self.ac3 = self.readSignedInteger(0xAE)
     self.ac4 = self.readUnsignedInteger(0xB0)
     self.ac5 = self.readUnsignedInteger(0xB2)
     self.ac6 = self.readUnsignedInteger(0xB4)
     self.b1  = self.readSignedInteger(0xB6)
     self.b2  = self.readSignedInteger(0xB8)
     self.mb  = self.readSignedInteger(0xBA)
     self.mc  = self.readSignedInteger(0xBC)
     self.md  = self.readSignedInteger(0xBE)
Beispiel #6
0
 def __family__(self):
     return [Temperature.__family__(self), Pressure.__family__(self)]
Beispiel #7
0
 def __family__(self):
     return [Temperature.__family__(self), Pressure.__family__(self)]
Beispiel #8
0
 def __family__(self):
     return [Pressure.__family__(self)]
Beispiel #9
0
 def __family__(self):
     return [Pressure.__family__(self)]