HTS221 relative humidity and temperature sensor library
Dependencies: X_NUCLEO_COMMON ST_INTERFACES
Diff: HTS221Sensor.cpp
- Revision:
- 2:312ee2694a77
- Parent:
- 1:c4391f20553e
- Child:
- 5:ccf7f36492ae
--- a/HTS221Sensor.cpp Wed Sep 27 16:36:58 2017 +0200 +++ b/HTS221Sensor.cpp Mon Oct 02 09:28:41 2017 +0200 @@ -44,14 +44,22 @@ /* Class Implementation ------------------------------------------------------*/ +HTS221Sensor::HTS221Sensor(SPI *spi, PinName cs_pin, PinName drdy_pin) : + _dev_spi(spi), _cs_pin(cs_pin), _drdy_pin(drdy_pin) // SPI3W ONLY +{ + assert(spi); + _dev_i2c = NULL; +}; + /** Constructor * @param i2c object of an helper class which handles the I2C peripheral * @param address the address of the component's instance */ -HTS221Sensor::HTS221Sensor(DevI2C *i2c, uint8_t address, PinName drdy_pin) : - _dev_i2c(i2c), _address(address), _cs_pin(NC), _drdy_pin(drdy_pin) +HTS221Sensor::HTS221Sensor(DevI2C *i2c, uint8_t address, PinName drdy_pin) : + _dev_i2c(i2c), _address(address), _cs_pin(NC), _drdy_pin(drdy_pin) { - assert (i2c); + assert(i2c); + _dev_spi = NULL; }; /**