4.5 Data encoding for averaged ADC hits¶
When using NDIGO6G12_APP_TYPE_AVRG
, the first two 64-bit words of
crono_packet::data
are the extended header
containing more information, as shown in the following bit table.
Bits |
127 – 38 |
37 – 32 |
31 – 12 |
11 – 0 |
Data |
reserved |
flags |
reserved |
iterations performed |
Details |
|
The following data words contain the raw ADC data mapped to the range of a signed32
integer (−231 to 231 −1). Thus, crono_packet::data
must be cast to int32_t
and crono_packet::length
must be multiplied
by 2 taking into account the extended header. That is,
uint32_t extended_header_length = 2;
uint32_t sample_count = ((pkt->length - extended_header_length) * 2);
int32_t* adc_data = (int32_t*)(pkt->data + extended_header_length);
for (uint32_t i = 0; i < sample_count; i++) {
/* work with adc_data[i] */
}