12#ifndef FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_WIB2FRAME_HPP_
13#define FDDETDATAFORMATS_INCLUDE_FDDETDATAFORMATS_WIB2FRAME_HPP_
92 throw std::out_of_range(
"ADC index out of range");
101 uint16_t adc =
adc_words[word_index] >> first_bit_position;
105 adc |=
adc_words[word_index + 1] << bits_from_first_word;
108 return adc & 0x3FFFu;
117 throw std::out_of_range(
"ADC index out of range");
119 throw std::out_of_range(
"ADC value out of range");
128 uint32_t mask = (1 << (first_bit_position)) - 1;
129 adc_words[word_index] = ((val << first_bit_position) & ~mask) | (
adc_words[word_index] & mask);
134 adc_words[word_index + 1] = ((val >> bits_in_first_word) & mask) | (
adc_words[word_index + 1] & ~mask);