[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/msp430/Adc12 TestAdcAppC.nc, 1.2, 1.3 TestAdcMultiC.nc, 1.3, 1.4 TestAdcSingleC.nc, 1.3, 1.4
Jan-Hinrich Hauer
janhauer at users.sourceforge.net
Mon Sep 29 08:51:26 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/msp430/Adc12
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26640/apps/tests/msp430/Adc12
Modified Files:
TestAdcAppC.nc TestAdcMultiC.nc TestAdcSingleC.nc
Log Message:
The commit from Jun 17 that introduced deputy annotations created a problem for the MultiChannel interface in Msp430Adc12ImplP ISR - this is now fixed. I also extended the test app.
Index: TestAdcAppC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/msp430/Adc12/TestAdcAppC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TestAdcAppC.nc 25 Jun 2007 15:43:37 -0000 1.2
--- TestAdcAppC.nc 29 Sep 2008 15:51:23 -0000 1.3
***************
*** 95,99 ****
// Multi, none
components new TestAdcMultiC(CONFIG_AVCC,
! SUPPLY_VOLTAGE_HALF_CHANNEL, REFERENCE_AVcc_AVss) as TestMulti1,
new Msp430Adc12ClientC() as Wrapper4;
--- 95,99 ----
// Multi, none
components new TestAdcMultiC(CONFIG_AVCC,
! TEMPERATURE_DIODE_CHANNEL, REFERENCE_AVcc_AVss) as TestMulti1,
new Msp430Adc12ClientC() as Wrapper4;
***************
*** 105,109 ****
// Multi, RefVolt
components new TestAdcMultiC(CONFIG_VREF,
! SUPPLY_VOLTAGE_HALF_CHANNEL, REFERENCE_VREFplus_AVss) as TestMulti2,
new Msp430Adc12ClientAutoRVGC() as Wrapper5;
--- 105,109 ----
// Multi, RefVolt
components new TestAdcMultiC(CONFIG_VREF,
! TEMPERATURE_DIODE_CHANNEL, REFERENCE_VREFplus_AVss) as TestMulti2,
new Msp430Adc12ClientAutoRVGC() as Wrapper5;
Index: TestAdcMultiC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/msp430/Adc12/TestAdcMultiC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TestAdcMultiC.nc 23 Jun 2008 20:25:14 -0000 1.3
--- TestAdcMultiC.nc 29 Sep 2008 15:51:23 -0000 1.4
***************
*** 67,74 ****
--- 67,76 ----
#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();
***************
*** 103,107 ****
event void Boot.booted()
{
! state = 0;
post getData();
}
--- 105,109 ----
event void Boot.booted()
{
! count = NUM_REPETITIONS;
post getData();
}
***************
*** 120,128 ****
async event void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples)
{
! if (assertData(buf, numSamples) && state++ == 0)
! post signalSuccess();
! else
post signalFailure();
! call Resource.release();
}
--- 122,134 ----
async event void MultiChannel.dataReady(uint16_t *buf, uint16_t numSamples)
{
! if (!assertData(buf, numSamples)){
post signalFailure();
! } else if (count){
! count--;
! call MultiChannel.getData();
! } else {
! post signalSuccess();
! call Resource.release();
! }
}
Index: TestAdcSingleC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/tests/msp430/Adc12/TestAdcSingleC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TestAdcSingleC.nc 23 Jun 2008 20:25:14 -0000 1.3
--- TestAdcSingleC.nc 29 Sep 2008 15:51:23 -0000 1.4
***************
*** 63,71 ****
{
#define BUFFER_SIZE 100
const msp430adc12_channel_config_t config = {inch, sref, ref2_5v, adc12ssel, adc12div, sht, sampcon_ssel, sampcon_id};
! uint8_t state;
! norace uint8_t numDone;
uint16_t buffer[BUFFER_SIZE];
void task getData();
void task signalFailure()
--- 63,79 ----
{
#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};
! norace uint8_t state;
! norace uint8_t count = 0;
uint16_t buffer[BUFFER_SIZE];
void task getData();
+ enum {
+ SINGLE_DATA,
+ SINGLE_DATA_REPEAT,
+ MULTIPLE_DATA,
+ MULTIPLE_DATA_REPEAT,
+ };
+
void task signalFailure()
***************
*** 84,88 ****
event void Boot.booted()
{
! state = 0;
post getData();
}
--- 92,96 ----
event void Boot.booted()
{
! state = SINGLE_DATA;
post getData();
}
***************
*** 100,124 ****
event void Resource.granted()
{
switch(state)
{
! case 0: state++;
! if (call SingleChannel.configureSingleRepeat(&config, 0) == SUCCESS)
call SingleChannel.getData();
break;
! case 1: state++;
! if (call SingleChannel.configureSingle(&config) == SUCCESS)
call SingleChannel.getData();
break;
! case 2: state++;
! if (call SingleChannel.configureMultiple(&config, buffer, BUFFER_SIZE, 0) == SUCCESS)
call SingleChannel.getData();
break;
! case 3: state++;
! if (call SingleChannel.configureMultipleRepeat(&config, buffer, 16, 0) == SUCCESS)
call SingleChannel.getData();
break;
default: call Resource.release();
! if (numDone == state)
! signal Notify.notify(TRUE);
break;
}
--- 108,132 ----
event void Resource.granted()
{
+ count = NUM_REPETITIONS;
switch(state)
{
! case SINGLE_DATA:
! if (call SingleChannel.configureSingle(&config) == SUCCESS)
call SingleChannel.getData();
break;
! case SINGLE_DATA_REPEAT:
! if (call SingleChannel.configureSingleRepeat(&config, 10) == SUCCESS)
call SingleChannel.getData();
break;
! case MULTIPLE_DATA:
! if (call SingleChannel.configureMultiple(&config, buffer, BUFFER_SIZE, 10) == SUCCESS)
call SingleChannel.getData();
break;
! case MULTIPLE_DATA_REPEAT:
! if (call SingleChannel.configureMultipleRepeat(&config, buffer, 16, 10) == SUCCESS)
call SingleChannel.getData();
break;
default: call Resource.release();
! signal Notify.notify(TRUE);
break;
}
***************
*** 127,133 ****
async event error_t SingleChannel.singleDataReady(uint16_t data)
{
- numDone++;
assertData(&data, 1);
call Resource.release();
post getData();
return FAIL;
--- 135,157 ----
async event error_t SingleChannel.singleDataReady(uint16_t data)
{
assertData(&data, 1);
+ switch(state)
+ {
+ case SINGLE_DATA:
+ if (count){
+ count--;
+ call SingleChannel.getData();
+ return SUCCESS;
+ }
+ break;
+ case SINGLE_DATA_REPEAT:
+ if (count){
+ count--;
+ return SUCCESS;
+ }
+ break;
+ }
call Resource.release();
+ state++;
post getData();
return FAIL;
***************
*** 137,143 ****
async event uint16_t* SingleChannel.multipleDataReady(uint16_t *buf, uint16_t length)
{
- numDone++;
assertData(buf, length);
call Resource.release();
post getData();
return 0;
--- 161,182 ----
async event uint16_t* SingleChannel.multipleDataReady(uint16_t *buf, uint16_t length)
{
assertData(buf, length);
+ switch(state)
+ {
+ case MULTIPLE_DATA:
+ if (count){
+ count--;
+ call SingleChannel.getData();
+ return 0;
+ }
+ break;
+ case MULTIPLE_DATA_REPEAT:
+ if (count){
+ count--;
+ return buf;
+ }
+ }
call Resource.release();
+ state++;
post getData();
return 0;
More information about the Tinyos-2-commits
mailing list