sht 2.0.0.0
Public function

Functions

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

Detailed Description

Function Documentation

◆ sht_alert_status()

uint8_t sht_alert_status ( sht_t * ctx)

Alert Status.

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

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.

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.

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.
Returns
FALSE - last command executed successfully, TRUE - last command not processed

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

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.

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 )

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.
Returns
FALSE - heater off, TRUE - heater on

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 ( % )

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 ( % )

Returns humidity measurement in single shot mode.

◆ sht_hum_status()

uint8_t sht_hum_status ( sht_t * ctx)

Humidity Alert.

Parameters
ctxClick object.
Returns
FALSE - no alert, TRUE - alert

Returns does humididty tracking alert exists.

◆ sht_hw_reset()

void sht_hw_reset ( sht_t * ctx)

Resets device.

Parameters
ctxClick object.

Hardware reset of the device.

◆ sht_init()

err_t sht_init ( sht_t * ctx,
sht_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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.

Gets int_pin status.

◆ sht_reset()

void sht_reset ( sht_t * ctx)

Resets settings.

Parameters
ctxClick object.

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.
Returns
FALSE - no reset detected since last clear, TRUE - some kind of ( soft or hard ) reset detected

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.

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 )

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 )

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 )

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.

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.

Starts periodic measurement with current settings.

◆ sht_stop_pm()

void sht_stop_pm ( sht_t * ctx)

Stop Periodic Measurement.

Parameters
ctxClick object.

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 )

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 )

Returns temperature measurement in single shot mode.

◆ sht_temp_status()

uint8_t sht_temp_status ( sht_t * ctx)

Temperature Alert.

Parameters
ctxClick object.
Returns
FALSE - no_alert, TRUE - alert

Returns does temperature tracking alert exists.

◆ sht_wr_chksum_status()

uint8_t sht_wr_chksum_status ( sht_t * ctx)

Checksum Status.

Parameters
ctxClick object.
Returns
FALSE - checksum of last write was correct, TRUE - checksum of last write failed

Returns information about last cheksum