-
Notifications
You must be signed in to change notification settings - Fork 0
/
adc.h
56 lines (39 loc) · 1.28 KB
/
adc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**************************************************************************
* Module: ADC
*
* file name: adc.h
*
* description: header file for ADC driver
*
* Author: Mustafa Mahmoud
*************************************************************************/
#ifndef ADC_H_
#define ADC_H_
#include"common_header.h"
#define MAX_ADC_VALUE 1023
#define ADC_REF_VOLTAGE 2.56
typedef enum{
ARef_VOLT,AVCC_VOLT,Reserved,Internal_VOLT
}ADC_RefrenceVoltage;
typedef enum{
PRE_2,PRE_2_AGAIN_,PRE_4,PRE_8,PRE_16,PRE_32,PRE_64,PRE_128
}ADC_Prescalar;
/* the members of the structure are the configurable parameters
* then make the enum to define the values of the configurable parameters
*/
typedef struct{
ADC_RefrenceVoltage ref_volt;
ADC_Prescalar prescalar;
}ADC_ConfigType;
/************************************************************************
* function prototypes
*************************************************************************/
/*Description:
* function to initialize the ADC
*/
void ADC_Init(const ADC_ConfigType* Config_Ptr);
/* description:
* function to read the analog value and return the digital value
*/
uint16 ADC_readChannel(uint8 channel_num);
#endif /* ADC_H_ */