Adafruit MAX31850 DallasTemp Library
Public Member Functions | Static Public Member Functions | List of all members
DallasTemperature Class Reference

DallasTemperature class. More...

#include <DallasTemperature.h>

Public Member Functions

 DallasTemperature (OneWire *)
 DallasTemp constructor.
 
void begin (void)
 initalise the bus
 
uint8_t getDeviceCount (void)
 returns the number of devices found on the bus More...
 
bool isConversionComplete (void)
 Checks if a conversion is complete on the wire. More...
 
bool validAddress (uint8_t *)
 returns true if address is valid More...
 
bool getAddress (uint8_t *, const uint8_t)
 finds an address at a given index on the bus More...
 
bool isConnected (uint8_t *)
 attempt to determine if the device at the given address is connected to the bus More...
 
bool isConnected (uint8_t *, uint8_t *)
 attempt to determine if the device at the given address is connected to the bus also allows for updating the read scratchpad More...
 
void readScratchPad (uint8_t *, uint8_t *)
 read device's scratchpad More...
 
void writeScratchPad (uint8_t *, const uint8_t *)
 write device's scratchpad More...
 
bool readPowerSupply (uint8_t *)
 read device's power requirements More...
 
uint8_t getResolution ()
 gets global resolution More...
 
void setResolution (uint8_t)
 set global resolution to 9, 10, 11, or 12 bits More...
 
uint8_t getResolution (uint8_t *)
 Returns the device resolution, 9-12. More...
 
bool setResolution (uint8_t *, uint8_t)
 set resolution of a device to 9, 10, 11, or 12 bits More...
 
void setWaitForConversion (bool)
 sets the waitForConversion flag More...
 
bool getWaitForConversion (void)
 gets the value of the waitForConversion flag More...
 
void setCheckForConversion (bool)
 sets the checkForConversion flag More...
 
bool getCheckForConversion (void)
 gets the value of the checkForConversion flag More...
 
void requestTemperatures (void)
 sends command for all devices on the bus to perform a temperature conversion
 
bool requestTemperaturesByAddress (uint8_t *)
 sends command for one device to perform a temperature conversion by address More...
 
bool requestTemperaturesByIndex (uint8_t)
 sends command for one device to perform a temperature conversion by index More...
 
float getTempC (uint8_t *)
 returns temperature in degrees C or DEVICE_DISCONNECTED if the device's scratch pad cannot be read successfully. the numeric value of DEVICE_DISCONNECTED is defined in DallasTemperature.h. It is a large negative number outside the operating range of the device More...
 
float getTempF (uint8_t *)
 returns temperature in degrees F More...
 
float getTempCByIndex (uint8_t)
 Get temperature for device index (slow) More...
 
float getTempFByIndex (uint8_t)
 Get temperature for device index (slow) More...
 
bool isParasitePowerMode (void)
 returns true if the bus requires parasite power More...
 
bool isConversionAvailable (uint8_t *)
 Checks if the clock has been raised indicating the conversion is complete. More...
 

Static Public Member Functions

static float toFahrenheit (const float)
 convert float celsius to farenheit More...
 
static float toCelsius (const float)
 convert float farenheit to celsius More...
 

Detailed Description

DallasTemperature class.

Member Function Documentation

◆ getDeviceCount()

uint8_t DallasTemperature::getDeviceCount ( void  )

returns the number of devices found on the bus

Returns
Returns the number of devices found on the bus

◆ isConversionComplete()

bool DallasTemperature::isConversionComplete ( void  )

Checks if a conversion is complete on the wire.

Returns
Returns whether the conversion is complete

◆ validAddress()

bool DallasTemperature::validAddress ( uint8_t *  deviceAddress)

returns true if address is valid

Parameters
deviceAddressAddress to determine the validity
Returns
Returns true if address is valid

◆ getAddress()

bool DallasTemperature::getAddress ( uint8_t *  deviceAddress,
const uint8_t  index 
)

finds an address at a given index on the bus

Parameters
deviceAddressDevice address to search for
indexWhere on the index to search
Returns
Returns true if the device was found

◆ isConnected() [1/2]

bool DallasTemperature::isConnected ( uint8_t *  deviceAddress)

attempt to determine if the device at the given address is connected to the bus

Parameters
deviceAddressAddress to search for
Returns
Returns true if the device is connected

◆ isConnected() [2/2]

bool DallasTemperature::isConnected ( uint8_t *  deviceAddress,
uint8_t *  scratchPad 
)

attempt to determine if the device at the given address is connected to the bus also allows for updating the read scratchpad

Parameters
deviceAddressAddress to check the connection
scratchPadscratchPad to update
Returns
Returns true if connected

◆ readScratchPad()

void DallasTemperature::readScratchPad ( uint8_t *  deviceAddress,
uint8_t *  scratchPad 
)

read device's scratchpad

Parameters
deviceAddressAddress to read the scratchpad of
scratchPadScratch pad to read from

◆ writeScratchPad()

void DallasTemperature::writeScratchPad ( uint8_t *  deviceAddress,
const uint8_t *  scratchPad 
)

write device's scratchpad

Parameters
deviceAddressAddress of the device to write to
scratchPadScratch pad to write to

◆ readPowerSupply()

bool DallasTemperature::readPowerSupply ( uint8_t *  deviceAddress)

read device's power requirements

Parameters
deviceAddressAddress of the device to read from
Returns
Returns True if the device has power requirements

◆ getResolution() [1/2]

uint8_t DallasTemperature::getResolution ( )

gets global resolution

Returns
Returns the global resolution

◆ setResolution() [1/2]

void DallasTemperature::setResolution ( uint8_t  newResolution)

set global resolution to 9, 10, 11, or 12 bits

Parameters
newResolutionResolution to set to

◆ getResolution() [2/2]

uint8_t DallasTemperature::getResolution ( uint8_t *  deviceAddress)

Returns the device resolution, 9-12.

Parameters
deviceAddressDevice to get the resolution of
Returns
Returns the device resolution, 9-12

◆ setResolution() [2/2]

bool DallasTemperature::setResolution ( uint8_t *  deviceAddress,
uint8_t  newResolution 
)

set resolution of a device to 9, 10, 11, or 12 bits

Parameters
deviceAddressAddress of device to set the resolution of
newResolutionResolution to set
Returns
Returns True if successful

◆ setWaitForConversion()

void DallasTemperature::setWaitForConversion ( bool  flag)

sets the waitForConversion flag

Parameters
flagWhat value to set the waitForConversion flag to

◆ getWaitForConversion()

bool DallasTemperature::getWaitForConversion ( void  )

gets the value of the waitForConversion flag

Returns
Returns the value of the waitForConversion flag

◆ setCheckForConversion()

void DallasTemperature::setCheckForConversion ( bool  flag)

sets the checkForConversion flag

Parameters
flagWhat value to set the checkForConversion flag to

◆ getCheckForConversion()

bool DallasTemperature::getCheckForConversion ( void  )

gets the value of the checkForConversion flag

Returns
Returns the value of the checkForConversion flag

◆ requestTemperaturesByAddress()

bool DallasTemperature::requestTemperaturesByAddress ( uint8_t *  deviceAddress)

sends command for one device to perform a temperature conversion by address

Parameters
deviceAddressAddress of the desired device
Returns
Returns FALSE if device is disconnected. Otherwise returns TRUE

◆ requestTemperaturesByIndex()

bool DallasTemperature::requestTemperaturesByIndex ( uint8_t  deviceIndex)

sends command for one device to perform a temperature conversion by index

Parameters
deviceIndexIndex of the device to send the command to
Returns
Returns FALSE if device is disconnected. Otherwise returns TRUE

◆ getTempC()

float DallasTemperature::getTempC ( uint8_t *  deviceAddress)

returns temperature in degrees C or DEVICE_DISCONNECTED if the device's scratch pad cannot be read successfully. the numeric value of DEVICE_DISCONNECTED is defined in DallasTemperature.h. It is a large negative number outside the operating range of the device

Parameters
deviceAddressAddress of the device to get the temperature from
Returns
Returns DEVICE_DISCONNECTED if device is disconnected. Otherwise returns the temperature

◆ getTempF()

float DallasTemperature::getTempF ( uint8_t *  deviceAddress)

returns temperature in degrees F

Parameters
deviceAddressAddress of the device to get the temperature from
Returns
Returns DEVICE_DISCONNECTED if device is disconnected. Otherwise returns the temperature

◆ getTempCByIndex()

float DallasTemperature::getTempCByIndex ( uint8_t  deviceIndex)

Get temperature for device index (slow)

Parameters
deviceIndexIndex of the device
Returns
Returns DEVICE_DISCONNECTED if device is disconnected. Otherwise returns the temperature

◆ getTempFByIndex()

float DallasTemperature::getTempFByIndex ( uint8_t  deviceIndex)

Get temperature for device index (slow)

Parameters
deviceIndexIndex of the device
Returns
Returns DEVICE_DISCONNECTED if device is disconnected. Otherwise returns the temperature

◆ isParasitePowerMode()

bool DallasTemperature::isParasitePowerMode ( void  )

returns true if the bus requires parasite power

Returns
returns true if the bus requires parasite power

◆ isConversionAvailable()

bool DallasTemperature::isConversionAvailable ( uint8_t *  deviceAddress)

Checks if the clock has been raised indicating the conversion is complete.

Parameters
deviceAddressAddress of the device to check
Returns
Returns True if conversion is available

◆ toFahrenheit()

float DallasTemperature::toFahrenheit ( const float  celsius)
static

convert float celsius to farenheit

Parameters
celsiusFloat of degrees celsius
Returns
Returns the degrees in fahrenheit

◆ toCelsius()

float DallasTemperature::toCelsius ( const float  fahrenheit)
static

convert float farenheit to celsius

Parameters
fahrenheitFloat of degrees fahrenheit
Returns
Returns the degrees in celsius

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