Adafruit MS8607 Library
Public Member Functions | Protected Attributes | Friends | List of all members
Adafruit_MS8607 Class Reference

#include <Adafruit_MS8607.h>

Public Member Functions

 Adafruit_MS8607 (void)
 Instantiates a new MS8607 class.
 
bool begin (TwoWire *wire=&Wire, int32_t sensor_id=0)
 Sets up the hardware and initializes I2C. More...
 
bool init (int32_t sensor_id)
 Initializer for post i2c/spi init. More...
 
bool reset (void)
 Reset the sensors to their initial state. More...
 
ms8607_humidity_resolution_t getHumidityResolution (void)
 Get the currently set resolution for humidity readings. More...
 
bool setHumidityResolution (ms8607_humidity_resolution_t res)
 Set the resolution for humidity readings. More...
 
ms8607_pressure_resolution_t getPressureResolution (void)
 Get the currently set resolution for pressure readings. More...
 
bool setPressureResolution (ms8607_pressure_resolution_t res)
 Set the resolution for pressure readings. More...
 
bool enableHumidityClockStretching (bool enable_stretching)
 Allow the MS8607 to hold the clock line low until it completes the requested measurements. More...
 
bool getEvent (sensors_event_t *pressure, sensors_event_t *temp, sensors_event_t *humidity)
 Gets the humidity sensor and temperature values as sensor events. More...
 
Adafruit_Sensor * getTemperatureSensor (void)
 Gets the Adafruit_Sensor object for the MS0607's temperature sensor. More...
 
Adafruit_Sensor * getPressureSensor (void)
 Gets the Adafruit_Sensor object for the MS0607's pressure sensor. More...
 
Adafruit_Sensor * getHumiditySensor (void)
 Gets the Adafruit_Sensor object for the MS0607's humidity sensor. More...
 

Protected Attributes

uint16_t _sensorid_temp
 ID number for temperature.
 
uint16_t _sensorid_pressure
 ID number for pressure.
 
uint16_t _sensorid_humidity
 ID number for humidity.
 
Adafruit_I2CDevice * pt_i2c_dev = NULL
 
Adafruit_I2CDevice * hum_i2c_dev
 Pointer to I2C bus interface for the humidity sensor. More...
 
Adafruit_MS8607_Temptemp_sensor = NULL
 Temp sensor data object.
 
Adafruit_MS8607_Pressurepressure_sensor
 Pressure sensor data object. More...
 
Adafruit_MS8607_Humidityhumidity_sensor
 Humidity sensor data object. More...
 

Friends

class Adafruit_MS8607_Temp
 
class Adafruit_MS8607_Pressure
 
class Adafruit_MS8607_Humidity
 

Detailed Description

Driver for the Adafruit MS8607 PHT sensor.

Member Function Documentation

◆ begin()

bool Adafruit_MS8607::begin ( TwoWire *  wire = &Wire,
int32_t  sensor_id = 0 
)

Sets up the hardware and initializes I2C.

Parameters
wireThe Wire object to be used for I2C connections.
sensor_idThe unique ID to differentiate the sensors from others
Returns
True if initialization was successful, otherwise false.

◆ init()

bool Adafruit_MS8607::init ( int32_t  sensor_id)

Initializer for post i2c/spi init.

Parameters
sensor_idOptional unique ID for the sensor set
Returns
True if chip identified and initialized

◆ reset()

bool Adafruit_MS8607::reset ( void  )

Reset the sensors to their initial state.

Returns
true: success false: failure

◆ getHumidityResolution()

ms8607_humidity_resolution_t Adafruit_MS8607::getHumidityResolution ( void  )

Get the currently set resolution for humidity readings.

Returns
ms8607_humidity_resolution_t the current resolution

◆ setHumidityResolution()

bool Adafruit_MS8607::setHumidityResolution ( ms8607_humidity_resolution_t  resolution)

Set the resolution for humidity readings.

Parameters
resolutionThe new resolution to set
Returns
true: success false: failure

◆ getPressureResolution()

ms8607_pressure_resolution_t Adafruit_MS8607::getPressureResolution ( void  )

Get the currently set resolution for pressure readings.

Returns
ms8607_pressure_resolution_t the current resolution

◆ setPressureResolution()

bool Adafruit_MS8607::setPressureResolution ( ms8607_pressure_resolution_t  resolution)

Set the resolution for pressure readings.

Parameters
resolutionThe new resolution to set
Returns
true: success false: failure

◆ enableHumidityClockStretching()

bool Adafruit_MS8607::enableHumidityClockStretching ( bool  enable_stretching)

Allow the MS8607 to hold the clock line low until it completes the requested measurements.

Parameters
enable_stretchingtrue: enable
Returns
true: success false: failure

◆ getEvent()

bool Adafruit_MS8607::getEvent ( sensors_event_t *  pressure,
sensors_event_t *  temp,
sensors_event_t *  humidity 
)

Gets the humidity sensor and temperature values as sensor events.

Parameters
pressureSensor event object that will be populated with pressure data
tempSensor event object that will be populated with temp data
humiditySensor event object that will be populated with humidity data
Returns
true if the event data was read successfully

◆ getTemperatureSensor()

Adafruit_Sensor * Adafruit_MS8607::getTemperatureSensor ( void  )

Gets the Adafruit_Sensor object for the MS0607's temperature sensor.

Returns
Adafruit_Sensor* a pointer to the temperature sensor object

◆ getPressureSensor()

Adafruit_Sensor * Adafruit_MS8607::getPressureSensor ( void  )

Gets the Adafruit_Sensor object for the MS0607's pressure sensor.

Returns
Adafruit_Sensor* a pointer to the pressure sensor object

◆ getHumiditySensor()

Adafruit_Sensor * Adafruit_MS8607::getHumiditySensor ( void  )

Gets the Adafruit_Sensor object for the MS0607's humidity sensor.

Returns
Adafruit_Sensor* a pointer to the humidity sensor object

Friends And Related Function Documentation

◆ Adafruit_MS8607_Temp

friend class Adafruit_MS8607_Temp
friend

Gives access to private members to Temperature data object

◆ Adafruit_MS8607_Pressure

friend class Adafruit_MS8607_Pressure
friend

Gives access to private members to Pressure data object

◆ Adafruit_MS8607_Humidity

friend class Adafruit_MS8607_Humidity
friend

Gives access to private members to Humidity data object

Member Data Documentation

◆ pt_i2c_dev

Adafruit_I2CDevice* Adafruit_MS8607::pt_i2c_dev = NULL
protected

Pointer to I2C bus interface for the pressure & temperature sensor

◆ hum_i2c_dev

Adafruit_I2CDevice* Adafruit_MS8607::hum_i2c_dev
protected
Initial value:
=
NULL

Pointer to I2C bus interface for the humidity sensor.

◆ pressure_sensor

Adafruit_MS8607_Pressure* Adafruit_MS8607::pressure_sensor
protected
Initial value:
=
NULL

Pressure sensor data object.

◆ humidity_sensor

Adafruit_MS8607_Humidity* Adafruit_MS8607::humidity_sensor
protected
Initial value:
=
NULL

Humidity sensor data object.


The documentation for this class was generated from the following files: