Qwiic_TMP102_Py  packaging_test1-1-g6ea6532
Python for SFE Qwiic TMP102
Loading...
Searching...
No Matches
qwiic_tmp102.QwiicTmp102Sensor Class Reference

Some devices have multiple available addresses - this is a list of these addresses. More...

Inheritance diagram for qwiic_tmp102.QwiicTmp102Sensor:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 
def is_connected (self)
 Determine if a Soil MoistureSensor device is conntected to the system. More...
 
def begin (self)
 Initialize the operation of the Soil Moisture Sensor module. More...
 
def get_address (self)
 Returns the device address. More...
 
def read_temp_c (self)
 Reads the results from the sensor. More...
 
def read_temp_f (self)
 Reads the results from the sensor. More...
 
def set_conversion_rate (self, rate)
 Set the conversion rate (0-3) More...
 
def set_extended_mode (self, mode)
 Enable or disable extended mode 0 - disabled (-55C to +128C) 1 - enabled (-55C to +150C) More...
 
def sleep (self)
 Switch sensor to low power mode. More...
 
def wakeup (self)
 Wakeup and start running in normal power mode. More...
 
def set_alert_polarity (self, polarity)
 Set the polarity of Alert 0 - Active LOW 1 - Active HIGH. More...
 
def alert (self)
 Returns state of Alert register. More...
 
def one_shot (self, setOneShot=0)
 Sets the SingleShot Register. More...
 
def set_low_temp_c (self, temperature)
 Sets T_LOW (degrees C) alert threshold. More...
 
def set_high_temp_c (self, temperature)
 Sets T_LOW (degrees C) alert threshold. More...
 
def set_low_temp_f (self, temperature)
 Sets T_LOW (degrees F) alert threshold. More...
 
def set_high_temp_f (self, temperature)
 Sets T_HIGH (degrees F) alert threshold. More...
 
def read_low_temp_c (self)
 Gets T_LOW (degrees C) alert threshold. More...
 
def read_high_temp_c (self)
 Gets T_HIGH (degrees C) alert threshold. More...
 
def read_low_temp_f (self)
 Reads T_LOW register in F. More...
 
def read_high_temp_f (self)
 Reads T_HIGH register in F. More...
 
def set_fault (self, faultSetting)
 Set the number of consecutive faults. More...
 
def set_alert_mode (self, mode)
 Set Alert type. More...
 
def read_block_pointer_reg (self, reg, numBytes=2)
 To read from the device, we first write the register we want to read then explicitly send a stop bit. More...
 

Public Attributes

 address
 
 tempC
 
 tempF
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 

Properties

 connected = property(is_connected)
 

Detailed Description

Some devices have multiple available addresses - this is a list of these addresses.

NOTE: The first address in this list is considered the default I2C address for the device.

QwiicTmp102Sensor

Parameters
addressThe I2C address to use for the device. If not provided, the default address is used.
i2c_driverAn existing i2c driver object. If not provided a driver object is created.
Returns
Object The TMP102 Sensor device object.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_tmp102.QwiicTmp102Sensor.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Member Function Documentation

◆ alert()

def qwiic_tmp102.QwiicTmp102Sensor.alert (   self)

Returns state of Alert register.

Returns
int The state of the alert register.

◆ begin()

def qwiic_tmp102.QwiicTmp102Sensor.begin (   self)

Initialize the operation of the Soil Moisture Sensor module.

Returns
bool Returns true of the initialization was successful, otherwise False.

◆ get_address()

def qwiic_tmp102.QwiicTmp102Sensor.get_address (   self)

Returns the device address.

Returns
int The device address.

◆ is_connected()

def qwiic_tmp102.QwiicTmp102Sensor.is_connected (   self)

Determine if a Soil MoistureSensor device is conntected to the system.

Returns
bool True if the device is connected, otherwise False.

◆ one_shot()

def qwiic_tmp102.QwiicTmp102Sensor.one_shot (   self,
  setOneShot = 0 
)

Sets the SingleShot Register.

Returns 1 after the conversion is complete

Parameters
intsetOneShot: 0 - Continuous conversion (default)
Returns
int The state of the one shot register.

◆ read_block_pointer_reg()

def qwiic_tmp102.QwiicTmp102Sensor.read_block_pointer_reg (   self,
  reg,
  numBytes = 2 
)

To read from the device, we first write the register we want to read then explicitly send a stop bit.

Then, restart the connection to read the data from the device.

See datasheet page. 13

Parameters
intreg: The register to read from.
intnumBytes: The number of bytes to read.
Returns
list A list of bytes from the device.

