![]() |
Qwiic_TMP117_Py
packaging_test1-4-g0b53a4e
Python for SFE Qwiic TMP117
|
Public Member Functions | |
def | __init__ (self, address=None, i2c_driver=None) |
Constructor. More... | |
def | is_connected (self) |
Determines if this device is connected. More... | |
def | begin (self) |
Initializes this device with default parameters. More... | |
def | get_address (self) |
Returns the I2C address of the device. More... | |
def | read_temp_c (self) |
This function reads the temperature reading from the sensor and returns the value in degrees celsius. More... | |
def | read_temp_f (self) |
This function calculates the fahrenheit reading from the celsius reading initially found. More... | |
def | get_temperature_offset (self) |
This function reads the temperature offset value from the device. More... | |
def | set_temperature_offset (self, offset) |
This function sets the temperature offset value on the device. More... | |
def | get_low_limit (self) |
This function reads the low limit register that is set by the user. More... | |
def | set_low_limit (self, lowLimit) |
This function allows the user to set the low limit register to whatever specified value, as long as in the range for the temperature sensor. More... | |
def | get_high_limit (self) |
This function reads the high limit register that is set by the user. More... | |
def | set_high_limit (self, highLimit) |
This function allows the user to set the high limit register to whatever specified value, as long as in the range for the temperature sensor. More... | |
def | get_configuration_register (self) |
This function reads configuration register. More... | |
def | get_high_low_alert (self) |
This function reads configuration register and saves the high and low alert flags. More... | |
def | get_high_alert (self) |
This function reads the 15th bit of the configuration register to tell if the conversion result is higher than the high limit. More... | |
def | get_low_alert (self) |
This function reads the 14th bit of the configuration register to tell if the conversion result is lower than the low limit. More... | |
def | set_alert_function_mode (self, setAlertMode) |
This function sets the alert function mode to either "alert" or "therm" mode. More... | |
def | get_alert_function_mode (self) |
This function gets the alert function mode to either "alert" or "therm" mode. More... | |
def | soft_reset (self) |
This function performs a software reset, loading all the default values into the configuration register. More... | |
def | set_continuous_conversion_mode (self) |
This function sets the conversion mode of the sensor to be continuous. More... | |
def | set_shutdown_mode (self) |
This function sets the conversion mode of the sensor to be in shutdown mode. More... | |
def | set_one_shot_mode (self) |
This function sets the conversion mode of the sensor to be in one shot mode. More... | |
def | get_conversion_mode (self) |
This function reads the mode for the conversions. More... | |
def | set_conversion_average_mode (self, convMode) |
This function sets the conversion averaging mode of the device when in Continuous Conversion Mode. More... | |
def | get_conversion_average_mode (self) |
This function reads the conversion averaging mode. More... | |
def | set_conversion_cycle_bit (self, conv) |
This function sets the conversion cycle time bit in Continuous Conversion mode. More... | |
def | get_conversion_cycle_bit (self) |
This function returns the Conversion Cycle Bit value that the device is currently in at the time. More... | |
def | data_ready (self) |
This function checks to see if there is data ready to be sent from the TMP117. More... | |
def | read_register (self, register) |
Reads a register from the device. More... | |
def | write_register (self, register, value) |
Writes a value to a register on the device. More... | |
Public Attributes | |
address | |
Properties | |
connected = property(is_connected) | |
def qwiic_tmp117.QwiicTMP117.__init__ | ( | self, | |
address = None , |
|||
i2c_driver = None |
|||
) |
Constructor.
int,optional | address: The I2C address to use for the device If not provided, the default address is used |
I2CDriver,optional | i2c_driver: An existing i2c driver object If not provided, a driver object is created |
def qwiic_tmp117.QwiicTMP117.begin | ( | self | ) |
Initializes this device with default parameters.
True
if successful, otherwise False
def qwiic_tmp117.QwiicTMP117.data_ready | ( | self | ) |
This function checks to see if there is data ready to be sent from the TMP117.
True
if the data is ready, otherwise False
def qwiic_tmp117.QwiicTMP117.get_address | ( | self | ) |
Returns the I2C address of the device.
def qwiic_tmp117.QwiicTMP117.get_alert_function_mode | ( | self | ) |
This function gets the alert function mode to either "alert" or "therm" mode.
Allowable return values are: kThermMode kAlertMode
def qwiic_tmp117.QwiicTMP117.get_configuration_register | ( | self | ) |
This function reads configuration register.
Use this function if you need to read certain flags before they are cleared. This can be found on page 25 of the datasheet.
def qwiic_tmp117.QwiicTMP117.get_conversion_average_mode | ( | self | ) |
This function reads the conversion averaging mode.
Allowable return values are: kConvAvgNone kConvAvg8 kConvAvg32 kConvAvg64
def qwiic_tmp117.QwiicTMP117.get_conversion_cycle_bit | ( | self | ) |
This function returns the Conversion Cycle Bit value that the device is currently in at the time.
This bit can help determine the conversion cycle time that the device is in while being in continuous conversion mode. (See table in set_conversion_cycle_bit, or page 27 of datasheet)
Allowable return values are 0-7
def qwiic_tmp117.QwiicTMP117.get_conversion_mode | ( | self | ) |
This function reads the mode for the conversions.
Allowable return values are: kContinuousConversionMode kOneShotMode kShutdownMode
def qwiic_tmp117.QwiicTMP117.get_high_alert | ( | self | ) |
This function reads the 15th bit of the configuration register to tell if the conversion result is higher than the high limit.
This is set as a High Alert flag.
True
if the high alert flag is set, otherwise False
def qwiic_tmp117.QwiicTMP117.get_high_limit | ( | self | ) |
This function reads the high limit register that is set by the user.
def qwiic_tmp117.QwiicTMP117.get_high_low_alert | ( | self | ) |
This function reads configuration register and saves the high and low alert flags.
Use this function if you need to read the alert flags before they are cleared.
Index into the list with the kLowAlertIdx and kHighAlertIdx constants
def qwiic_tmp117.QwiicTMP117.get_low_alert | ( | self | ) |
This function reads the 14th bit of the configuration register to tell if the conversion result is lower than the low limit.
This is set as a Low Alert flag.
True
if the low alert flag is set, otherwise False
def qwiic_tmp117.QwiicTMP117.get_low_limit | ( | self | ) |
This function reads the low limit register that is set by the user.
def qwiic_tmp117.QwiicTMP117.get_temperature_offset | ( | self | ) |
This function reads the temperature offset value from the device.
def qwiic_tmp117.QwiicTMP117.is_connected | ( | self | ) |
Determines if this device is connected.
True
if connected, otherwise False
def qwiic_tmp117.QwiicTMP117.read_register | ( | self, | |
register | |||
) |
Reads a register from the device.
int | register: The register to read |
Used because the device returns bytes as big-endian
def qwiic_tmp117.QwiicTMP117.read_temp_c | ( | self | ) |
This function reads the temperature reading from the sensor and returns the value in degrees celsius.
def qwiic_tmp117.QwiicTMP117.read_temp_f | ( | self | ) |
This function calculates the fahrenheit reading from the celsius reading initially found.
def qwiic_tmp117.QwiicTMP117.set_alert_function_mode | ( | self, | |
setAlertMode | |||
) |
This function sets the alert function mode to either "alert" or "therm" mode.
bool | setAlertMode: The alert mode to set |
Allowable setAlertMode values are: kThermMode kAlertMode
True
if successful, otherwise False
def qwiic_tmp117.QwiicTMP117.set_continuous_conversion_mode | ( | self | ) |
This function sets the conversion mode of the sensor to be continuous.
The TMP117 defaults to Continuous Conversion Mode on reset.
def qwiic_tmp117.QwiicTMP117.set_conversion_average_mode | ( | self, | |
convMode | |||
) |
This function sets the conversion averaging mode of the device when in Continuous Conversion Mode.
int | convMode: The conversion averaging mode to set |
Allowable convMode values are: kConvAvgNone kConvAvg8 kConvAvg32 kConvAvg64
True
if successful, otherwise False
def qwiic_tmp117.QwiicTMP117.set_conversion_cycle_bit | ( | self, | |
conv | |||
) |
This function sets the conversion cycle time bit in Continuous Conversion mode.
The times for the conversions can be found below. The user puts in 0-7 and it will return the cycle time accoring to the values in the chart.
Conversion Cycle Time in CC Mode (found on the datasheet page 27 table 7) AVG 0 1 2 3 CONV averaging (0) (8) (32) (64) 0 15.5ms 125ms 500ms 1s
1 125ms 125ms 500ms 1s
2 250ms 250ms 500ms 1s
3 500ms 500ms 500ms 1s
4 1s 1s 1s 1s
5 4s 4s 4s 4s
6 8s 8s 8s 8s
7 16s 16s 16s 16s
int | conv: The conversion cycle time bit to set |
Allowable conv values are 0-7
True
if successful, otherwise False
def qwiic_tmp117.QwiicTMP117.set_high_limit | ( | self, | |
highLimit | |||
) |
This function allows the user to set the high limit register to whatever specified value, as long as in the range for the temperature sensor.
This function can be used as a threshold for Therm mode and or Alert mode
float | highLimit: The high limit temperature in degrees celsius |
def qwiic_tmp117.QwiicTMP117.set_low_limit | ( | self, | |
lowLimit | |||
) |
This function allows the user to set the low limit register to whatever specified value, as long as in the range for the temperature sensor.
This function can be used as a threshold for Therm mode and or Alert mode.
float | lowLimit: The low limit temperature in degrees celsius |
def qwiic_tmp117.QwiicTMP117.set_one_shot_mode | ( | self | ) |
This function sets the conversion mode of the sensor to be in one shot mode.
The TMP117 defaults to Continuous Conversion Mode on reset.
def qwiic_tmp117.QwiicTMP117.set_shutdown_mode | ( | self | ) |
This function sets the conversion mode of the sensor to be in shutdown mode.
The TMP117 defaults to Continuous Conversion Mode on reset.
def qwiic_tmp117.QwiicTMP117.set_temperature_offset | ( | self, | |
offset | |||
) |
This function sets the temperature offset value on the device.
float | offset: The offset value to set |
def qwiic_tmp117.QwiicTMP117.soft_reset | ( | self | ) |
This function performs a software reset, loading all the default values into the configuration register.
def qwiic_tmp117.QwiicTMP117.write_register | ( | self, | |
register, | |||
value | |||
) |
Writes a value to a register on the device.
int | register: The register to write to |
int | value: The 16-bit value to write to the register |
Used because the device expects bytes as big-endian
qwiic_tmp117.QwiicTMP117.address |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |