TempSensor_NXP_Arduino 1.1.0
Temperature sensor device operation sample code for Arduino
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
LM75B Class Reference

#include <TempSensor.h>

Inheritance diagram for LM75B:
TempSensor P3T1755 PCT2075 P3T1035 P3T1085 P3T2030

Public Types

enum  reg_num { Temp , Conf , Thyst , Tos }
 
- Public Types inherited from TempSensor
enum  mode { COMPARATOR , INTERRUPT }
 

Public Member Functions

 LM75B (uint8_t i2c_address=(0x90 > > 1))
 
 LM75B (TwoWire &wire, uint8_t i2c_address=(0x90 > > 1))
 
virtual ~LM75B ()
 
virtual float temp (void) override
 
virtual void thresholds (float v0, float v1)
 
virtual void os_mode (mode flag)
 
virtual float read (void)
 
bool ping (void)
 
int reg_w (uint8_t reg_adr, const uint8_t *data, uint16_t size)
 
int reg_w (uint8_t reg_adr, uint8_t data)
 
int reg_r (uint8_t reg_adr, uint8_t *data, uint16_t size)
 
uint8_t reg_r (uint8_t reg_adr)
 
void write_r8 (uint8_t reg, uint8_t val)
 
void write_r16 (uint8_t reg, uint16_t val)
 
uint8_t read_r8 (uint8_t reg)
 
uint16_t read_r16 (uint8_t reg)
 
void bit_op8 (uint8_t reg, uint8_t mask, uint8_t value)
 
void bit_op16 (uint8_t reg, uint16_t mask, uint16_t value)
 
- Public Member Functions inherited from TempSensor
 TempSensor (uint8_t i2c_address)
 
 TempSensor (TwoWire &wire, uint8_t i2c_address)
 
virtual ~TempSensor ()
 

Detailed Description

LM75B class

About LM75B: https://www.nxp.com/products/sensors/i3c-ic-digital-temp-sensors/digital-temperature-sensor-and-thermal-watchdog:LM75B?_gl=1*kd25ib*_ga*NTA5NDE1NDA0LjE2NzgzNDYyNzA.*_ga_WM5LE0KMSH*MTY4MjEyMjc1OC42Mi4wLjE2ODIxMjI3NTguMC4wLjA.

Definition at line 59 of file TempSensor.h.

Member Enumeration Documentation

◆ reg_num

Name of the LM75B registers

Enumerator
Temp 

Temp register

Conf 

Conf register

Thyst 

Thyst register

Tos 

Tos registe

Definition at line 63 of file TempSensor.h.

Constructor & Destructor Documentation

◆ LM75B() [1/2]

LM75B::LM75B ( uint8_t i2c_address = (0x90 >> 1))

Create a LM75B instance connected to specified I2C pins with specified address

Parameters
i2c_addressI2C-bus address (default: (0x90>>1))

Definition at line 16 of file TempSensor.cpp.

◆ LM75B() [2/2]

LM75B::LM75B ( TwoWire & wire,
uint8_t i2c_address = (0x90 >> 1) )

Create a LM75B instance connected to specified I2C pins with specified address

Parameters
wireTwoWire instance
i2c_addressI2C-bus address (default: (0x90>>1))

Definition at line 17 of file TempSensor.cpp.

◆ ~LM75B()

LM75B::~LM75B ( )
virtual

Destructor of LM75B

Definition at line 18 of file TempSensor.cpp.

Member Function Documentation

◆ bit_op16()

void LM75B::bit_op16 ( uint8_t reg,
uint16_t mask,
uint16_t value )

◆ bit_op8()

void LM75B::bit_op8 ( uint8_t reg,
uint8_t mask,
uint8_t value )

Register overwriting with bit-mask

Register can be updated by bit level

Parameters
regregister index/address/pointer
maskbit-mask to protect overwriting
valuevalue to overwrite

Referenced by os_mode().

◆ os_mode()

void LM75B::os_mode ( mode flag)
virtual

Set OS operation mode

Parameters
flaguse LM75B::COMPARATOR or LM75B::INTERRUPT values

Reimplemented in PCT2075, P3T1755, P3T1035, P3T2030, and P3T1085.

Definition at line 34 of file TempSensor.cpp.

◆ ping()

bool LM75B::ping ( void )

Ping the device

Returns
true when ACK

◆ read()

virtual float LM75B::read ( void )
virtual

Get temperature value in degree Celsius [°C]

This method simply calls "temp()" method

Returns
temperature value in degree Celsius [°C]

Reimplemented from TempSensor.

Reimplemented in PCT2075, P3T1755, P3T1085, P3T1035, and P3T2030.

◆ read_r16()

uint16_t LM75B::read_r16 ( uint8_t reg)

Register read, 16 bit

This 16 bit access may ot be common but it's useful for sensor devices

Parameters
regregister index/address/pointer
Returns
data value

Referenced by temp().

◆ read_r8()

uint8_t LM75B::read_r8 ( uint8_t reg)

Register read, 8 bit

Parameters
regregister index/address/pointer
Returns
data value

◆ reg_r() [1/2]

uint8_t LM75B::reg_r ( uint8_t reg_adr)

Single register read

Parameters
regregister index/address/pointer
Returns
read data

◆ reg_r() [2/2]

int LM75B::reg_r ( uint8_t reg_adr,
uint8_t * data,
uint16_t size )

Multiple register read

Parameters
regregister index/address/pointer
datapointer to data buffer
sizedata size
Returns
transferred data size

◆ reg_w() [1/2]

int LM75B::reg_w ( uint8_t reg_adr,
const uint8_t * data,
uint16_t size )

Multiple register write

Parameters
regregister index/address/pointer
datapointer to data buffer
sizedata size
Returns
transferred data size

◆ reg_w() [2/2]

int LM75B::reg_w ( uint8_t reg_adr,
uint8_t data )

Single register write

Parameters
regregister index/address/pointer
datapointer to data buffer
sizedata size
Returns
transferred data size

◆ temp()

float LM75B::temp ( void )
overridevirtual

Get temperature value in degree Celsius [°C]

Returns
temperature value in degree Celsius [°C]

Implements TempSensor.

Reimplemented in PCT2075, P3T1755, P3T1085, P3T1035, and P3T2030.

Definition at line 20 of file TempSensor.cpp.

◆ thresholds()

void LM75B::thresholds ( float v0,
float v1 )
virtual

Set Overtemperature shutdown threshold (Tos) and hysteresis (Thyst) in degree Celsius [°C]

This method takes 2 values and higher value will set as the threshold (Tos) and another will be the hysteresis (Thyst)

Parameters
v0a value in degree Celsius
v1a value in degree Celsius

Reimplemented in PCT2075, P3T1085, P3T1755, P3T1035, and P3T2030.

Definition at line 25 of file TempSensor.cpp.

◆ write_r16()

void LM75B::write_r16 ( uint8_t reg,
uint16_t val )

Register write, 16 bit

This 16 bit access may ot be common but it's useful for sensor devices

Parameters
regregister index/address/pointer
valdata value

Referenced by thresholds().

◆ write_r8()

void LM75B::write_r8 ( uint8_t reg,
uint8_t val )

Register write, 8 bit

Parameters
regregister index/address/pointer
valdata value

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