Collaboration diagram for ADC Low Level Fucntions:
![]() |
Functions | |
void | init_adc (void) |
Configures the ADC accordingly to the ADC Define Configuration values. |
|
Configures the ADC accordingly to the ADC Define Configuration values. Take care that you have to select the ports which will be converted as analog inputs thanks to the DIDR0 and DIDR1 registers. Definition at line 35 of file adc_drv.c. References Disable_adc_high_speed_mode, Disable_adc_it, Enable_adc, Enable_adc_high_speed_mode, Enable_adc_it, Enable_all_it, Enable_internal_vref, Enable_vcc_vref, Left_adjust_adc_result, Right_adjust_adc_result, and Set_prescaler. Referenced by hid_task_init(). 00036 { 00037 Enable_adc(); 00038 # if (ADC_RIGHT_ADJUST_RESULT == 1) 00039 Right_adjust_adc_result(); 00040 # elif (ADC_RIGHT_ADJUST_RESULT == 0) 00041 Left_adjust_adc_result(); 00042 # else 00043 # error (ADC_RIGHT_ADJUST_RESULT should be 0 or 1... See config.h file) 00044 # endif 00045 00046 # if (ADC_HIGH_SPEED_MODE == 1) 00047 Enable_adc_high_speed_mode(); 00048 # elif (ADC_HIGH_SPEED_MODE == 0) 00049 Disable_adc_high_speed_mode(); 00050 # else 00051 # error (ADC_HIGH_SPEED_MODE should be 0 or 1... See config.h file) 00052 # endif 00053 00054 # if (ADC_INTERNAL_VREF == 2) 00055 Enable_vcc_vref(); 00056 # elif (ADC_INTERNAL_VREF == 1) 00057 Enable_internal_vref(); 00058 # elif (ADC_INTERNAL_VREF == 0) 00059 Enable_vcc_vref(); 00060 # else 00061 # error (ADC_INTERNAL_VREF should be 0, 1 or 2... See config.h file) 00062 # endif 00063 00064 # if (ADC_IT == 1) 00065 Enable_all_it(); 00066 Enable_adc_it(); 00067 # elif (ADC_IT == 0) 00068 Disable_adc_it(); 00069 # else 00070 # error (ADC_IT should be 0 or 1... See config.h file) 00071 # endif 00072 00073 # if (ADC_PRESCALER == 128) 00074 Set_prescaler(128); 00075 # elif (ADC_PRESCALER == 64) 00076 Set_prescaler(64); 00077 # elif (ADC_PRESCALER == 32) 00078 Set_prescaler(32); 00079 # elif (ADC_PRESCALER == 16) 00080 Set_prescaler(16); 00081 # elif (ADC_PRESCALER == 8) 00082 Set_prescaler( 8); 00083 # elif (ADC_PRESCALER == 4) 00084 Set_prescaler( 4); 00085 # elif (ADC_PRESCALER == 2) 00086 Set_prescaler( 0); 00087 # else 00088 # error (ADC_PRESCALER should be 2, 4, 8, 16, 32, 64 or 128... See config.h file) 00089 # endif 00090 }
|