Subversion Repositories NaviCtrl

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : 91x_adc.h
3
* Author             : MCD Application Team
4
* Date First Issued  : 05/18/2006 : Version 1.0
5
* Description        : This file contains all the functions prototypes for the
6
*                      ADC software library.
7
********************************************************************************
8
* History:
9
* 05/22/2007 : Version 1.2
10
* 05/24/2006 : Version 1.1
11
* 05/18/2006 : Version 1.0
12
********************************************************************************
13
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
14
* CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS
15
* A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
16
* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
17
* OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
18
* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19
*******************************************************************************/
20
 
21
 
22
/* Define to prevent recursive inclusion ------------------------------------ */
23
 
24
#ifndef __91x_ADC_H
25
#define __91x_ADC_H
26
 
27
/* Includes ------------------------------------------------------------------*/
28
 
29
#include "91x_map.h"
30
 
31
/* Exported types ------------------------------------------------------------*/
32
 
33
/* ADC Init structure define */
34
typedef struct
35
{
36
  u16 ADC_WDG_High_Threshold;
37
  u16 ADC_WDG_Low_Threshold;
38
  u16 ADC_Channel_0_Mode;
39
  u16 ADC_Channel_1_Mode;
40
  u16 ADC_Channel_2_Mode;
41
  u16 ADC_Channel_3_Mode;
42
  u16 ADC_Channel_4_Mode;
43
  u16 ADC_Channel_5_Mode;
44
  u16 ADC_Channel_6_Mode;
45
  u16 ADC_Channel_7_Mode;
46
  u16 ADC_Select_Channel;
47
  FunctionalState ADC_Scan_Mode;
48
  u16 ADC_Conversion_Mode;
49
}ADC_InitTypeDef;
50
 
51
/* ADC watchdog thresholds */
52
typedef enum
53
{
54
  ADC_HighThreshold,
55
  ADC_LowThreshold
56
}ADC_ThresholdType;
57
 
58
/* Exported constants --------------------------------------------------------*/
59
 
60
/* ADC channels */
61
#define   ADC_Channel_0     0x00      /* Channel 0 */
62
#define   ADC_Channel_1     0x01      /* Channel 1 */
63
#define   ADC_Channel_2     0x02      /* Channel 2 */
64
#define   ADC_Channel_3     0x03      /* Channel 3 */
65
#define   ADC_Channel_4     0x04      /* Channel 4 */
66
#define   ADC_Channel_5     0x05      /* Channel 5 */
67
#define   ADC_Channel_6     0x06      /* Channel 6 */
68
#define   ADC_Channel_7     0x07      /* Channel 7 */
69
 
70
/* ADC modes */
71
#define   ADC_Continuous_Mode    0x0010 /* Continuous mode conversion */
72
#define   ADC_Single_Mode        0xFFEF /* Single mode conversion     */
73
 
74
/* ADC Flags */
75
#define   ADC_FLAG_ECV         0x002F      /* End of Conversion Flag      */
76
#define   ADC_FLAG_AWD         0x002E      /* Analog WatchDog Flag        */
77
 
78
#define   ADC_FLAG_OV_CH_0     0x00CF      /* Overflow Flag for channel 0 */
79
#define   ADC_FLAG_OV_CH_1     0x00EF      /* Overflow Flag for channel 1 */
80
#define   ADC_FLAG_OV_CH_2     0x010F      /* Overflow Flag for channel 2 */
81
#define   ADC_FLAG_OV_CH_3     0x012F      /* Overflow Flag for channel 3 */
82
#define   ADC_FLAG_OV_CH_4     0x014F      /* Overflow Flag for channel 4 */
83
#define   ADC_FLAG_OV_CH_5     0x016F      /* Overflow Flag for channel 5 */
84
#define   ADC_FLAG_OV_CH_6     0x018F      /* Overflow Flag for channel 6 */
85
#define   ADC_FLAG_OV_CH_7     0x01AF      /* Overflow Flag for channel 7 */
86
 
87
/* ADC conversion modes */
88
#define ADC_NoThreshold_Conversion      0x0003   /* Conversion w/o thresholds */
89
#define ADC_LowThreshold_Conversion     0x0002   /* Low threshold conversion  */
90
#define ADC_HighThreshold_Conversion    0x0001   /* High threshold conversion */
91
#define ADC_No_Conversion               0x0000   /* No ADC conversion         */
92
 
93
/* ADC interrupts */
94
#define   ADC_IT_ECV     0x0400     /* End of Conversion Interrupt */
95
#define   ADC_IT_AWD     0x0200     /* Analog Watchdog Interrupt   */
96
 
97
/* ADC Start/Stop conversion */
98
#define     ADC_Conversion_Start     0x0001     /* ADC start conversion */
99
#define     ADC_Conversion_Stop      0xFFFE     /* ADC stop conversion  */
100
 
101
/* Module private variables --------------------------------------------------*/
102
/* Exported macro ------------------------------------------------------------*/
103
/* Private functions ---------------------------------------------------------*/
104
/* Exported functions ------------------------------------------------------- */
105
 
106
void ADC_DeInit(void);
107
void ADC_Init(ADC_InitTypeDef* ADC_InitStruct);
108
void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct);
109
void ADC_PrescalerConfig(u8 ADC_Prescaler);
110
u8 ADC_GetPrescalerValue(void);
111
FlagStatus ADC_GetFlagStatus(u16 ADC_Flag);
112
void ADC_ClearFlag(u16 ADC_Flag);
113
u16 ADC_GetConversionValue(u16 ADC_Channel);
114
FlagStatus ADC_GetAnalogWatchdogResult(u16 ADC_Channel);
115
void ADC_ClearAnalogWatchdogResult(u16 ADC_Channel);
116
u16 ADC_GetWatchdogThreshold(ADC_ThresholdType ADC_Threshold);
117
void ADC_ITConfig(u16 ADC_IT, FunctionalState ADC_NewState);
118
void ADC_StandbyModeCmd(FunctionalState ADC_NewState);
119
void ADC_Cmd(FunctionalState ADC_NewState);
120
void ADC_ConversionCmd(u16 ADC_Conversion);
121
 
122
#endif /* __91x_ADC_H */
123
 
124
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
125