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