pht 2.0.0.0
pht.h File Reference

This file contains API for PHT Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  pht_t
 PHT Click context object. More...
 
struct  pht_cfg_t
 PHT Click configuration object. More...
 

Macros

#define PHT_RH_CMD_RESET   0xFE
 PHT Command for relative humidity.
 
#define PHT_RH_CMD_WRITE_USER_REG   0xE6
 
#define PHT_RH_CMD_READ_USER_REG   0xE7
 
#define PHT_RH_MEASURE_RH_HOLD   0xE5
 
#define PHT_RH_MEASURE_RH_NO_HOLD   0xF5
 
#define PHT_PT_CMD_RESET   0x1E
 PHT Command for pressure and temperature.
 
#define PHT_PT_CMD_ADC_READ   0x00
 
#define PHT_PT_CMD_PROM_READ_P_T_START   0xA0
 
#define PHT_PT_CMD_PROM_READ_P_T_END   0xAE
 
#define PHT_PT_CMD_RATIO_256   0x00
 
#define PHT_PT_CMD_RATIO_512   0x01
 
#define PHT_PT_CMD_RATIO_1024   0x02
 
#define PHT_PT_CMD_RATIO_2048   0x03
 
#define PHT_PT_CMD_RATIO_4096   0x04
 
#define PHT_PT_CMD_RATIO_8192   0x05
 
#define PHT_PT_MANUFACTURER_RESERVED   0x00
 PHT coefficient for pressure and temperature.
 
#define PHT_PT_C1_SENS   0x01
 
#define PHT_PT_C2_OFF   0x02
 
#define PHT_PT_C3_TCS   0x03
 
#define PHT_PT_C4_TCO   0x04
 
#define PHT_PT_C5_TREF   0x05
 
#define PHT_PT_C6_TEMPSENS   0x06
 
#define PHT_PT_CRC   0x07
 
#define PHT_SENSOR_TYPE_RH   0x00
 PHT Select output data.
 
#define PHT_SENSOR_TYPE_PT   0x01
 
#define PHT_I2C_SLAVE_ADDR_RH   0x40
 PHT device address setting.
 
#define PHT_I2C_SLAVE_ADDR_P_AND_T   0x76
 
#define PHT_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  pht_return_value_t { PHT_OK = 0 , PHT_ERROR = -1 }
 PHT Click return value data. More...
 

Functions

void pht_cfg_setup (pht_cfg_t *cfg)
 PHT configuration object setup function.
 
err_t pht_init (pht_t *ctx, pht_cfg_t *cfg)
 PHT initialization function.
 
err_t pht_generic_write (pht_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 PHT I2C writing function.
 
err_t pht_generic_read (pht_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 PHT I2C reading function.
 
void pht_set_command (pht_t *ctx, uint8_t sensor_type, uint8_t cmd)
 Set Command function.
 
void pht_soft_reset (pht_t *ctx, uint8_t sensor_type)
 Soft Reset function.
 
uint8_t pht_get_prom (pht_t *ctx, uint8_t sel_data, uint32_t *tx_data)
 Calibration Data Read function.
 
uint8_t pht_set_ratio (pht_t *ctx, uint8_t temp_ratio, uint8_t press_ratio)
 Set Ratio function.
 
void pht_reset (pht_t *ctx)
 Reset function.
 
void pht_write_user_register (pht_t *ctx, uint8_t tx_data)
 Write User Register function.
 
uint8_t pht_read_user_register (pht_t *ctx)
 Raed User Register function.
 
uint8_t pht_measure_rh (pht_t *ctx, uint16_t *rh_data)
 Measure RH function.
 
void pht_get_temperature_pressure (pht_t *ctx, float *temperature, float *pressure)
 Get temperature and pressure function.
 
void pht_get_relative_humidity (pht_t *ctx, float *humidity)
 Get humidity function.
 

Detailed Description

This file contains API for PHT Click Driver.

Enumeration Type Documentation

◆ pht_return_value_t

PHT Click return value data.

Predefined enum values for driver return values.

Enumerator
PHT_OK 
PHT_ERROR