]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/adc12/Msp430RefVoltGeneratorP.nc
Merge over into the trunk.
[tinyos-2.x.git] / tos / chips / msp430 / adc12 / Msp430RefVoltGeneratorP.nc
index a3efeaa4656f09d44392c0ce0683bcff1c529ae5..326751b28e78f3795fe5b76725bb7515388244cc 100644 (file)
@@ -61,12 +61,15 @@ module Msp430RefVoltGeneratorP
       if (call HplAdc12.isBusy())
         return FAIL;
       else {
-        call HplAdc12.disableConversion();
-        call HplAdc12.setRefOn();
+        adc12ctl0_t ctl0 = call HplAdc12.getCtl0();
+        ctl0.enc = 0;
+        call HplAdc12.setCtl0(ctl0);
+        ctl0.refon = 1;
         if (level == REFERENCE_1_5V_PENDING)
-          call HplAdc12.setRef1_5V();
+          ctl0.r2_5v = 0;
         else
-          call HplAdc12.setRef2_5V();
+          ctl0.r2_5v = 1;
+        call HplAdc12.setCtl0(ctl0);
         return SUCCESS;
       }
     }
@@ -78,8 +81,11 @@ module Msp430RefVoltGeneratorP
       if (call HplAdc12.isBusy())
         return FAIL;
       else {
-        call HplAdc12.disableConversion();
-        call HplAdc12.resetRefOn();
+        adc12ctl0_t ctl0 = call HplAdc12.getCtl0();
+        ctl0.enc = 0;
+        call HplAdc12.setCtl0(ctl0);
+        ctl0.refon = 0;
+        call HplAdc12.setCtl0(ctl0);
         return SUCCESS;
       }
     }