sht  2.0.0.0
Functions
Public function

Functions

void sht_cfg_setup (sht_cfg_t *cfg)
 Config Object Initialization function. More...
 
SHT_RETVAL sht_init (sht_t *ctx, sht_cfg_t *cfg)
 Initialization function. More...
 
void sht_generic_write (sht_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
void sht_generic_read (sht_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function. More...
 
void sht_reset (sht_t *ctx)
 Resets settings. More...
 
void sht_hw_reset (sht_t *ctx)
 Resets device. More...
 
uint8_t sht_int_get (sht_t *ctx)
 Int status. More...
 
void sht_rst_set (sht_t *ctx, uint8_t state)
 Int status. More...
 
void sht_set_clk_strecth (sht_t *ctx, uint8_t clk_stretching)
 Sets the clock stretching state. More...
 
void sht_set_repeats (sht_t *ctx, uint8_t repeatability)
 
void sht_set_mps (sht_t *ctx, uint8_t measure_per_second)
 Measurements per Second. More...
 
float sht_temp_ss (sht_t *ctx)
 Single Shot Temperature Measurement. More...
 
float sht_hum_ss (sht_t *ctx)
 Single Shot Humidity Measurement. More...
 
void sht_start_pm (sht_t *ctx)
 Start Periodic Measurement. More...
 
float sht_temp_pm (sht_t *ctx)
 Periodic Mode Temperature. More...
 
float sht_hum_pm (sht_t *ctx)
 Periodic Mode Humidity. More...
 
void sht_stop_pm (sht_t *ctx)
 Stop Periodic Measurement. More...
 
void sht_software_rst (sht_t *ctx)
 Software Reset. More...
 
void sht_heater_control (sht_t *ctx, uint8_t state)
 Heater State. More...
 
void sht_clear_status (sht_t *ctx)
 Clears Status Register. More...
 
uint8_t sht_alert_status (sht_t *ctx)
 Alert Status. More...
 
uint8_t sht_heater_status (sht_t *ctx)
 Heater State. More...
 
uint8_t sht_hum_status (sht_t *ctx)
 Humidity Alert. More...
 
uint8_t sht_temp_status (sht_t *ctx)
 Temperature Alert. More...
 
uint8_t sht_reset_status (sht_t *ctx)
 System Reset. More...
 
uint8_t sht_cmd_status (sht_t *ctx)
 Command Status. More...
 
uint8_t sht_wr_chksum_status (sht_t *ctx)
 Checksum Status. More...
 

Detailed Description

Function Documentation

◆ sht_alert_status()

uint8_t sht_alert_status ( sht_t ctx)

Alert Status.

Parameters
ctxClick object.
Return values
FALSE- no pending status
TRUE- at least one pending alert

@description Returns does device have pending status about any of posibile error.

◆ sht_cfg_setup()

void sht_cfg_setup ( sht_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ sht_clear_status()

void sht_clear_status ( sht_t ctx)

Clears Status Register.

Parameters
ctxClick object.

@description The status register contains informations about the operational status of the heater, the alert mode and on the execution status of the last command and the last write sequence.

◆ sht_cmd_status()

uint8_t sht_cmd_status ( sht_t ctx)

Command Status.

Parameters
ctxClick object.
Return values
<pre>FALSE - last command executed successfully TRUE - last command not processed

<br> description Returns information about last command execution.

◆ sht_generic_read()

void sht_generic_read ( sht_t ctx,
uint8_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ sht_generic_write()

void sht_generic_write ( sht_t ctx,
uint8_t  reg,
uint8_t *  data_buf,
uint8_t  len 
)

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ sht_heater_control()

void sht_heater_control ( sht_t ctx,
uint8_t  state 
)

Heater State.

Parameters
ctxClick object.
state( true / false )

@description Sets the heater state.

Note
By default heater is disabled.

◆ sht_heater_status()

uint8_t sht_heater_status ( sht_t ctx)

Heater State.

Parameters
ctxClick object.
Return values
FALSE- heater off
TRUE- heater on

@description Returns information about current heater state.

◆ sht_hum_pm()

float sht_hum_pm ( sht_t ctx)

Periodic Mode Humidity.

Parameters
ctxClick object.
Returns
Hunidity in ( % )

@description Returns humidity measurement in periodic mode.

Note
Before function call, periodic measurement must be started by calling sht_start_pm or communication error can occurrs.

◆ sht_hum_ss()

float sht_hum_ss ( sht_t ctx)

Single Shot Humidity Measurement.

Returns
Humidity in ( % )

@description Returns humidity measurement in single shot mode.

◆ sht_hum_status()

uint8_t sht_hum_status ( sht_t ctx)

Humidity Alert.

Parameters
ctxClick object.
Return values
FALSE- no alert
TRUE- alert

@description Returns does humididty tracking alert exists.

◆ sht_hw_reset()

void sht_hw_reset ( sht_t ctx)

Resets device.

Parameters
ctxClick object.

@description Hardware reset of the device.

◆ sht_init()

SHT_RETVAL sht_init ( sht_t ctx,
sht_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ sht_int_get()

uint8_t sht_int_get ( sht_t ctx)

Int status.

Parameters
ctxClick object.

@description Gets int_pin status.

◆ sht_reset()

void sht_reset ( sht_t ctx)

Resets settings.

Parameters
ctxClick object.

@description Calling of this function will reset all of the settings to defaults.

◆ sht_reset_status()

uint8_t sht_reset_status ( sht_t ctx)

System Reset.

Parameters
ctxClick object.
Return values
<pre>FALSE - no reset detected since last clear TRUE - some kind of ( soft or hard ) reset detected

@description Returns information does module detected any kind of reset during current power on time.

◆ sht_rst_set()

void sht_rst_set ( sht_t ctx,
uint8_t  state 
)

Int status.

Parameters
ctxClick object.
statePin state value.

@description sets rst pin to the desired value.

◆ sht_set_clk_strecth()

void sht_set_clk_strecth ( sht_t ctx,
uint8_t  clk_stretching 
)

Sets the clock stretching state.

Parameters
ctxClick object.
clk_stretching( true / false )

@description When a clock stretching is disabled, the sensor responds to a read header with a not acknowledge (NACK), if no data is present. Otherwise sensor responds to a read header with an ACK and subsequently pulls down the SCL line. The SCL line is pulled down until the measurement is complete. As soon as the measurement is complete, the sensor releases the SCL line and sends the measurement results. By default stretching is disabled after initialization.

Note
This setting have influence on measurmet in single shot mode.

◆ sht_set_mps()

void sht_set_mps ( sht_t ctx,
uint8_t  measure_per_second 
)

Measurements per Second.

Parameters
ctxClick object.
measure_per_second( MPS_05 / MPS_1 / MPS_2 / MPS_4 / MPS_10 )

@description Sets the measurement per second value used for periodic type of measurement.

   MPS_05 - 1 measurement on every 2 seconds
   MPS_1 - 1 measurement per second
   MPS_2 - 2 measurements per second
   MPS_4 - 4 measurements per second
   MPS_10 - 10 measurements per second
 
Note
Initialization sets the default value to MPS_1
Warning
At the highest mps setting self-heating of the sensor might occur.

◆ sht_set_repeats()

void sht_set_repeats ( sht_t ctx,
uint8_t  repeatability 
)

Sets the repeatability value

Parameters
ctxClick object.
repeatability( RPT_HIGH / RPT_MEDIUM / RPT_LOW )

@description Repeatability setting influences the measurement duration and thus the overall energy consumption of the sensor. RPT_MEDIUM is default value after initialization.

◆ sht_software_rst()

void sht_software_rst ( sht_t ctx)

Software Reset.

Parameters
ctxClick object.

@description Forces the device into a well-defined state without removing the power supply. This triggers the sensor to reset its system controller and reloads calibration data from the memory.

◆ sht_start_pm()

void sht_start_pm ( sht_t ctx)

Start Periodic Measurement.

Parameters
ctxClick object.

@description Starts periodic measurement with current settings.

◆ sht_stop_pm()

void sht_stop_pm ( sht_t ctx)

Stop Periodic Measurement.

Parameters
ctxClick object.

@description Stops periodic measurement instantly. This must be called before call of any other function except the periodic measurement read functions.

◆ sht_temp_pm()

float sht_temp_pm ( sht_t ctx)

Periodic Mode Temperature.

Parameters
ctxClick object.
Returns
Temperature in ( C )

@description Returns temperature measurement in periodic mode.

Note
Before function call, periodic measurement must be started by calling sht_start_pm or communication error can occurrs.

◆ sht_temp_ss()

float sht_temp_ss ( sht_t ctx)

Single Shot Temperature Measurement.

Parameters
ctxClick object.
Returns
Temperature in ( C )

@description Returns temperature measurement in single shot mode.

◆ sht_temp_status()

uint8_t sht_temp_status ( sht_t ctx)

Temperature Alert.

Parameters
ctxClick object.
Return values
<pre>FALSE - no_alert TRUE - alert

@description Returns does temperature tracking alert exists.

◆ sht_wr_chksum_status()

uint8_t sht_wr_chksum_status ( sht_t ctx)

Checksum Status.

Parameters
ctxClick object.
Return values
<pre>FALSE - checksum of last write was correct TRUE - checksum of last write failed

@description Returns information about last cheksum