]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Added universal blocking SineSensor drivers for the C API
authorklueska <klueska>
Fri, 13 Jun 2008 23:04:21 +0000 (23:04 +0000)
committerklueska <klueska>
Fri, 13 Jun 2008 23:04:21 +0000 (23:04 +0000)
tos/lib/tosthreads/csystem/TosThreadApiC.nc
tos/lib/tosthreads/sensorboards/universal/CSineSensorC.nc [new file with mode: 0644]
tos/lib/tosthreads/sensorboards/universal/CSineSensorP.nc [new file with mode: 0644]
tos/lib/tosthreads/sensorboards/universal/tosthread_sinesensor.h [new file with mode: 0644]
tos/lib/tosthreads/sensorboards/universal/universal_sensors.h [new file with mode: 0644]
tos/lib/tosthreads/system/BlockingReadP.nc
tos/lib/tosthreads/system/BlockingReadStreamP.nc

index 394c636dbb58f92d29777f0249b99ff499a41f08..d7c4d5123a20e8978be2b0b5deedb38e01fc48e7 100644 (file)
@@ -68,7 +68,7 @@ implementation {
     components CLogStorageC;
   #endif 
   
-  //Telosb sensorbard specific.  Later need to find conditional way of adding this in
+  //Telosb sensorboard specific.  Later need to find conditional way of adding this in
   #if defined(TOSTHREAD_HAMAMATSUS1087_H) || defined(TOSTHREAD_DYNAMIC_LOADER)
     components CHamamatsuS1087ParC;
   #endif
@@ -78,4 +78,9 @@ implementation {
   #if defined(TOSTHREAD_SENSIRIONSHT11_H) || defined(TOSTHREAD_DYNAMIC_LOADER)
     components CSensirionSht11C;
   #endif
+  
+  //Universal sensorboard specific
+  #if defined(TOSTHREAD_SINESENSOR_H) || defined(TOSTHREAD_DYNAMIC_LOADER)
+    components CSineSensorC;
+  #endif
 }
diff --git a/tos/lib/tosthreads/sensorboards/universal/CSineSensorC.nc b/tos/lib/tosthreads/sensorboards/universal/CSineSensorC.nc
new file mode 100644 (file)
index 0000000..6409b47
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2008 Stanford University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Stanford University nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL STANFORD
+ * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Kevin Klues <klueska@cs.stanford.edu>
+ */
+
+configuration CSineSensorC {}
+implementation {
+  components CSineSensorP;
+  components new BlockingSineSensorC();       
+  CSineSensorP.BlockingRead -> BlockingSineSensorC;
+}
diff --git a/tos/lib/tosthreads/sensorboards/universal/CSineSensorP.nc b/tos/lib/tosthreads/sensorboards/universal/CSineSensorP.nc
new file mode 100644 (file)
index 0000000..63f197d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2008 Stanford University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Stanford University nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL STANFORD
+ * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Kevin Klues <klueska@cs.stanford.edu>
+ */
+
+module CSineSensorP {
+  uses {
+    interface BlockingRead<uint16_t>;
+  }
+}
+implementation {
+  error_t sinesensor_read(uint16_t* val) @C() @spontaneous() {
+    return call BlockingRead.read(val);
+  }
+}
diff --git a/tos/lib/tosthreads/sensorboards/universal/tosthread_sinesensor.h b/tos/lib/tosthreads/sensorboards/universal/tosthread_sinesensor.h
new file mode 100644 (file)
index 0000000..46e0c12
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2008 Stanford University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Stanford University nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL STANFORD
+ * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @author Kevin Klues <klueska@cs.stanford.edu>
+ */
+#ifndef TOSTHREAD_SINESENSOR_H
+#define TOSTHREAD_SINESENSOR_H
+
+#include "TinyError.h"
+
+extern error_t sinesensor_read(uint16_t* val);
+
+#endif //TOSTHREAD_SINESENSOR_H
diff --git a/tos/lib/tosthreads/sensorboards/universal/universal_sensors.h b/tos/lib/tosthreads/sensorboards/universal/universal_sensors.h
new file mode 100644 (file)
index 0000000..3745ded
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2008 Stanford University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Stanford University nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL STANFORD
+ * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @author Kevin Klues <klueska@cs.stanford.edu>
+ */
+  
+#ifndef UNIVERSAL_SENSORS_H
+#define UNIVERSAL_SENSORS_H
+
+#include "tosthread_sinesensor.h"
+
+#endif //UNIVERSAL_SENSORS_H
index be16b882fb242bd3c2a79b5a3dde134676e5ef5b..f933503a2bf4c43bcf0be30af0672d534f46c4a7 100644 (file)
@@ -93,4 +93,6 @@ implementation {
     p->error = result;
     call SystemCall.finish(s);  
   }
+  default command error_t Read.read[uint8_t id]() { return FAIL; }
+
 }
index 616c5e7502d9a21111afc1c7cd7c79ef15a019be..adc3fb064d7467dbf4f3c015e0a015b4024af771 100644 (file)
@@ -103,4 +103,5 @@ implementation {
     p->error = result;
     call SystemCall.finish(s);  
   }
+  default command error_t ReadStream.read[uint8_t id](uint32_t usPeriod) { return FAIL; }
 }