Header file for ADC module.
More...
Go to the source code of this file.
Header file for ADC module.
Definition in file adc.h.
◆ ADC_getValue()
Get Value of ADCIN-Pin.
- Parameters
-
[in] | | 1) adc_pin --> valid value:ADCINA0-ADCINB7
|
- Returns
- Result of operations as int16
--> 0-4095 = operation successful --> value of ADCRESULT-Register
--> -1 = invalid value of adc_pin
Definition at line 56 of file adc.c.
58 case 0 ... 15: TMC_BASE_ADC->TRL2 = 0x2000;
59 __asm(
" RPT #255 || NOP");
60 return (TMC_BASE_ADC_RESULT->RESULT[adc_pin]);
◆ init_ADC()
Init ADC.
- Parameters
-
- Returns
- /
Definition at line 16 of file adc.c.
21 TMC_BASE_SCR->HISPCP = 0x3;
25 __asm(
" RPT #10 || NOP");
27 TMC_BASE_ADC->TRL1 |= (0x1 << 4);
28 TMC_BASE_ADC->TRL3 |= (0x1);
29 TMC_BASE_ADC->MAXCONV |= (0x0007);
31 TMC_BASE_ADC->CHSELSEQ1 &= ~(0xF);
32 TMC_BASE_ADC->CHSELSEQ1 |= (0x1 << 4);
33 TMC_BASE_ADC->CHSELSEQ1 |= (0x2 << 8);
34 TMC_BASE_ADC->CHSELSEQ1 |= (0x3 << 12);
35 TMC_BASE_ADC->CHSELSEQ2 |= (0x4);
36 TMC_BASE_ADC->CHSELSEQ2 |= (0x5 << 4);
37 TMC_BASE_ADC->CHSELSEQ2 |= (0x6 << 8);
38 TMC_BASE_ADC->CHSELSEQ2 |= (0x7 << 12);
40 TMC_BASE_ADC->TRL3 |= 0x00E0;
42 for(i=0; i<3000; i++){
43 __asm(
" RPT #255 || NOP");
46 TMC_BASE_ADC->TRL2 = 0x2000;