X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftests%2Fmsp430%2FAdc12%2FTestAdcMultiC.nc;h=6a2495031e016980f8eedd8c491f5b8d854b7efb;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=26737838a144d6bfc577ec7de7ef9be49147e668;hpb=9634a9f83d8a9cc448d078823107c85e6ca29e40;p=tinyos-2.x.git diff --git a/apps/tests/msp430/Adc12/TestAdcMultiC.nc b/apps/tests/msp430/Adc12/TestAdcMultiC.nc index 26737838..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}; - uint8_t state; + norace uint8_t state; uint16_t buffer[BUFFER_SIZE]; + norace uint8_t count = 0; void task getData(); void task signalFailure() @@ -85,6 +87,8 @@ implementation bool assertData(uint16_t *data, uint16_t num) { uint16_t i; + if (num != BUFFER_SIZE) + post signalFailure(); for (i=0; i= 0xFFF){ post signalFailure(); @@ -100,7 +104,7 @@ implementation event void Boot.booted() { - state = 0; + count = NUM_REPETITIONS; post getData(); } @@ -117,9 +121,15 @@ implementation async event void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples) { - if (assertData(buf, numSamples)) + if (!assertData(buf, numSamples)){ + post signalFailure(); + } else if (count){ + count--; + call MultiChannel.getData(); + } else { post signalSuccess(); - call Resource.release(); + call Resource.release(); + } } command error_t Notify.enable(){}