4.3 Data encoding for ADC hits¶
data
, that is, the packet-data payload,
depends on ndigo6g12_configuration::output_mode
. The length of
the data
array is encoded in length
. Be
aware that length
is in multiples of 64 bit, while
the size of the fields of data
depends on
type
.
Thus, reading packet data requires the following steps:
Depending on
crono_packet::type
, multiplylength
appropriately. E.g., iftype
isCRONO_PACKET_TYPE_16_BIT_SIGNED
,length
has to be multiplied by 4 (since 4 \(\times\) 16 bit = 64 bit).Cast
data
according totype
. E.g., iftype
isCRONO_PACKET_TYPE_16_BIT_SIGNED
, castdata
toint16_t
.
4.3.1 NDIGO6G12_OUTPUT_MODE_SIGNED16
¶
Raw data of the ADC is mapped to the range of a signed16 integer (−32768 to
32767). Packet data must be cast to int16_t
.
4.3.2 NDIGO6G12_OUTPUT_MODE_RAW
¶
Packet data is returned in the native range of the ADC (0 to 4095).
It must be cast to int16_t
.
Data layout:
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
… |
0 |
Data |
0 |
0 |
control bits |
sample data |
4.3.3 NDIGO6G12_OUTPUT_MODE_RAW_NO_CB
¶
Packet data is returned in the native range of the ADC (0 to 4095).
It must be cast to int16_t
. Unlike
NDIGO6G12_OUTPUT_MODE_RAW
, it does not contain control bits.
Attention
NDIGO6G12_OUTPUT_MODE_RAW
and NDIGO6G12_OUTPUT_MODE_RAW_NO_CB
are useful for debugging purposes.
They are not supported for user applications. Use
NDIGO6G12_OUTPUT_MODE_SIGNED16
instead.
4.3.4 NDIGO6G12_OUTPUT_MODE_SIGNED32
¶
Only used if ndigo6g12_init_parameters::application_type
is
NDIGO6G12_APP_TYPE_AVRG
. See Section 4.5 for more
information.