VTT TinyNode, slightly modified code from example (https://developer.mbed.org/users/jejuho/code/VTT_NODEV3_BMP180_Si7021)
Dependencies: BLE_API TMP_nrf51 mbed nRF51822
Fork of VTT_NODEV3_BMP180_Si7021 by
Si7021.h@3:101b0f081435, 2016-05-27 (annotated)
- Committer:
- JarkkoS
- Date:
- Fri May 27 07:38:42 2016 +0000
- Revision:
- 3:101b0f081435
- Parent:
- 2:b221ba23b37f
VTT TinyNodeV2, slightly modified code from example (https://developer.mbed.org/users/jejuho/code/VTT_NODEV3_BMP180_Si7021)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jejuho | 2:b221ba23b37f | 1 | #ifndef SI7021_H |
jejuho | 2:b221ba23b37f | 2 | #define SI7021_H |
jejuho | 2:b221ba23b37f | 3 | |
jejuho | 2:b221ba23b37f | 4 | #include "mbed.h" |
jejuho | 2:b221ba23b37f | 5 | |
jejuho | 2:b221ba23b37f | 6 | #define SI7021_ADDR 0x80 |
jejuho | 2:b221ba23b37f | 7 | #define SI7021_CONTROL_BYTE 0x3A //Reset settings (default values ok, no need to write) |
jejuho | 2:b221ba23b37f | 8 | #define SI7021_MEASURE_RH_HOLD_MASTER 0xE5 |
jejuho | 2:b221ba23b37f | 9 | #define SI7021_MEASURE_RH_NO_HOLD_MASSTER 0xF5 |
jejuho | 2:b221ba23b37f | 10 | #define SI7021_MEASURE_TEMPERATURE_HOLD_MASTER 0xE3 |
jejuho | 2:b221ba23b37f | 11 | #define SI7021_MEASURE_TEMPERATURE_NO_HOLD_MASTER 0xF3 |
jejuho | 2:b221ba23b37f | 12 | #define SI7021_READ_TEMPERATURE 0xE0 |
jejuho | 2:b221ba23b37f | 13 | #define SI7021_RESET 0xFE |
jejuho | 2:b221ba23b37f | 14 | #define SI7021_WRITE_USER_REG1 0xE6 |
jejuho | 2:b221ba23b37f | 15 | #define SI7021_READ_USER_REG1 0xE7 |
jejuho | 2:b221ba23b37f | 16 | #define SI7021_READ_EID1_1 0xFA |
jejuho | 2:b221ba23b37f | 17 | #define SI7021_READ_EID1_2 0x0F |
jejuho | 2:b221ba23b37f | 18 | #define SI7021_READ_EID2_1 0xFC |
jejuho | 2:b221ba23b37f | 19 | #define SI7021_READ_EID2_2 0xC9 |
jejuho | 2:b221ba23b37f | 20 | #define SI7021_READ_FW_REVISION_1 0x84 |
jejuho | 2:b221ba23b37f | 21 | #define SI7021_READ_FW_REVISION_2 0xB8 |
jejuho | 2:b221ba23b37f | 22 | |
jejuho | 2:b221ba23b37f | 23 | class SI7021_I2C { |
jejuho | 2:b221ba23b37f | 24 | |
jejuho | 2:b221ba23b37f | 25 | public: |
jejuho | 2:b221ba23b37f | 26 | SI7021_I2C(PinName sda, PinName scl); |
jejuho | 2:b221ba23b37f | 27 | |
jejuho | 2:b221ba23b37f | 28 | float Measure_Temp(void); |
jejuho | 2:b221ba23b37f | 29 | void Measure_Humidity_Temp(float *humidity, float *temperature); |
jejuho | 2:b221ba23b37f | 30 | |
jejuho | 2:b221ba23b37f | 31 | private: |
jejuho | 2:b221ba23b37f | 32 | float get_HumidityTemp(void); |
jejuho | 2:b221ba23b37f | 33 | uint8_t readBytes(uint8_t *values, int8_t length, bool waitConversion); |
jejuho | 2:b221ba23b37f | 34 | I2C i2c_; |
jejuho | 2:b221ba23b37f | 35 | }; |
jejuho | 2:b221ba23b37f | 36 | |
jejuho | 2:b221ba23b37f | 37 | #endif |