]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/adc12/Msp430Adc12ImplP.nc
Merge TinyOS 2.1.1 into master.
[tinyos-2.x.git] / tos / chips / msp430 / adc12 / Msp430Adc12ImplP.nc
index 0ce8a5450799aa351bee46ebf8407da3ba35afbc..e9e7f68e869dd8f07bee73dbd5bb08d86d407252 100644 (file)
@@ -63,7 +63,11 @@ module Msp430Adc12ImplP @safe()
 }
 implementation
 { 
-#warning Accessing TimerA for ADC12 
+
+#ifdef ADC12_TIMERA_ENABLED
+  #warning Accessing TimerA for ADC12 
+#endif
+
   enum {
     SINGLE_DATA = 1,
     SINGLE_DATA_REPEAT = 2,
@@ -218,6 +222,10 @@ implementation
   {
     error_t result = ERESERVE;
 #ifdef ADC12_CHECK_ARGS
+#ifndef ADC12_TIMERA_ENABLED
+    if (jiffies>0) 
+      return EINVAL;
+#endif
     if (!config || jiffies == 1 || jiffies == 2)
       return EINVAL;
 #endif
@@ -266,6 +274,10 @@ implementation
   {
     error_t result = ERESERVE;
 #ifdef ADC12_CHECK_ARGS
+#ifndef ADC12_TIMERA_ENABLED
+    if (jiffies>0) 
+      return EINVAL;
+#endif
     if (!config || !buf || !length || jiffies == 1 || jiffies == 2)
       return EINVAL;
 #endif
@@ -323,6 +335,10 @@ implementation
   {
     error_t result = ERESERVE;
 #ifdef ADC12_CHECK_ARGS
+#ifndef ADC12_TIMERA_ENABLED
+    if (jiffies>0) 
+      return EINVAL;
+#endif
     if (!config || !buf || !length || length > 16 || jiffies == 1 || jiffies == 2)
       return EINVAL;
 #endif
@@ -379,7 +395,7 @@ implementation
   {
     atomic {
       if (call ADCArbiterInfo.userId() == id){
-        if (state & MULTIPLE_DATA_REPEAT && !resultBufferStart)
+        if ((state & MULTIPLE_DATA_REPEAT) && !resultBufferStart)
           return EINVAL;
         if (state & ADC_BUSY)
           return EBUSY;
@@ -402,6 +418,10 @@ implementation
   {
     error_t result = ERESERVE;
 #ifdef ADC12_CHECK_ARGS
+#ifndef ADC12_TIMERA_ENABLED
+    if (jiffies>0) 
+      return EINVAL;
+#endif
     if (!config || !memctl || !numMemctl || numMemctl > 15 || !numSamples || 
         !buf || jiffies == 1 || jiffies == 2 || numSamples % (numMemctl+1) != 0)
       return EINVAL;
@@ -554,7 +574,7 @@ implementation
       case MULTI_CHANNEL:
         {
           uint16_t i = 0, k;
-          resultBuffer = resultBufferStart;
+          resultBuffer = resultBufferStart + resultBufferIndex;
           do {
             *resultBuffer++ = call HplAdc12.getMem(i);
           } while (++i < numChannels);
@@ -566,7 +586,7 @@ implementation
             resultBufferIndex = 0;
             signal MultiChannel.dataReady[clientID](resultBuffer, 
                 overflow ? k : resultBufferLength);
-          } else call HplAdc12.enableConversion();
+          }
         }
         break;
       case MULTIPLE_DATA: