14#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_DAPHNEETHFRAME_HPP_
15#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_DAPHNEETHFRAME_HPP_
94 throw std::out_of_range(
"ADC index out of range");
103 uint16_t adc =
adc_words[word_index] >> first_bit_position;
107 adc |=
adc_words[word_index + 1] << bits_from_first_word;
110 return adc & 0x3FFFu;
120 throw std::out_of_range(
"ADC index out of range");
122 throw std::out_of_range(
"ADC value out of range");
131 uint32_t mask = (1 << (first_bit_position)) - 1;
132 adc_words[word_index] = ((val << first_bit_position) & ~mask) | (
adc_words[word_index] & mask);
137 adc_words[word_index + 1] = ((val >> bits_in_first_word) & mask) | (
adc_words[word_index + 1] & ~mask);