Subversion Repositories NaviCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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