AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/ASF/xmega/drivers/adc/adc.h
static inline void adcch_enable_oversampling (struct adc_channel_config
						*ch_conf,
						enum adcch_sampnum sample,
						uint8_t resolution)
  {
    uint8_t rshift;

    Assert ((resolution >= 12) && (resolution <= 16));

    if (sample >= ADC_SAMPNUM_16X)
      {
	rshift = 4;
      }
    else if (sample == ADC_SAMPNUM_8X)
      {
	rshift = 3;
      }
    else if (sample == ADC_SAMPNUM_4X)
      {
	rshift = 2;
      }
    else
      {
	rshift = 1;
      }

    Assert (rshift >= resolution - 12);
    rshift -= resolution - 12;
    ch_conf->avgctrl = sample | (rshift << ADC_CH_RIGHTSHIFT_gp);
  }
/**
 * \brief Enables ADC channel over-sampling
 *
 * Sets the parameters number of samples and result resolution
 * used during over-sampling.
 *
 * \param ch_conf    Pointer to the ADC channel configuration structure
 * \param sample     Number of samples to accumulate
 * \param resolution result resolution (12 bits to 16 bits)
 *                   15 bits maximum if sample = 8
 *                   14 bits maximum if sample = 4
 *                   13 bits maximum if sample = 2
 *
 * \note Only the AVR XMEGA E family features this setting.
 * \note Check that "ADC_RES_MT12" param is used
 * in adc_set_conversion_parameters() call.
 */
\brief Enables ADC channel over-sampling
Sets the parameters number of samples and result resolution
used during over-sampling.

\param ch_conf    Pointer to the ADC channel configuration structure
\param sample     Number of samples to accumulate
\param resolution result resolution (12 bits to 16 bits)
15 bits maximum if sample = 8
14 bits maximum if sample = 4
13 bits maximum if sample = 2

\note Only the AVR XMEGA E family features this setting.
\note Check that "ADC_RES_MT12" param is used
in adc_set_conversion_parameters() call.
\ brief Enables ADC channel over - sampling Sets the parameters number of samples and result resolution used during over - sampling . \ param ch_conf Pointer to the ADC channel configuration structure \ param sample Number of samples to accumulate \ param resolution result resolution ( 12 bits to 16 bits ) 15 bits maximum if sample = 8 14 bits maximum if sample = 4 13 bits maximum if sample = 2 \ note Only the AVR XMEGA E family features this setting . \ note Check that " ADC_RES_MT12 " param is used in adc_set_conversion_parameters () call .
static inline void adcch_enable_oversampling (struct adc_channel_config
						*ch_conf,
						enum adcch_sampnum sample,
						uint8_t resolution)
  {
    uint8_t rshift;
    Assert ((resolution >= 12) && (resolution <= 16));
    if (sample >= ADC_SAMPNUM_16X)
      {
	rshift = 4;
      }
    else if (sample == ADC_SAMPNUM_8X)
      {
	rshift = 3;
      }
    else if (sample == ADC_SAMPNUM_4X)
      {
	rshift = 2;
      }
    else
      {
	rshift = 1;
      }
    Assert (rshift >= resolution - 12);
    rshift -= resolution - 12;
    ch_conf->avgctrl = sample | (rshift << ADC_CH_RIGHTSHIFT_gp);
  }
static inline void adcch_enable_oversampling ( struct adc_channel_config * ch_conf , enum adcch_sampnum sample , uint8_t resolution ) { uint8_t rshift ; Assert ( ( resolution >= 12 ) && ( resolution <= 16 ) ) ; if ( sample >= ADC_SAMPNUM_16X ) { rshift = 4 ; } else if ( sample == ADC_SAMPNUM_8X ) { rshift = 3 ; } else if ( sample == ADC_SAMPNUM_4X ) { rshift = 2 ; } else { rshift = 1 ; } Assert ( rshift >= resolution - 12 ) ; rshift -= resolution - 12 ; ch_conf -> avgctrl = sample | ( rshift << ADC_CH_RIGHTSHIFT_gp ) ; }
\brief Enables ADC channel over-sampling
 Sets the parameters number of samples and result resolution
 used during over-sampling.
\ brief Enables ADC channel over - sampling Sets the parameters number of samples and result resolution used during over - sampling .