*/
/**
- * 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
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;
}