M5Unit-ENV 1.2.0 git rev:d576302
Loading...
Searching...
No Matches
m5::unit::UnitSHT30 Class Reference

Temperature and humidity, sensor unit. More...

#include <unit_SHT30.hpp>

Inheritance diagram for m5::unit::UnitSHT30:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitSHT30 (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
virtual void update (const bool force=false) override
 
bool writeModeAccelerateResponseTime ()
 Write the mode to ART.
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Measurement data by periodic
float temperature () const
 Oldest measured temperature (Celsius)
 
float celsius () const
 Oldest measured temperature (Celsius)
 
float fahrenheit () const
 Oldest measured temperature (Fahrenheit)
 
float humidity () const
 Oldest measured humidity (RH)
 
Periodic measurement
bool startPeriodicMeasurement (const sht30::MPS mps, const sht30::Repeatability rep)
 Start periodic measurement.
 
bool stopPeriodicMeasurement ()
 Stop periodic measurement.
 
Single shot measurement
bool measureSingleshot (sht30::Data &d, const sht30::Repeatability rep=sht30::Repeatability::High, const bool stretch=true)
 Measurement single shot.
 
Reset
bool softReset ()
 Soft reset.
 
bool generalReset ()
 General reset.
 
Heater
bool startHeater ()
 Start heater.
 
bool stopHeater ()
 Stop heater.
 
Status
bool readStatus (sht30::Status &s)
 Read status.
 
bool clearStatus ()
 Clear status.
 
Serial number
bool readSerialNumber (uint32_t &serialNumber)
 Read the serial number value.
 
bool readSerialNumber (char *serialNumber)
 Read the serial number string.
 

Protected Member Functions

bool start_periodic_measurement (const sht30::MPS mps, const sht30::Repeatability rep)
 
bool stop_periodic_measurement ()
 
bool read_measurement (sht30::Data &d)
 
 M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (UnitSHT30, sht30::Data)
 

Protected Attributes

std::unique_ptr< m5::container::CircularBuffer< sht30::Data > > _data {}
 
config_t _cfg {}
 

Detailed Description

Temperature and humidity, sensor unit.

Member Function Documentation

◆ clearStatus()

bool m5::unit::UnitSHT30::clearStatus ( )

Clear status.

See also
sht30::Status
Returns
True if successful

◆ generalReset()

bool m5::unit::UnitSHT30::generalReset ( )

General reset.

Reset using I2C general call

Returns
True if successful
Warning
This is a reset by General command, the command is also sent to all devices with I2C connections

◆ measureSingleshot()

bool m5::unit::UnitSHT30::measureSingleshot ( sht30::Data & d,
const sht30::Repeatability rep = sht30::Repeatability::High,
const bool stretch = true )

Measurement single shot.

Parameters
[out]dataMeasuerd data
repRepeatability accuracy level
stretchEnable clock stretching if true
Returns
True if successful
Warning
During periodic detection runs, an error is returned
After sending a command to the sensor a minimal waiting time of 1ms is needed before another command can be received by the sensor

◆ readSerialNumber() [1/2]

bool m5::unit::UnitSHT30::readSerialNumber ( char * serialNumber)

Read the serial number string.

Parameters
[out]serialNumberOutput buffer
Returns
True if successful
Warning
serialNumber must be at least 9 bytes
During periodic detection runs, an error is returned

◆ readSerialNumber() [2/2]

bool m5::unit::UnitSHT30::readSerialNumber ( uint32_t & serialNumber)

Read the serial number value.

Parameters
[out]serialNumberserial number value
Returns
True if successful
Note
The serial number is 32 bit
Warning
During periodic detection runs, an error is returned

◆ readStatus()

bool m5::unit::UnitSHT30::readStatus ( sht30::Status & s)

Read status.

Parameters
[out]sStatus
Returns
True if successful

◆ softReset()

bool m5::unit::UnitSHT30::softReset ( )

Soft reset.

The sensor to reset its system controller and reloads calibration data from the memory.

Returns
True if successful
Warning
During periodic detection runs, an error is returned

◆ startHeater()

bool m5::unit::UnitSHT30::startHeater ( )

Start heater.

Returns
True if successful

◆ startPeriodicMeasurement()

bool m5::unit::UnitSHT30::startPeriodicMeasurement ( const sht30::MPS mps,
const sht30::Repeatability rep )
inline

Start periodic measurement.

Parameters
mpsMeasuring frequency
repRepeatability accuracy level
Returns
True if successful

◆ stopHeater()

bool m5::unit::UnitSHT30::stopHeater ( )

Stop heater.

Returns
True if successful

◆ stopPeriodicMeasurement()

bool m5::unit::UnitSHT30::stopPeriodicMeasurement ( )
inline

Stop periodic measurement.

Returns
True if successful

◆ writeModeAccelerateResponseTime()

bool m5::unit::UnitSHT30::writeModeAccelerateResponseTime ( )

Write the mode to ART.

After issuing the ART command the sensor will start acquiring data with a frequency of 4Hz

Returns
True if successful
Warning
Only available during periodic measurements