]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/msp430/adc12/AdcReadStreamClientC.nc
GCC 4.4.3 seems to have proper bitfield support.
[tinyos-2.x.git] / tos / chips / msp430 / adc12 / AdcReadStreamClientC.nc
index da95a414aeca20d830bef54667f06aa84adb5274..696bf71b3dd6a411e24f31662c8444c05f6cb5ff 100644 (file)
  */
 
 /** 
- * This component allows a client to access the MSP430 ADC12
- * (12-bit analog-to-digital converter) via the <code>ReadStream</code>
- * interface. A client must wire the <code>Msp430Adc12Config</code> interface
- * to a component that returns its ADC12 configuration data. Depending on the
- * REF_VOLT_AUTO_CONFIGURE switch (defined in Msp430Adc12.h) the internal
- * reference voltage generator is automatically enabled if and only if the
- * configuration data includes VREF as reference voltage.
+ * This component virtualizes the HIL of ADC12 on MSP430. A client must wire
+ * <code>AdcConfigure</code> to a component that returns the client's adc
+ * configuration data.
  *
- * @author Jan Hauer
- * @see  Please refer to TEP 101 for more information about this component and its
- *          intended use.
+ * @author Jan Hauer 
+ * @see  Please refer to the README.txt and TEP 101 for more information about 
+ * this component and its intended use.
  */
 
 #include <Msp430Adc12.h>
 generic configuration AdcReadStreamClientC() {
   provides interface ReadStream<uint16_t>;
-  uses interface Msp430Adc12Config;
+  uses interface AdcConfigure<const msp430adc12_channel_config_t*>;
 } implementation {
-  components AdcC,
+  components WireAdcStreamP, 
 #ifdef REF_VOLT_AUTO_CONFIGURE     
-             new Msp430Adc12RefVoltAutoClientC() as Msp430AdcClient;
+             // if the client configuration requires a stable 
+             // reference voltage, the reference voltage generator 
+             // is automatically enabled
+             new Msp430Adc12ClientAutoRVGC() as Msp430AdcClient;
+  AdcConfigure = Msp430AdcClient.AdcConfigure;
 #else
              new Msp430Adc12ClientC() as Msp430AdcClient;
 #endif
@@ -63,12 +63,9 @@ generic configuration AdcReadStreamClientC() {
     RSCLIENT = unique(ADCC_READ_STREAM_SERVICE),
   };
 
-  ReadStream = AdcC.ReadStream[RSCLIENT];
-  Msp430Adc12Config = AdcC.ConfigReadStream[RSCLIENT];
-  AdcC.SingleChannelReadStream[RSCLIENT] -> Msp430AdcClient.Msp430Adc12SingleChannel;
-  AdcC.ResourceReadStream[RSCLIENT] -> Msp430AdcClient.Resource;
-#ifdef REF_VOLT_AUTO_CONFIGURE
-  Msp430Adc12Config = Msp430AdcClient.Msp430Adc12Config;
-#endif
+  ReadStream = WireAdcStreamP.ReadStream[RSCLIENT];
+  AdcConfigure = WireAdcStreamP.AdcConfigure[RSCLIENT];
+  WireAdcStreamP.Resource[RSCLIENT] -> Msp430AdcClient.Resource;
+  WireAdcStreamP.Msp430Adc12SingleChannel[RSCLIENT] -> Msp430AdcClient.Msp430Adc12SingleChannel;
 }