63 #define ADC_CLOCK_MAX 20000000 66 #define ADC_STARTUP_NORMAL_MAX 40 68 #define ADC_STARTUP_FAST_MAX 12 71 #define ADC_CHANNEL_0 0 72 #define ADC_CHANNEL_1 1 73 #define ADC_CHANNEL_2 2 74 #define ADC_CHANNEL_3 3 75 #define ADC_CHANNEL_4 4 76 #define ADC_CHANNEL_5 5 77 #define ADC_CHANNEL_6 6 78 #define ADC_CHANNEL_7 7 79 #define ADC_CHANNEL_8 8 80 #define ADC_CHANNEL_9 9 81 #define ADC_CHANNEL_10 10 82 #define ADC_CHANNEL_11 11 83 #define ADC_CHANNEL_12 12 84 #define ADC_CHANNEL_13 13 85 #define ADC_CHANNEL_14 14 86 #define ADC_CHANNEL_15 15 96 #define ADC_GetModeReg(pAdc) ((pAdc)->ADC_MR) 98 #define ADC_StartConversion(pAdc) ((pAdc)->ADC_CR = ADC_CR_START) 100 #define ADC_SetCalibMode(pAdc) ((pAdc)->ADC_CR |= ADC_CR_AUTOCAL) 102 #define ADC_EnableChannel(pAdc, dwChannel) {\ 103 (pAdc)->ADC_CHER = (1 << (dwChannel));\ 106 #define ADC_DisableChannel(pAdc, dwChannel) {\ 107 (pAdc)->ADC_CHDR = (1 << (dwChannel));\ 110 #define ADC_EnableIt(pAdc, dwMode) {\ 111 (pAdc)->ADC_IER = (dwMode);\ 114 #define ADC_DisableIt(pAdc, dwMode) {\ 115 (pAdc)->ADC_IDR = (dwMode);\ 118 #define ADC_SetChannelGain(pAdc,dwMode) {\ 119 (pAdc)->ADC_CGR = dwMode;\ 122 #define ADC_SetChannelOffset(pAdc,dwMode) {\ 123 (pAdc)->ADC_COR = dwMode;\ 126 #define ADC_EnableDataReadyIt(pAdc) ((pAdc)->ADC_IER = ADC_IER_DRDY) 128 #define ADC_GetStatus(pAdc) ((pAdc)->ADC_ISR) 130 #define ADC_GetCompareMode(pAdc) (((pAdc)->ADC_EMR)& (ADC_EMR_CMPMODE_Msk)) 132 #define ADC_GetChannelStatus(pAdc) ((pAdc)->ADC_CHSR) 134 #define ADC_GetInterruptMaskStatus(pAdc) ((pAdc)->ADC_IMR) 136 #define ADC_GetLastConvertedData(pAdc) ((pAdc)->ADC_LCDR) 141 extern void ADC_Initialize(Adc *pAdc, uint32_t dwId);
142 extern uint32_t ADC_SetClock(Adc *pAdc, uint32_t dwPres, uint32_t dwMck);
143 extern void ADC_SetTiming(Adc *pAdc, uint32_t dwStartup, uint32_t dwTracking,
144 uint32_t dwSettling);
145 extern void ADC_SetTrigger(Adc *pAdc, uint32_t dwTrgSel);
146 extern void ADC_SetTriggerMode(Adc *pAdc, uint32_t dwMode);
147 extern void ADC_SetLowResolution(Adc *pAdc, uint32_t bEnDis);
148 extern void ADC_SetSleepMode(Adc *pAdc, uint8_t bEnDis);
149 extern void ADC_SetFastWakeup(Adc *pAdc, uint8_t bEnDis);
150 extern void ADC_SetSequenceMode(Adc *pAdc, uint8_t bEnDis);
151 extern void ADC_SetSequence(Adc *pAdc, uint32_t dwSEQ1, uint32_t dwSEQ2);
152 extern void ADC_SetSequenceByList(Adc *pAdc, uint8_t ucChList[],
154 extern void ADC_SetAnalogChange(Adc *pAdc, uint8_t bEnDis);
155 extern void ADC_SetTagEnable(Adc *pAdc, uint8_t bEnDis);
156 extern void ADC_SetCompareChannel(Adc *pAdc, uint32_t dwChannel);
157 extern void ADC_SetCompareMode(Adc *pAdc, uint32_t dwMode);
158 extern void ADC_SetComparisonWindow(Adc *pAdc, uint32_t dwHi_Lo);
159 extern uint8_t ADC_CheckConfiguration(Adc *pAdc, uint32_t dwMcK);
160 extern uint32_t ADC_GetConvertedData(Adc *pAdc, uint32_t dwChannel);
161 extern void ADC_SetTsAverage(Adc *pADC, uint32_t dwAvg2Conv);
162 extern uint32_t ADC_GetTsXPosition(Adc *pADC);
163 extern uint32_t ADC_GetTsYPosition(Adc *pADC);
164 extern uint32_t ADC_GetTsPressure(Adc *pADC);
165 extern void ADC_SetTsDebounce(Adc *pADC, uint32_t dwTime);
166 extern void ADC_SetTsPenDetect(Adc *pADC, uint8_t bEnDis);
167 extern void ADC_SetStartupTime(Adc *pAdc, uint32_t dwUs);
168 extern void ADC_SetTrackingTime(Adc *pAdc, uint32_t dwNs);
169 extern void ADC_SetTriggerPeriod(Adc *pAdc, uint32_t dwPeriod);
170 extern void ADC_SetTsMode(Adc *pADC, uint32_t dwMode);
171 extern void ADC_TsCalibration(Adc *pAdc);