Thank you both for answering.

So, if I need to capture the datas from the two ecg channels I only need to
call

call shimmerAnalogSetup.addECGInputs();
call shimmerAnalogSetup.finishADCSetup(sbuf0);

in the Init() and then:


async event void DMA0.transferDone(error_t success) {
        if(current_buffer == 0){
            call DMA0.repeatTransfer((void*)ADC12MEM0_, (void*)&sbuf1,
NBR_ADC_CHANS);
            memcpy(ecgData, &sbuf1, sizeof(*sbuf1)*NBR_ADC_CHANS);
            current_buffer = 1;
        }
        else {
            call DMA0.repeatTransfer((void*)ADC12MEM0_, (void*)&sbuf0,
NBR_ADC_CHANS);
            memcpy(ecgData, &sbuf0, sizeof(*sbuf1)*NBR_ADC_CHANS);
            current_buffer = 0;
        }
without making the
call shimmerAnalogSetup.addAccelInputs();

in this way in the array ecgData I will have the datas from the two
channels?

2011/10/5 steve ayer <[email protected]>

> hi peppe,
>
> for the record, i did not write this application, adrian burns did.  i made
> a few latter-day mods to clean it up after creating a component for all of
> the analog-digital setup and conversion functionality.
>
> p_packet is a local variable used to walk the buffer that the bluetooth
> radio will send; it was not meant to be visible elsewhere.  the buffer that
> it references is.
>
> as for "calling" transferDone, you don't call events; they are signaled
> from modules that are performing an operation to notify the receiving code
> that something related to an interface that it uses has happened (tinyos is
> an event-driven operating environment).
>
> finally, this application works splendidly and has been in use -- deployed
> clinically -- for a number of years.  to get the data from the ECG, all you
> have to do is receive it over bluetooth on a host computer.
>
> if you're looking for the two ECG channels, by reading the comments at the
> top of the file, you'll see a detailed description of the radio packet's
> contents, which includes the size and location of all of the data produced
> by this application, in order to make it very simple to parse the incoming
> data on the host side.
>
> -steve
>
>
>
> On 10/05/2011 06:55 AM, Peppe Scabellone wrote:
>
>> Hi , I was looking Steve Ayer's AccelECGC.nc file.
>> I need to get datas from ECG and as I can see in that file the real
>> datas are stored in p_packet array as you can see below:
>>
>> /* copy all the data samples into the outgoing packet */
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[8]
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[10]
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[12]
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[14]
>>         *p_packet = *p_ADCsamples; //tx_packet[16]
>>
>> but this p_packet is never used in other part of the code.
>>
>> I need the two channels of ECG stored in one array
>>  uint16_t ecgData[2]
>>
>> so if I call
>>
>> async event void DMA0.transferDone(error_t success) {
>>         if(current_buffer == 0){
>>             call DMA0.repeatTransfer((void*)**ADC12MEM0_, (void*)&sbuf1,
>> NBR_ADC_CHANS);
>>             memcpy(ecgData, &sbuf1, sizeof(*sbuf1)*NBR_ADC_CHANS);
>>             current_buffer = 1;
>>         }
>>         else {
>>             call DMA0.repeatTransfer((void*)**ADC12MEM0_, (void*)&sbuf0,
>> NBR_ADC_CHANS);
>>             memcpy(ecgData, &sbuf0, sizeof(*sbuf1)*NBR_ADC_CHANS);
>>             current_buffer = 0;
>>         }
>>
>>         post preparePacket();
>>
>>     }
>>
>> and the method
>>
>> void preparePacket() {
>>         uint16_t *p_packet, *p_ADCsamples, crc;
>>
>>     p_packet = (uint16_t *)&tx_packet[8];
>>
>>         if(current_buffer == 1) {
>>             p_ADCsamples = &sbuf0[0];
>>
>>         }
>>         else {
>>             p_ADCsamples = &sbuf1[0];
>>        }
>>
>>         /* copy all the data samples into the outgoing packet */
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[8]
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[10]
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[12]
>>         *p_packet++ = *p_ADCsamples++; //tx_packet[14]
>>         *p_packet = *p_ADCsamples; //tx_packet[16]
>>
>>            }
>>
>> The Question is using these two methods I'll have the datas in ecgData
>> array? or I have to intercept p_packet?
>>
>> Thank you.
>>
>>
>>
>> ______________________________**_________________
>> Shimmer-users mailing list
>> [email protected]
>> https://lists.eecs.harvard.**edu/mailman/listinfo/shimmer-**users<https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users>
>>
>
_______________________________________________
Shimmer-users mailing list
[email protected]
https://lists.eecs.harvard.edu/mailman/listinfo/shimmer-users

Reply via email to