Alarm Sensor Module  0.1
⇒ back to Project Page
adc.h
Go to the documentation of this file.
1 /***************************************************************************
31 ***************************************************************************/
32 
33 
34 #ifndef ADC_H_INCLUDED
35 #define ADC_H_INCLUDED
36 
37 
38 /******************************************
39  \internal
40  General definitions
41 *******************************************/
42 
43 #define ADC_UNKNOWN_ERROR 0xffffffff //error value for wrong A/D conversion (for unknown reason)
44 #define ADC_PIN_ERROR 0xfffffffe //wrong pin configuration for A/D conversion
45 #define ADC_FREQUENCY_ERROR 0xfffffffd //wrong sample frequency requested
46 #define ADC_NUMBERCYCLES_ERROR 0xfffffffc //wrong number of conversion cycles
47 
48 #define MAX_NUMBER_ADC_CYCLES 838 //number of possible single shot cycles (overflow avoidance)
49 #define MIN_ADC_FREQUENCY 50 //lowest ADC sampling frequency [kHz]
50 #define MAX_ADC_FREQUENCY 200 //highest ADC sampling frequency [kHz]
51 
52 #define ADC_REF_AREF 0x0 //Reference Voltage: AREF, internal VREF turned off
53 #define ADC_REF_AVCC 0x1 //Reference Voltage: AVCC, with external capacitor at AREF pin
54 #define ADC_REF_VREF 0x3 //Reference Voltage: internal VREF (2,56 V) with external capacitor at AREF pin
55 
56 
57 
58 /******************************************
59  \internal
60  Function definitions
61 *******************************************/
62 
63 uint32_t single_adc_read(uint8_t vref_reg, uint16_t vref_val,
64  uint16_t number_cycles, uint16_t min_freq);
65 void adc_pin_init(void);
66 void adc_pin_deinit(void);
67 
68 
69 #endif // ADC_H_INCLUDED
uint32_t single_adc_read(uint8_t vref_reg, uint16_t vref_val, uint16_t number_cycles, uint16_t min_freq)
Definition: adc.c:74
void adc_pin_init(void)
Definition: adc.c:194
void adc_pin_deinit(void)
Definition: adc.c:222