MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM > Class Template Reference

Template class for interfacing with DS18B20 temperature sensors. More...

#include <MiniR4_DS18B20.h>

Public Member Functions

 MiniR4DS18B20 ()
 
void setResolution (uint8_t res, uint8_t idx=0)
 Sets the resolution for a specific sensor.
 
void setResolutionAll (uint8_t res)
 Sets the resolution for all sensors on the line.
 
void setAddress (uint8_t *addr)
 Set the address of the sensor.
 
bool readAddress (uint8_t *addr)
 Reads the unique address of the sensor.
 
void requestTemp (uint8_t idx=0)
 Requests a temperature conversion from a specific sensor.
 
void requestTempAll ()
 Requests a temperature conversion from all sensors on the line.
 
float getTemp (uint8_t idx=0)
 Gets the temperature as a float from a specific sensor.
 
float requestAndGetTemp (uint8_t idx=0)
 Combines request and get temperature operations.
 
int16_t getTempInt (uint8_t idx=0)
 Gets the temperature as an integer from a specific sensor.
 
int16_t getRaw (uint8_t idx=0)
 Gets the raw temperature data from a specific sensor.
 
bool readTemp (uint8_t idx=0)
 Reads the temperature from a specific sensor.
 
bool online (uint8_t idx=0)
 Checks if the sensor is online.
 

Detailed Description

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
class MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >

Template class for interfacing with DS18B20 temperature sensors.

This class allows interfacing with DS18B20 sensors using the 1-Wire protocol. It supports multiple sensors on the same line, addressable mode, and CRC checks.

Template Parameters
PIN1Unused pin (for future use).
PIN2The GPIO pin number where the sensor is connected.
DS_ADDRPointer to the sensor's address.
DS_AMNumber of sensors on the line.
DS_PGMIf true, addresses are stored in PROGMEM.

Definition at line 78 of file MiniR4_DS18B20.h.

Constructor & Destructor Documentation

◆ MiniR4DS18B20()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::MiniR4DS18B20 ( )
inline

Definition at line 81 of file MiniR4_DS18B20.h.

Member Function Documentation

◆ getRaw()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
int16_t MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::getRaw ( uint8_t idx = 0)
inline

Gets the raw temperature data from a specific sensor.

Parameters
idxIndex of the sensor (default: 0).
Returns
Raw temperature data.

Definition at line 192 of file MiniR4_DS18B20.h.

◆ getTemp()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
float MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::getTemp ( uint8_t idx = 0)
inline

Gets the temperature as a float from a specific sensor.

Parameters
idxIndex of the sensor (default: 0).
Returns
Temperature in Celsius as a float.

Definition at line 160 of file MiniR4_DS18B20.h.

◆ getTempInt()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
int16_t MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::getTempInt ( uint8_t idx = 0)
inline

Gets the temperature as an integer from a specific sensor.

Parameters
idxIndex of the sensor (default: 0).
Returns
Temperature in Celsius as an integer.

Definition at line 182 of file MiniR4_DS18B20.h.

◆ online()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
bool MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::online ( uint8_t idx = 0)
inline

Checks if the sensor is online.

Parameters
idxIndex of the sensor (default: 0). THE LINE MUST BE PULLED UP
Returns
true if the sensor is online, false otherwise.

Definition at line 229 of file MiniR4_DS18B20.h.

◆ readAddress()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
bool MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::readAddress ( uint8_t * addr)
inline

Reads the unique address of the sensor.

Parameters
addrPointer to the array where the address will be stored.
Returns
true if the address was successfully read, false otherwise.

Definition at line 122 of file MiniR4_DS18B20.h.

◆ readTemp()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
bool MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::readTemp ( uint8_t idx = 0)
inline

Reads the temperature from a specific sensor.

Parameters
idxIndex of the sensor (default: 0).
Returns
true if the temperature was successfully read, false otherwise.

Definition at line 202 of file MiniR4_DS18B20.h.

◆ requestAndGetTemp()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
float MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::requestAndGetTemp ( uint8_t idx = 0)
inline

Combines request and get temperature operations.

Parameters
idxIndex of the sensor (default: 0).
Returns
Temperature in Celsius as a float.

Definition at line 170 of file MiniR4_DS18B20.h.

◆ requestTemp()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
void MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::requestTemp ( uint8_t idx = 0)
inline

Requests a temperature conversion from a specific sensor.

Parameters
idxIndex of the sensor (default: 0).

Definition at line 141 of file MiniR4_DS18B20.h.

◆ requestTempAll()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
void MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::requestTempAll ( )
inline

Requests a temperature conversion from all sensors on the line.

Definition at line 151 of file MiniR4_DS18B20.h.

◆ setAddress()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
void MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::setAddress ( uint8_t * addr)
inline

Set the address of the sensor.

Parameters
addrPointer to the sensor's address.

Definition at line 113 of file MiniR4_DS18B20.h.

◆ setResolution()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
void MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::setResolution ( uint8_t res,
uint8_t idx = 0 )
inline

Sets the resolution for a specific sensor.

Parameters
resResolution in bits (9-12).
idxIndex of the sensor (default: 0).

Definition at line 92 of file MiniR4_DS18B20.h.

◆ setResolutionAll()

template<uint8_t PIN1, uint8_t PIN2, uint8_t * DS_ADDR = (uint8_t * ) nullptr, uint8_t DS_AM = 1, bool DS_PGM = 0>
void MiniR4DS18B20< PIN1, PIN2, DS_ADDR, DS_AM, DS_PGM >::setResolutionAll ( uint8_t res)
inline

Sets the resolution for all sensors on the line.

Parameters
resResolution in bits (9-12).

Definition at line 105 of file MiniR4_DS18B20.h.


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