![]() |
Qwiic_MCP9600_Py
2.0.0-1-gc0a27b2
Python for SFE Qwiic MCP9600
|
Public Member Functions | |
def | __init__ (self, address=None, i2c_driver=None) |
Constructor. More... | |
def | available (self) |
Returns true if the thermocouple (hot) junction temperature has been updated since we last checked. More... | |
def | is_connected (self) |
Determines if this device is connected. More... | |
def | begin (self) |
Initializes this device with default parameters. More... | |
def | check_device_id (self) |
Returns true if the constant upper 8 bits in the device ID register are what they should be according to the datasheet. More... | |
def | read_block_retry (self, register, num_bytes) |
Attempt to read the register until we exit with no error code This attempts to fix the bug where clock stretching sometimes failes, as described in the MCP9600 eratta. More... | |
def | write_double_register (self, register, value) |
Writes a 16-bit value to a register. More... | |
def | reset_to_defaults (self) |
Resets all device parameters to their default values. More... | |
def | get_thermocouple_temp (self, units=True) |
Returns the thermocouple temperature, and clears the data ready bit. More... | |
def | get_ambient_temp (self, units=True) |
Returns the ambient (IC die) temperature. More... | |
def | get_temp_delta (self, units=True) |
Returns the difference in temperature between the thermocouple and ambient junctions. More... | |
def | get_raw_adc (self) |
Returns the raw contents of the raw ADC register. More... | |
def | is_input_range_exceeded (self) |
Returns true if the input range has been exceeded. More... | |
def | set_ambient_resolution (self, res) |
Changes the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. More... | |
def | get_ambient_resolution (self) |
Returns the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. More... | |
def | set_thermocouple_resolution (self, res) |
Changes the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution. More... | |
def | get_thermocouple_resolution (self) |
Returns the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution. More... | |
def | set_thermocouple_type (self, type) |
Changes the type of thermocouple connected to the MCP9600. More... | |
def | get_thermocouple_type (self) |
Returns the type of thermocouple connected to the MCP9600 as found in its configuration register. More... | |
def | set_filter_coefficient (self, filter) |
Changes the weight of the on-chip exponential moving average filter. More... | |
def | get_filter_coefficient (self) |
Returns the weight of the on-chip exponential moving average filter. More... | |
def | set_burst_samples (self, samples) |
Changes the amount of samples to take in burst mode. More... | |
def | get_burst_samples (self) |
Returns the amount of samples to take in burst mode, according to the device's configuration register. More... | |
def | burst_available (self) |
Checks if burst mode data is available. More... | |
def | start_burst (self) |
Initiates a burst on the MCP9600. More... | |
def | set_shutdown_mode (self, mode) |
Changes the shutdown "operating" mode of the MCP9600. More... | |
def | get_shutdown_mode (self, mode) |
Returns the shutdown "operating" mode of the MCP9600. More... | |
def | config_alert_temp (self, number, temp) |
Configures the temperature at which to trigger the alert for a given alert number. More... | |
def | config_alert_junction (self, number, junction) |
Configures the junction to monitor the temperature of to trigger the alert. More... | |
def | config_alert_hysteresis (self, number, hysteresis) |
Configures the hysteresis to use around the temperature set point, in degrees Celsius. More... | |
def | config_alert_edge (self, number, edge) |
Configures whether to trigger the alert on the rising (cold -> hot) or falling (hot -> cold) edge of the temperature change. More... | |
def | config_alert_logic_level (self, number, level) |
Configures whether the hardware alert pin is active-high or active-low. More... | |
def | config_alert_mode (self, number, mode) |
Configures whether the MCP9600 treats the alert like a comparator or an interrrupt. More... | |
def | config_alert_enable (self, number, enable) |
Configures whether or not the interrupt is enabled or not. More... | |
def | clear_alert_pin (self, number) |
Clears the interrupt on the specified alert channel, resetting the value of the pin. More... | |
def | is_temp_greater_than_limit (self, number) |
Returns true if the interrupt has been triggered, false otherwise. More... | |
Public Attributes | |
address | |
Properties | |
connected = property(is_connected) | |
def qwiic_mcp9600.QwiicMCP9600.__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_mcp9600.QwiicMCP9600.available | ( | self | ) |
Returns true if the thermocouple (hot) junction temperature has been updated since we last checked.
Also referred to as the data ready bit.
True
if the data is ready, otherwise False
def qwiic_mcp9600.QwiicMCP9600.begin | ( | self | ) |
Initializes this device with default parameters.
True
if successful, otherwise False
From Arduino Lib: The MCP9600 is a fussy device. If we call isConnected twice in succession, the second call fails as the MCP9600 does not ACK on the second call. Only on the first. So we should not call is_connected here(). We should only call check_device_id().
def qwiic_mcp9600.QwiicMCP9600.burst_available | ( | self | ) |
Checks if burst mode data is available.
True
if all the burst samples have been taken and the results are ready. Returns False
otherwise. def qwiic_mcp9600.QwiicMCP9600.check_device_id | ( | self | ) |
Returns true if the constant upper 8 bits in the device ID register are what they should be according to the datasheet.
True
if the device ID is correct, otherwise False
def qwiic_mcp9600.QwiicMCP9600.clear_alert_pin | ( | self, | |
number | |||
) |
Clears the interrupt on the specified alert channel, resetting the value of the pin.
int | number: The alert number (1-4) |
True
if the alert pin was cleared successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_edge | ( | self, | |
number, | |||
edge | |||
) |
Configures whether to trigger the alert on the rising (cold -> hot) or falling (hot -> cold) edge of the temperature change.
Set to True for rising, False for falling.
int | number: The alert number (1-4) |
bool | edge: The edge to trigger the alert on |
True
if the edge was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_enable | ( | self, | |
number, | |||
enable | |||
) |
Configures whether or not the interrupt is enabled or not.
Set to True to enable, or False to disable.
int | number: The alert number (1-4) |
bool | enable: Set to True to enable the alert, False to disable |
True
if the alert was enabled/disabled successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_hysteresis | ( | self, | |
number, | |||
hysteresis | |||
) |
Configures the hysteresis to use around the temperature set point, in degrees Celsius.
int | number: The alert number (1-4) |
float | hysteresis: The hysteresis value to set |
True
if the hysteresis was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_junction | ( | self, | |
number, | |||
junction | |||
) |
Configures the junction to monitor the temperature of to trigger the alert.
Set to fALSE for the thermocouple (hot) junction, or True for the ambient (cold) junction.
int | number: The alert number (1-4) |
bool | junction: The junction to monitor False for the hot junction, True for the cold junction |
True
if the junction was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_logic_level | ( | self, | |
number, | |||
level | |||
) |
Configures whether the hardware alert pin is active-high or active-low.
Set to True for active-high, False for active-low.
int | number: The alert number (1-4) |
bool | level: The logic level to set |
True
if the logic level was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_mode | ( | self, | |
number, | |||
mode | |||
) |
Configures whether the MCP9600 treats the alert like a comparator or an interrrupt.
Set to True for interrupt, False for comparator. More information is on pg. 34 of the datasheet.
int | number: The alert number (1-4) |
bool | mode: The mode to set the alert to |
True
if the alert mode was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.config_alert_temp | ( | self, | |
number, | |||
temp | |||
) |
Configures the temperature at which to trigger the alert for a given alert number.
int | number: The alert number (1-4) |
float | temp: The temperature at which to trigger the alert |
True
if the alert temperature was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.get_ambient_resolution | ( | self | ) |
Returns the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution.
Lower resolution reduces conversion time.
def qwiic_mcp9600.QwiicMCP9600.get_ambient_temp | ( | self, | |
units = True |
|||
) |
Returns the ambient (IC die) temperature.
Set units to true for Celsius, or false for Fahrenheit.
bool,optional | units: The units to use for the temperature as specified above |
def qwiic_mcp9600.QwiicMCP9600.get_burst_samples | ( | self | ) |
Returns the amount of samples to take in burst mode, according to the device's configuration register.
Possible return values: kBurstSample1 kBurstSample2 kBurstSample4 kBurstSample8 kBurstSample16 kBurstSample32 kBurstSample64 kBurstSample128
def qwiic_mcp9600.QwiicMCP9600.get_filter_coefficient | ( | self | ) |
Returns the weight of the on-chip exponential moving average filter.
def qwiic_mcp9600.QwiicMCP9600.get_raw_adc | ( | self | ) |
Returns the raw contents of the raw ADC register.
def qwiic_mcp9600.QwiicMCP9600.get_shutdown_mode | ( | self, | |
mode | |||
) |
Returns the shutdown "operating" mode of the MCP9600.
Configurable to Normal, Shutdown, and Burst.
Possible return values: kShutdownModeNormal kShutdownModeShutdown kShutdownModeBurst
def qwiic_mcp9600.QwiicMCP9600.get_temp_delta | ( | self, | |
units = True |
|||
) |
Returns the difference in temperature between the thermocouple and ambient junctions.
Set units to true for Celsius, or false for Fahrenheit.
bool,optional | units: The units to use for the temperature as specified above |
def qwiic_mcp9600.QwiicMCP9600.get_thermocouple_resolution | ( | self | ) |
Returns the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution.
Lower resolution reduces conversion time.
Possible return values: kThermocoupleResolution18Bit kThermocoupleResolution16Bit kThermocoupleResolution14Bit kThermocoupleResolution12Bit
def qwiic_mcp9600.QwiicMCP9600.get_thermocouple_temp | ( | self, | |
units = True |
|||
) |
Returns the thermocouple temperature, and clears the data ready bit.
Set units to true for Celcius, or false for freedom units (Fahrenheit)
bool,optional | units: The units to use for the temperature as specified above |
def qwiic_mcp9600.QwiicMCP9600.get_thermocouple_type | ( | self | ) |
Returns the type of thermocouple connected to the MCP9600 as found in its configuration register.
Supported types are: kTypeK kTypeJ kTypeT kTypeN kTypeS kTypeE kTypeB kTypeR
def qwiic_mcp9600.QwiicMCP9600.is_connected | ( | self | ) |
Determines if this device is connected.
True
if connected, otherwise False
def qwiic_mcp9600.QwiicMCP9600.is_input_range_exceeded | ( | self | ) |
Returns true if the input range has been exceeded.
True
if the input range has been exceeded, otherwise False
def qwiic_mcp9600.QwiicMCP9600.is_temp_greater_than_limit | ( | self, | |
number | |||
) |
Returns true if the interrupt has been triggered, false otherwise.
int | number: The alert number (1-4) |
True
if the temperature is greater than the limit, otherwise False
def qwiic_mcp9600.QwiicMCP9600.read_block_retry | ( | self, | |
register, | |||
num_bytes | |||
) |
Attempt to read the register until we exit with no error code This attempts to fix the bug where clock stretching sometimes failes, as described in the MCP9600 eratta.
Maximum retries defined by kRetryAttempts.
int | register: The register to read |
int | num_bytes: The number of bytes to read |
def qwiic_mcp9600.QwiicMCP9600.reset_to_defaults | ( | self | ) |
Resets all device parameters to their default values.
def qwiic_mcp9600.QwiicMCP9600.set_ambient_resolution | ( | self, | |
res | |||
) |
Changes the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution.
Lower resolution reduces conversion time. Valid inputs are: kAmbientResolutionZeroPoint0625 kAmbientResolutionZeroPoint25
int | res: The resolution to use for the ambient sensor |
True
if the resolution was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.set_burst_samples | ( | self, | |
samples | |||
) |
Changes the amount of samples to take in burst mode.
int | samples: The number of samples to take in burst mode |
Available options are: kBurstSample1 kBurstSample2 kBurstSample4 kBurstSample8 kBurstSample16 kBurstSample32 kBurstSample64 kBurstSample128
True
if the burst samples were set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.set_filter_coefficient | ( | self, | |
filter | |||
) |
Changes the weight of the on-chip exponential moving average filter.
Set this to 0 for no filter, 1 for minimum filter, and 7 for maximum filter.
int | filter: The filter coefficient to use |
True
if the filter coefficient was set successfully, otherwise False
TODO: Arduino function for this looked a bit odd...it might need to be reworked
def qwiic_mcp9600.QwiicMCP9600.set_shutdown_mode | ( | self, | |
mode | |||
) |
Changes the shutdown "operating" mode of the MCP9600.
Configurable to Normal, Shutdown, and Burst.
int | mode: The mode to set the device to |
Available options are: kShutdownModeNormal kShutdownModeShutdown kShutdownModeBurst
True
if the mode was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.set_thermocouple_resolution | ( | self, | |
res | |||
) |
Changes the resolution on the hot (thermocouple) junction, for either 18, 16, 14, or 12-bit resolution.
Lower resolution reduces conversion time. Valid inputs are: kThermocoupleResolution18Bit kThermocoupleResolution16Bit kThermocoupleResolution14Bit kThermocoupleResolution12Bit
int | res: The resolution to use for the thermocouple sensor |
True
if the resolution was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.set_thermocouple_type | ( | self, | |
type | |||
) |
Changes the type of thermocouple connected to the MCP9600.
Supported types are: kTypeK kTypeJ kTypeT kTypeN kTypeS kTypeE kTypeB kTypeR
int | type: The type of thermocouple to use |
True
if the type was set successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.start_burst | ( | self | ) |
Initiates a burst on the MCP9600.
True
if the burst was started successfully, otherwise False
def qwiic_mcp9600.QwiicMCP9600.write_double_register | ( | self, | |
register, | |||
value | |||
) |
Writes a 16-bit value to a register.
int | register: The register to write to |
int | value: The value to write |
Necessary because we have to write with opposite endianness as write_word
qwiic_mcp9600.QwiicMCP9600.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 |
|
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 |