Loading...
Searching...
No Matches

Device driver implementation for the SHT2x humidity and temperature humidity sensor. More...

Detailed Description

Device driver implementation for the SHT2x humidity and temperature humidity sensor.

Author
Kees Bakker kees@.nosp@m.soda.nosp@m.q.com
George Psimenos gp7g1.nosp@m.4@so.nosp@m.ton.a.nosp@m.c.uk
Steffen Robertz steff.nosp@m.en.r.nosp@m.obert.nosp@m.z@rw.nosp@m.th-aa.nosp@m.chen.nosp@m..de

Definition in file sht2x.h.

#include <stdint.h>
#include <stdbool.h>
#include "periph/i2c.h"
+ Include dependency graph for sht2x.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sht2x_params_t
 Device initialization parameters. More...
 
struct  sht2x_t
 Device descriptor for the SHT2X sensor. More...
 

Enumerations

enum  {
  SHT2X_OK = 0 , SHT2X_ERR_I2C = -1 , SHT2X_ERR_NODEV = -2 , SHT2X_ERR_NOCAL = -3 ,
  SHT2X_ERR_I2C_READ = -4 , SHT2X_ERR_TIMEDOUT = -5 , SHT2X_ERR_CRC = -6 , SHT2X_ERR_USERREG = -7 ,
  SHT2X_ERR_RES = -8 , SHT2X_ERR_OTHER = -999
}
 Status and error return codes. More...
 
enum  sht2x_res_t { SHT2X_RES_12_14BIT = 0x00 , SHT2X_RES_8_12BIT = 0x01 , SHT2X_RES_10_13BIT = 0x80 , SHT2X_RES_11_11BIT = 0x81 }
 Available resolutions. More...
 
enum  sht2x_measure_mode_t { SHT2X_MEASURE_MODE_HOLD = 0 , SHT2X_MEASURE_MODE_NO_HOLD = 1 }
 Available Measuring modes. More...
 

Functions

int sht2x_init (sht2x_t *dev, const sht2x_params_t *params)
 Initialize the given SHT2X device.
 
int sht2x_reset (sht2x_t *dev)
 Reset the SHT2X device.
 
int16_t sht2x_read_temperature (const sht2x_t *dev)
 Read temperature value from the given SHT2X device, returned in centi °C.
 
uint16_t sht2x_read_humidity (const sht2x_t *dev)
 Read humidity value from the given SHT2X device, returned in centi RH.
 
int sht2x_read_ident (const sht2x_t *dev, uint8_t *buffer, size_t buflen)
 Read identification code from the given SHT2X device.
 
int sht2x_read_userreg (const sht2x_t *dev, uint8_t *userreg)
 Read User Register from the given SHT2X device.
 
int sht2x_write_userreg (const sht2x_t *dev, uint8_t userreg)
 Write User Register to the given SHT2X device.
 
#define SHT2X_USER_RESOLUTION_MASK   0x81
 User register masks.
 
#define SHT2X_USER_EOB_MASK   0x40
 
#define SHT2X_USER_HEATER_MASK   0x04
 
#define SHT2X_USER_RESERVED_MASK   0x38
 
#define SHT2X_USER_OTP_MASK   0x02