X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2Fmsp430%2FAdc12%2FTestAdcMultiC.nc;h=6a2495031e016980f8eedd8c491f5b8d854b7efb;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=5393334234971288dbbbcdf2e1bf3fa8d595cdd1;hpb=60959169f556ee3dc648a69f5c8fb1ed9cd887c7;p=tinyos-2.x.git diff --git a/apps/tests/msp430/Adc12/TestAdcMultiC.nc b/apps/tests/msp430/Adc12/TestAdcMultiC.nc index 53933342..6a249503 100644 --- a/apps/tests/msp430/Adc12/TestAdcMultiC.nc +++ b/apps/tests/msp430/Adc12/TestAdcMultiC.nc @@ -50,7 +50,7 @@ generic module TestAdcMultiC( uint8_t inch2, // second input channel uint8_t sref2 // second reference voltage -) +) @safe() { uses { interface Boot; @@ -66,10 +66,12 @@ implementation { #define BUFFER_SIZE 100 +#define NUM_REPETITIONS 5 const msp430adc12_channel_config_t config = {inch, sref, ref2_5v, adc12ssel, adc12div, sht, sampcon_ssel, sampcon_id}; adc12memctl_t memCtl = {inch2, sref2}; norace uint8_t state; uint16_t buffer[BUFFER_SIZE]; + norace uint8_t count = 0; void task getData(); void task signalFailure() @@ -102,7 +104,7 @@ implementation event void Boot.booted() { - state = 0; + count = NUM_REPETITIONS; post getData(); } @@ -119,11 +121,15 @@ implementation async event void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples) { - if (assertData(buf, numSamples) && state++ == 0) - post signalSuccess(); - else + if (!assertData(buf, numSamples)){ post signalFailure(); - call Resource.release(); + } else if (count){ + count--; + call MultiChannel.getData(); + } else { + post signalSuccess(); + call Resource.release(); + } } command error_t Notify.enable(){}