Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Dependents: HelloWorld_ST_Sensors MOTENV_Mbed mbed-os-mqtt-client HTS221_JS ... more
Diff: HTS221Sensor.h
- Revision:
- 1:c4391f20553e
- Parent:
- 0:7917d6d00a6e
- Child:
- 2:312ee2694a77
--- a/HTS221Sensor.h Mon Sep 04 16:06:23 2017 +0000
+++ b/HTS221Sensor.h Wed Sep 27 16:36:58 2017 +0200
@@ -48,7 +48,7 @@
#include "HTS221_driver.h"
#include "HumiditySensor.h"
#include "TempSensor.h"
-
+#include <assert.h>
/* Class Declaration ---------------------------------------------------------*/
@@ -58,9 +58,7 @@
class HTS221Sensor : public HumiditySensor, public TempSensor
{
public:
-
- HTS221Sensor(DevI2C &i2c);
- HTS221Sensor(DevI2C &i2c, uint8_t address);
+ HTS221Sensor(DevI2C *i2c, uint8_t address=HTS221_I2C_ADDRESS, PinName drdy_pin=NC);
virtual int init(void *init);
virtual int read_id(uint8_t *id);
virtual int get_humidity(float *pfData);
@@ -81,7 +79,7 @@
*/
uint8_t io_read(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
{
- return (uint8_t) _dev_i2c.i2c_read(pBuffer, _address, RegisterAddr, NumByteToRead);
+ return (uint8_t) _dev_i2c->i2c_read(pBuffer, _address, RegisterAddr, NumByteToRead);
}
/**
@@ -93,17 +91,18 @@
*/
uint8_t io_write(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
{
- return (uint8_t) _dev_i2c.i2c_write(pBuffer, _address, RegisterAddr, NumByteToWrite);
+ return (uint8_t) _dev_i2c->i2c_write(pBuffer, _address, RegisterAddr, NumByteToWrite);
}
private:
/* Helper classes. */
- DevI2C &_dev_i2c;
+ DevI2C *_dev_i2c;
/* Configuration */
uint8_t _address;
-
+ DigitalOut _cs_pin;
+ InterruptIn _drdy_pin;
};
#ifdef __cplusplus