Loading...
Searching...
No Matches
BH1900NUX Temperature sensor

Driver for the Rohm BH1900NUX Temperature sensor. More...

Detailed Description

Driver for the Rohm BH1900NUX Temperature sensor.

Files

file  bh1900nux_params.h
 Default configuration for BH1900NUX devices.
 
file  bh1900nux.h
 Interface definition for the BH1900NUX temperature sensor.
 

Data Structures

struct  bh1900nux_t
 Device descriptor for BH1900NUX devices. More...
 
struct  bh1900nux_params_t
 Set of configuration parameters for BH1900NUX devices. More...
 

Macros

#define BH1900NUX_DEFAULT_ADDR   BH1900NUX_ADDR_1
 Default address of BH1900NUX sensors.
 
#define BH1900NUX_I2C_MAX_CLK   I2C_SPEED_FAST
 Maximum I2C bus speed to use with the device.
 

Enumerations

enum  { BH1900NUX_OK = 0 , BH1900NUX_ERR_I2C = -1 }
 Status and error return codes. More...
 

Functions

int bh1900nux_init (bh1900nux_t *dev, const bh1900nux_params_t *params)
 Initialize the given BH1900NUX device.
 
int bh1900nux_read (const bh1900nux_t *dev, int16_t *temp)
 Read the temperature measerd by the device [MILICELSIUS].
 

Possible I2C bus addresses of the device

The actual address of the device depends on the states of the slave address pins.

#define BH1900NUX_ADDR_1   (0x48)
 A2:L A1:L A0:L.
 
#define BH1900NUX_ADDR_2   (0x49)
 A2:L A1:L A0:H.
 
#define BH1900NUX_ADDR_3   (0x4a)
 A2:L A1:H A0:L.
 
#define BH1900NUX_ADDR_4   (0x4b)
 A2:L A1:H A0:H.
 
#define BH1900NUX_ADDR_5   (0x4c)
 A2:H A1:L A0:L.
 
#define BH1900NUX_ADDR_6   (0x4d)
 A2:H A1:L A0:H.
 
#define BH1900NUX_ADDR_7   (0x4e)
 A2:H A1:H A0:L.
 
#define BH1900NUX_ADDR_8   (0x4f)
 A2:H A1:H A0:H.
 

Temperature register address

Address of the temperature resister

#define BH1900NUX_REG_ADDR   (0x00)
 

Macro Definition Documentation

◆ BH1900NUX_ADDR_1

#define BH1900NUX_ADDR_1   (0x48)

A2:L A1:L A0:L.

Definition at line 36 of file bh1900nux.h.

◆ BH1900NUX_ADDR_2

#define BH1900NUX_ADDR_2   (0x49)

A2:L A1:L A0:H.

Definition at line 37 of file bh1900nux.h.

◆ BH1900NUX_ADDR_3

#define BH1900NUX_ADDR_3   (0x4a)

A2:L A1:H A0:L.

Definition at line 38 of file bh1900nux.h.

◆ BH1900NUX_ADDR_4

#define BH1900NUX_ADDR_4   (0x4b)

A2:L A1:H A0:H.

Definition at line 39 of file bh1900nux.h.

◆ BH1900NUX_ADDR_5

#define BH1900NUX_ADDR_5   (0x4c)

A2:H A1:L A0:L.

Definition at line 40 of file bh1900nux.h.

◆ BH1900NUX_ADDR_6

#define BH1900NUX_ADDR_6   (0x4d)

A2:H A1:L A0:H.

Definition at line 41 of file bh1900nux.h.

◆ BH1900NUX_ADDR_7

#define BH1900NUX_ADDR_7   (0x4e)

A2:H A1:H A0:L.

Definition at line 42 of file bh1900nux.h.

◆ BH1900NUX_ADDR_8

#define BH1900NUX_ADDR_8   (0x4f)

A2:H A1:H A0:H.

Definition at line 43 of file bh1900nux.h.

◆ BH1900NUX_DEFAULT_ADDR

#define BH1900NUX_DEFAULT_ADDR   BH1900NUX_ADDR_1

Default address of BH1900NUX sensors.

Definition at line 58 of file bh1900nux.h.

◆ BH1900NUX_I2C_MAX_CLK

#define BH1900NUX_I2C_MAX_CLK   I2C_SPEED_FAST

Maximum I2C bus speed to use with the device.

Definition at line 63 of file bh1900nux.h.

◆ BH1900NUX_REG_ADDR

#define BH1900NUX_REG_ADDR   (0x00)

Definition at line 52 of file bh1900nux.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Status and error return codes.

Enumerator
BH1900NUX_OK 

everything was fine

BH1900NUX_ERR_I2C 

error initializing the I2C bus

Definition at line 68 of file bh1900nux.h.

Function Documentation

◆ bh1900nux_init()

int bh1900nux_init ( bh1900nux_t dev,
const bh1900nux_params_t params 
)

Initialize the given BH1900NUX device.

Parameters
[out]devdevice descriptor of the targeted device
[in]paramsdevice configuration (i2c bus, address and bus clock)
Returns
0 on success
-1 if unable to speak to the device

◆ bh1900nux_read()

int bh1900nux_read ( const bh1900nux_t dev,
int16_t *  temp 
)

Read the temperature measerd by the device [MILICELSIUS].

The result value is the measured temperature in MILICELSUIS and ranges from -30 to 95.

Parameters
[in]devdevice descriptor of the targeted device
[out]temptemperature output
Returns
BH1900NUX_OK on success
BH1900NUX_ERR_I2C on failure