00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "config.h"
00017
00018 #ifdef USE_DAC
00019 #include "dac_drv.h"
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00033 void init_dac(void){
00034
00035 Enable_dac();
00036
00037 # if (DAC_INPUT_RIGHT_ADJUST == 1)
00038 Right_adjust_dac_input();
00039 # elif (DAC_INPUT_RIGHT_ADJUST == 0)
00040 Left_adjust_dac_input();
00041 # else
00042 # error (ADC_RIGHT_ADJUST_RESULT should be 0 or 1... See config.h file)
00043 # endif
00044
00045 # if (DAC_INTERNAL_VREF == 2)
00046 Enable_vcc_vref();
00047 # elif (DAC_INTERNAL_VREF == 1)
00048 Enable_internal_vref();
00049 # elif (DAC_INTERNAL_VREF == 0)
00050 Enable_vcc_vref();
00051 # else
00052 # error (DAC_INTERNAL_VREF should be 0, 1 or 2... See config.h file)
00053 # endif
00054
00055 # if (DAC_OUTPUT_DRIVER == 1)
00056 Enable_dac_output();
00057 # elif (DAC_OUTPUT_DRIVER == 0)
00058 Disable_dac_output();
00059 # else
00060 # error (DAC_OUTPUT_DRIVER should be 0 or 1... See config.h file)
00061 # endif
00062 }
00063
00064 #endif // USE_DAC