This is a library to read out sensor values from Silicon Labs' si70xx-range of relative humidity and temperature sensors.

Dependents:   MemLCD-Temperature-Humidity-Demo lab123

Information

All examples in this repo are considered EXPERIMENTAL QUALITY, meaning this code has been created as one-off proof-of-concept and is suitable as a demonstration for experimental purposes only. This code will not be regularly maintained by Silicon Labs and there is no guarantee that these projects will work across all environments, SDK versions and hardware.

Caution

This library targets mbed's asynchronous transfer APIs, so it can only be used in conjunction with platforms supporting these APIs.

The library is currently compatible with Si7013, Si7020 and Si7021 parts.

Usage

Include mbed low-power to use this driver

#include "mbed.h"
#include "SILABS_RHT.h"
 
I2C sensorI2C(PD6, PD7); //PD6=SDA, PD7=SCL
silabs::SILABS_RHT rhtSensor(&sensorI2C);
 
volatile bool busChecked = false;
 
void respondedCallback( void ) {
    busChecked = true;
}

int main() {
    rhtSensor.check_availability(si7021, respondedCallback);
    while(busChecked == false) sleep();
    
    busChecked = false;
    rhtSensor.measure(si7021, respondedCallback);
    while(busChecked == false) sleep();

    if(rhtSensor.get_active()) {
        printf("Temperature: %d.%03d degC\n", rhtSensor.get_Temperature()/1000, rhtSensor.get_Temperature()%1000);
    } else {
        printf("No sensor found\n");
    }

    while(1) sleep();
}

Datasheets

http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx

Files at this revision

API Documentation at this revision

Comitter:
stevew817
Date:
Tue May 05 14:32:43 2015 +0000
Parent:
1:f3c25dea392e
Commit message:
CallbackPointer.h got deprecated

Changed in this revision

SILABS_RHT.h Show annotated file Show diff for this revision Revisions of this file
diff -r f3c25dea392e -r 83a8b7df827f SILABS_RHT.h
--- a/SILABS_RHT.h	Tue Apr 14 15:27:17 2015 -0400
+++ b/SILABS_RHT.h	Tue May 05 14:32:43 2015 +0000
@@ -34,7 +34,6 @@
 
 #include "platform.h"
 #include <mbed.h>
-#include "CallbackPointer.h"
 
 typedef void (*cbptr_t)(void);