Alarm Sensor Module  0.1
⇒ back to Project Page

◆ single_adc_read()

uint32_t single_adc_read ( uint8_t  vref_reg,
uint16_t  vref_val,
uint16_t  number_cycles,
uint16_t  min_freq 
)

Performs an A/D conversion. Converts the input value for the specified number of cycles and returns the mean value of all conversion cycles.

Parameters
[in]v_ref_regreference voltage (content of REFS0 and REFS1)
[in]v_ref_valreference voltage [mV]
[in]number_cyclesnumber of cycles for conversion
[in]min_freqminimum frequency for conversion [Hz]
Returns
ADC_UNKNOWN_ERROR in case of an unknown error
ADC_PIN_ERROR if the ADC pin has not the correct configuration
ADC_NUMBERCYCLES_ERROR if the specified number of cycles exceeds MAX_NUMBER_ADC_CYCLES
ADC_FREQUENCY_ERROR if the specified min frequency is outside of the ranges defined by MIN_ADC_FREQUENCY and MAX_ADC_FREQUENCY
in case of no error: mean A/D value in mV
Date
  • Created 01.02.2019
  • Modified 01.02.2019
See also
port_definitions.h
Author
Michael Skutek, micha.nosp@m.el@s.nosp@m.kutek.nosp@m..de

Definition at line 74 of file adc.c.

Referenced by main().

Here is the caller graph for this function: