]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Added DeviceMetadata interface to telosb sensors.
authorgtolle <gtolle>
Fri, 13 Apr 2007 21:46:18 +0000 (21:46 +0000)
committergtolle <gtolle>
Fri, 13 Apr 2007 21:46:18 +0000 (21:46 +0000)
tos/chips/sht11/SensirionSht11.h
tos/chips/sht11/SensirionSht11ReaderP.nc
tos/platforms/telosa/chips/s1087/HamamatsuS1087ParC.nc
tos/platforms/telosa/chips/s1087/HamamatsuS1087ParP.nc
tos/platforms/telosa/chips/s10871/HamamatsuS10871TsrC.nc
tos/platforms/telosa/chips/s10871/HamamatsuS10871TsrP.nc
tos/platforms/telosa/chips/sht11/SensirionSht11C.nc

index 7d3fb206400efa9731546a8b19fe0e0b2c125344..29485c4abfe7c029a51107742e4d67789272575c 100644 (file)
  * @author Gilman Tolle <gtolle@archrock.com>
  */
 
+enum {
+  SHT11_TEMPERATURE_BITS = 14,
+  SHT11_HUMIDITY_BITS = 12,
+};
+
 enum {
   SHT11_STATUS_LOW_RES_BIT = 1 << 0,
   SHT11_STATUS_NO_RELOAD_BIT = 1 << 1,
index 66acc3fd3e48ccfd9912d97183b0ea4a69d9c836..44c59b9183cc207c1ffcff5ca01856e2f9fb6ee7 100644 (file)
  * @version $Revision$ $Date$
  */
 
+#include <SensirionSht11.h>
+
 generic module SensirionSht11ReaderP() {
+  provides interface DeviceMetadata as TemperatureMetadata;
   provides interface Read<uint16_t> as Temperature;
+  provides interface DeviceMetadata as HumidityMetadata;
   provides interface Read<uint16_t> as Humidity;
   
   uses interface Resource as TempResource;
@@ -50,6 +54,9 @@ generic module SensirionSht11ReaderP() {
   uses interface SensirionSht11 as Sht11Hum;
 }
 implementation {
+
+  command uint8_t TemperatureMetadata.getSignificantBits() { return SHT11_TEMPERATURE_BITS; }
+
   command error_t Temperature.read() {
     call TempResource.request();
     return SUCCESS;
@@ -68,6 +75,8 @@ implementation {
     signal Temperature.readDone( result, val );
   }
 
+  command uint8_t HumidityMetadata.getSignificantBits() { return SHT11_HUMIDITY_BITS; }
+
   command error_t Humidity.read() {
     call HumResource.request();
     return SUCCESS;
index b9907d6f30ed35e9d8ebcc7ff73bfd042efc76a4..b36ffa0b8295973cc966698a38af69f522bb35b9 100644 (file)
@@ -38,6 +38,7 @@
  */
 
 generic configuration HamamatsuS1087ParC() {
+  provides interface DeviceMetadata;
   provides interface Read<uint16_t>;
   provides interface ReadStream<uint16_t>;
 }
@@ -49,6 +50,7 @@ implementation {
   ReadStream = AdcReadStreamClientC;
 
   components HamamatsuS1087ParP;
+  DeviceMetadata = HamamatsuS1087ParP;
   AdcReadClientC.AdcConfigure -> HamamatsuS1087ParP;
   AdcReadStreamClientC.AdcConfigure -> HamamatsuS1087ParP;
 }
index ee9451f010dd1f25c08536f93298cabccd015ce0..ac03062f7fecc79422758ee9a9c5d711400d7353 100644 (file)
@@ -40,6 +40,7 @@
  */
 
 module HamamatsuS1087ParP {
+  provides interface DeviceMetadata;
   provides interface AdcConfigure<const msp430adc12_channel_config_t*>;
 }
 implementation {
@@ -54,7 +55,9 @@ implementation {
     sampcon_ssel: SAMPCON_SOURCE_SMCLK,
     sampcon_id: SAMPCON_CLOCK_DIV_1
   };
-  
+
+  command uint8_t DeviceMetadata.getSignificantBits() { return 12; }
+
   async command const msp430adc12_channel_config_t* AdcConfigure.getConfiguration() {
     return &config;
   }
index 6c2a16410e2f2a506795c4eecd6eae4855ca6844..49b7aabcfaedced001ed79d4520af84f5ccf8128 100644 (file)
@@ -38,6 +38,7 @@
  */
 
 generic configuration HamamatsuS10871TsrC() {
+  provides interface DeviceMetadata;
   provides interface Read<uint16_t>;
   provides interface ReadStream<uint16_t>;
 }
@@ -49,6 +50,7 @@ implementation {
   ReadStream = AdcReadStreamClientC;
 
   components HamamatsuS10871TsrP;
+  DeviceMetadata = HamamatsuS10871TsrP;
   AdcReadClientC.AdcConfigure -> HamamatsuS10871TsrP;
   AdcReadStreamClientC.AdcConfigure -> HamamatsuS10871TsrP;
 }
index 940936281fc09922082629c2589fae24f3efd8f3..3e4f6abe728a5b131d94c3d4667ea712ec1928d4 100644 (file)
@@ -40,6 +40,7 @@
  */
 
 module HamamatsuS10871TsrP {
+  provides interface DeviceMetadata;
   provides interface AdcConfigure<const msp430adc12_channel_config_t*>;
 }
 implementation {
@@ -54,6 +55,8 @@ implementation {
     sampcon_ssel: SAMPCON_SOURCE_SMCLK,
     sampcon_id: SAMPCON_CLOCK_DIV_1
   };
+
+  command uint8_t DeviceMetadata.getSignificantBits() { return 12; }
   
   async command const msp430adc12_channel_config_t* AdcConfigure.getConfiguration() {
     return &config;
index 6adb709f1302c48990cb19700b3a6bd0ad533f6e..871903b430d85dd33a5e0f24dac4bb1e282a3d87 100644 (file)
 
 generic configuration SensirionSht11C() {
   provides interface Read<uint16_t> as Temperature;
+  provides interface DeviceMetadata as TemperatureMetadata;
   provides interface Read<uint16_t> as Humidity;
+  provides interface DeviceMetadata as HumidityMetadata;
 }
 implementation {
   components new SensirionSht11ReaderP();
 
   Temperature = SensirionSht11ReaderP.Temperature;
+  TemperatureMetadata = SensirionSht11ReaderP.TemperatureMetadata;
   Humidity = SensirionSht11ReaderP.Humidity;
+  HumidityMetadata = SensirionSht11ReaderP.HumidityMetadata;
 
   components HalSensirionSht11C;