Silicon Labs Si7021-A20 device driver: I2C Humidity and Temperature Sensor
Diff: si7021.h
- Revision:
- 1:344923bddd4f
- Parent:
- 0:9909c9c7d326
--- a/si7021.h Tue Sep 12 17:17:03 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -#include "mbed.h" - -#ifndef SI7021_H -#define SI7021_H - -typedef struct { - float temp_C; - float humidity_PR; -// int16_t temp; -// int16_t temp_norm; -// int16_t humidity; -// int16_t humidity_norm; -} si7021_measurements_t; - -class SI7021 { - public: - /** - * Constructor - * - * @param i2c I2C class servicing the strip - */ - SI7021(I2C * i2c) : _i2c(i2c) {} - - /** - * Read temperature and humidity - * - * @param data points to struct to store measurements in. Stucture is - * valid only when function returns success indication. - * - * @returns true (success) or false (failure) - */ - bool read(si7021_measurements_t * data); - - protected: - - /** - * I2C read/write helper function - * - * @param address is the register to read/write - * @param buff holds the data to write and recieves the data to read - * @param writeSize is the number of bytes to write to register - * @param readSize is the number of bytes to retrieve from device - * - * @returns true (success) or false (failure) - */ - bool _i2c_transfer(int address, void * buff, size_t writeSize, size_t readSize); - - /** - * - bool _validate(void) - */ - - I2C *_i2c; -}; - -#endif //SI7021_H