Skip to content

File syn_climate.h

FileList > sensor > syn_climate.h

Go to the source code of this file

Generic Climate & Environmental Sensor Driver (SHT3x, BME280, HTU21D, DHT22).

  • #include "../common/syn_defs.h"
  • #include "../drivers/syn_soft_i2c.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_Climate
Generic Climate Sensor Context.

Public Types

Type Name
enum SYN_ClimateType
Climate Sensor Type.

Public Functions

Type Name
void syn_climate_feed_sample (SYN_Climate * sensor, float temp_c, float humidity_rh, float press_hpa)
Feed raw sensor readings (temperature, humidity, pressure).
float syn_climate_get_dew_point (const SYN_Climate * sensor)
Get calculated dew point in Celsius.
float syn_climate_get_humidity (const SYN_Climate * sensor)
Get relative humidity %.
float syn_climate_get_temp_c (const SYN_Climate * sensor)
Get temperature in Celsius.
float syn_climate_get_temp_f (const SYN_Climate * sensor)
Get temperature in Fahrenheit.
SYN_Status syn_climate_init (SYN_Climate * sensor, SYN_GPIO_Pin scl, SYN_GPIO_Pin sda, uint8_t i2c_addr, SYN_ClimateType type)
Initialize Climate Sensor.

Public Types Documentation

enum SYN_ClimateType

Climate Sensor Type.

enum SYN_ClimateType {
    SYN_CLIMATE_SHT3X = 0,
    SYN_CLIMATE_BME280 = 1,
    SYN_CLIMATE_HTU21D = 2
};


Public Functions Documentation

function syn_climate_feed_sample

Feed raw sensor readings (temperature, humidity, pressure).

void syn_climate_feed_sample (
    SYN_Climate * sensor,
    float temp_c,
    float humidity_rh,
    float press_hpa
) 

Parameters:

  • sensor Climate sensor context.
  • temp_c Temperature in Celsius.
  • humidity_rh Relative humidity percentage (0 to 100%).
  • press_hpa Barometric pressure in hPa (e.g. 1013.25f).

function syn_climate_get_dew_point

Get calculated dew point in Celsius.

float syn_climate_get_dew_point (
    const SYN_Climate * sensor
) 

Parameters:

  • sensor Climate sensor context.

Returns:

Dew point in °C.


function syn_climate_get_humidity

Get relative humidity %.

float syn_climate_get_humidity (
    const SYN_Climate * sensor
) 

Parameters:

  • sensor Climate sensor context.

Returns:

Humidity RH.


function syn_climate_get_temp_c

Get temperature in Celsius.

float syn_climate_get_temp_c (
    const SYN_Climate * sensor
) 

Parameters:

  • sensor Climate sensor context.

Returns:

Temperature in °C.


function syn_climate_get_temp_f

Get temperature in Fahrenheit.

float syn_climate_get_temp_f (
    const SYN_Climate * sensor
) 

Parameters:

  • sensor Climate sensor context.

Returns:

Temperature in °F.


function syn_climate_init

Initialize Climate Sensor.

SYN_Status syn_climate_init (
    SYN_Climate * sensor,
    SYN_GPIO_Pin scl,
    SYN_GPIO_Pin sda,
    uint8_t i2c_addr,
    SYN_ClimateType type
) 

Parameters:

  • sensor Climate sensor context.
  • scl I2C SCL GPIO pin.
  • sda I2C SDA GPIO pin.
  • i2c_addr I2C slave address (e.g. 0x44 or 0x76).
  • type Sensor type (SHT3X, BME280, HTU21D).

Returns:

SYN_OK on success.



The documentation for this class was generated from the following file src/syntropic/sensor/syn_climate.h