X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Fchips%2Fmsp430%2Fadc12%2FAdcStreamP.nc;h=a7f623865782e034497c650cd07825ea98949ec8;hp=7bc24f87ba6918540151e09ab2bd93b621de56f3;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hpb=adf1de6c009d13b7b52e68535c63b28f59c97400 diff --git a/tos/chips/msp430/adc12/AdcStreamP.nc b/tos/chips/msp430/adc12/AdcStreamP.nc index 7bc24f87..a7f62386 100644 --- a/tos/chips/msp430/adc12/AdcStreamP.nc +++ b/tos/chips/msp430/adc12/AdcStreamP.nc @@ -93,7 +93,8 @@ implementation { call SingleChannel.getData[client](); } - command error_t ReadStream.postBuffer[uint8_t c](uint16_t *buf, uint16_t n) { + error_t postBuffer(uint8_t c, uint16_t *buf, uint16_t n) + { if (n < sizeof(struct list_entry_t)) return ESIZE; atomic @@ -111,6 +112,10 @@ implementation { return SUCCESS; } + command error_t ReadStream.postBuffer[uint8_t c](uint16_t *buf, uint16_t n) { + return postBuffer(c, buf, n); + } + task void readStreamDone() { uint8_t c = client; uint32_t actualPeriod = period; @@ -204,8 +209,12 @@ implementation { msp430adc12_channel_config_t config = *call AdcConfigure.getConfiguration[c](); config.sampcon_ssel = SAMPCON_SOURCE_SMCLK; // assumption: SMCLK runs at 1 MHz config.sampcon_id = SAMPCON_CLOCK_DIV_1; - call SingleChannel.configureMultiple[c]( &config, pos, count, period); - call SingleChannel.getData[c](); + if (call SingleChannel.configureMultiple[c]( &config, pos, count, period) == SUCCESS) + call SingleChannel.getData[c](); + else { + postBuffer(c, pos, count); + post readStreamFail(); + } } }