◆ read_high_temp_c()

def qwiic_tmp102.QwiicTmp102Sensor.read_high_temp_c (   self)

Gets T_HIGH (degrees C) alert threshold.

Returns
float The high temp in Celsius.

◆ read_high_temp_f()

def qwiic_tmp102.QwiicTmp102Sensor.read_high_temp_f (   self)

Reads T_HIGH register in F.

Returns
float The high temp in Fahrenheit.

◆ read_low_temp_c()

def qwiic_tmp102.QwiicTmp102Sensor.read_low_temp_c (   self)

Gets T_LOW (degrees C) alert threshold.

Returns
float The low temp in Celsius.

◆ read_low_temp_f()

def qwiic_tmp102.QwiicTmp102Sensor.read_low_temp_f (   self)

Reads T_LOW register in F.

Returns
float The low temp in Fahrenheit.

◆ read_temp_c()

def qwiic_tmp102.QwiicTmp102Sensor.read_temp_c (   self)

Reads the results from the sensor.

Returns
float The temperature in Celsius.

◆ read_temp_f()

def qwiic_tmp102.QwiicTmp102Sensor.read_temp_f (   self)

Reads the results from the sensor.

Returns
float The temperature in Fahrenheit.

◆ set_alert_mode()

def qwiic_tmp102.QwiicTmp102Sensor.set_alert_mode (   self,
  mode 
)

Set Alert type.

Parameters
intmode: The mode to set the alert to. 0 - Comparator Mode: Active from temp > T_HIGH until temp < T_LOW 1 - Thermostat Mode: Active when temp > T_HIGH until any read operation occurs

◆ set_alert_polarity()

def qwiic_tmp102.QwiicTmp102Sensor.set_alert_polarity (   self,
  polarity 
)

Set the polarity of Alert 0 - Active LOW 1 - Active HIGH.

◆ set_conversion_rate()

def qwiic_tmp102.QwiicTmp102Sensor.set_conversion_rate (   self,
  rate 
)

Set the conversion rate (0-3)

@ param int rate: The rate to set the conversion to. 0 - 0.25 Hz 1 - 1 Hz 2 - 4 Hz (default) 3 - 8 Hz

◆ set_extended_mode()

def qwiic_tmp102.QwiicTmp102Sensor.set_extended_mode (   self,
  mode 
)

Enable or disable extended mode 0 - disabled (-55C to +128C) 1 - enabled (-55C to +150C)

◆ set_fault()

def qwiic_tmp102.QwiicTmp102Sensor.set_fault (   self,
  faultSetting 
)

Set the number of consecutive faults.

Parameters
intfaultSetting: The number of consecutive faults to trigger an alert. 0 - 1 fault 1 - 2 faults 2 - 4 faults 3 - 6 faults

◆ set_high_temp_c()

def qwiic_tmp102.QwiicTmp102Sensor.set_high_temp_c (   self,
  temperature 
)

Sets T_LOW (degrees C) alert threshold.

◆ set_high_temp_f()

def qwiic_tmp102.QwiicTmp102Sensor.set_high_temp_f (   self,
  temperature 
)

Sets T_HIGH (degrees F) alert threshold.

◆ set_low_temp_c()

def qwiic_tmp102.QwiicTmp102Sensor.set_low_temp_c (   self,
  temperature 
)

Sets T_LOW (degrees C) alert threshold.

Parameters
floattemperature: The temperature in Celsius to set the alert threshold to.

◆ set_low_temp_f()

def qwiic_tmp102.QwiicTmp102Sensor.set_low_temp_f (   self,
  temperature 
)

Sets T_LOW (degrees F) alert threshold.

Parameters
floattemperature: The temperature in Fahrenheit to set the alert threshold to.

◆ sleep()

def qwiic_tmp102.QwiicTmp102Sensor.sleep (   self)

Switch sensor to low power mode.

◆ wakeup()

def qwiic_tmp102.QwiicTmp102Sensor.wakeup (   self)

Wakeup and start running in normal power mode.

Member Data Documentation

◆ address

qwiic_tmp102.QwiicTmp102Sensor.address

◆ available_addresses

qwiic_tmp102.QwiicTmp102Sensor.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_tmp102.QwiicTmp102Sensor.device_name = _DEFAULT_NAME
static

◆ tempC

qwiic_tmp102.QwiicTmp102Sensor.tempC

◆ tempF

qwiic_tmp102.QwiicTmp102Sensor.tempF

Property Documentation

◆ connected

qwiic_tmp102.QwiicTmp102Sensor.connected = property(is_connected)
static

The documentation for this class was generated from the following file: