48 #define CR1_DISCNUM_Reset ((uint32_t)0xFFFF1FFF)
51 #define CR1_DISCEN_Set ((uint32_t)0x00000800)
52 #define CR1_DISCEN_Reset ((uint32_t)0xFFFFF7FF)
55 #define CR1_JAUTO_Set ((uint32_t)0x00000400)
56 #define CR1_JAUTO_Reset ((uint32_t)0xFFFFFBFF)
59 #define CR1_JDISCEN_Set ((uint32_t)0x00001000)
60 #define CR1_JDISCEN_Reset ((uint32_t)0xFFFFEFFF)
63 #define CR1_AWDCH_Reset ((uint32_t)0xFFFFFFE0)
66 #define CR1_AWDMode_Reset ((uint32_t)0xFF3FFDFF)
69 #define CR1_CLEAR_Mask ((uint32_t)0xFFF0FEFF)
72 #define CR2_ADON_Set ((uint32_t)0x00000001)
73 #define CR2_ADON_Reset ((uint32_t)0xFFFFFFFE)
76 #define CR2_DMA_Set ((uint32_t)0x00000100)
77 #define CR2_DMA_Reset ((uint32_t)0xFFFFFEFF)
80 #define CR2_RSTCAL_Set ((uint32_t)0x00000008)
83 #define CR2_CAL_Set ((uint32_t)0x00000004)
86 #define CR2_SWSTART_Set ((uint32_t)0x00400000)
89 #define CR2_EXTTRIG_Set ((uint32_t)0x00100000)
90 #define CR2_EXTTRIG_Reset ((uint32_t)0xFFEFFFFF)
93 #define CR2_EXTTRIG_SWSTART_Set ((uint32_t)0x00500000)
94 #define CR2_EXTTRIG_SWSTART_Reset ((uint32_t)0xFFAFFFFF)
97 #define CR2_JEXTSEL_Reset ((uint32_t)0xFFFF8FFF)
100 #define CR2_JEXTTRIG_Set ((uint32_t)0x00008000)
101 #define CR2_JEXTTRIG_Reset ((uint32_t)0xFFFF7FFF)
104 #define CR2_JSWSTART_Set ((uint32_t)0x00200000)
107 #define CR2_JEXTTRIG_JSWSTART_Set ((uint32_t)0x00208000)
108 #define CR2_JEXTTRIG_JSWSTART_Reset ((uint32_t)0xFFDF7FFF)
111 #define CR2_TSVREFE_Set ((uint32_t)0x00800000)
112 #define CR2_TSVREFE_Reset ((uint32_t)0xFF7FFFFF)
115 #define CR2_CLEAR_Mask ((uint32_t)0xFFF1F7FD)
118 #define SQR3_SQ_Set ((uint32_t)0x0000001F)
119 #define SQR2_SQ_Set ((uint32_t)0x0000001F)
120 #define SQR1_SQ_Set ((uint32_t)0x0000001F)
123 #define SQR1_CLEAR_Mask ((uint32_t)0xFF0FFFFF)
126 #define JSQR_JSQ_Set ((uint32_t)0x0000001F)
129 #define JSQR_JL_Set ((uint32_t)0x00300000)
130 #define JSQR_JL_Reset ((uint32_t)0xFFCFFFFF)
133 #define SMPR1_SMP_Set ((uint32_t)0x00000007)
134 #define SMPR2_SMP_Set ((uint32_t)0x00000007)
137 #define JDR_Offset ((uint8_t)0x28)
140 #define DR_ADDRESS ((uint32_t)0x4001244C)
191 else if (ADCx ==
ADC2)
220 uint32_t tmpreg1 = 0;
259 tmpreg1 = ADCx->
SQR1;
265 tmpreg1 |= (uint32_t)tmpreg2 << 20;
267 ADCx->
SQR1 = tmpreg1;
361 itmask = (uint8_t)ADC_IT;
370 ADCx->
CR1 &= (~(uint32_t)itmask);
511 uint32_t tmpreg1 = 0;
512 uint32_t tmpreg2 = 0;
521 tmpreg2 = Number - 1;
522 tmpreg1 |= tmpreg2 << 13;
592 uint32_t tmpreg1 = 0, tmpreg2 = 0;
602 tmpreg1 = ADCx->
SMPR1;
608 tmpreg2 = (uint32_t)ADC_SampleTime << (3 * (ADC_Channel - 10));
612 ADCx->
SMPR1 = tmpreg1;
617 tmpreg1 = ADCx->
SMPR2;
623 tmpreg2 = (uint32_t)ADC_SampleTime << (3 * ADC_Channel);
627 ADCx->
SMPR2 = tmpreg1;
633 tmpreg1 = ADCx->
SQR3;
639 tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 1));
643 ADCx->
SQR3 = tmpreg1;
649 tmpreg1 = ADCx->
SQR2;
655 tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 7));
659 ADCx->
SQR2 = tmpreg1;
665 tmpreg1 = ADCx->
SQR1;
671 tmpreg2 = (uint32_t)ADC_Channel << (5 * (Rank - 13));
675 ADCx->
SQR1 = tmpreg1;
713 return (uint16_t) ADCx->
DR;
810 tmpreg |= ADC_ExternalTrigInjecConv;
932 uint32_t tmpreg1 = 0, tmpreg2 = 0, tmpreg3 = 0;
942 tmpreg1 = ADCx->
SMPR1;
948 tmpreg2 = (uint32_t)ADC_SampleTime << (3*(ADC_Channel - 10));
952 ADCx->
SMPR1 = tmpreg1;
957 tmpreg1 = ADCx->
SMPR2;
963 tmpreg2 = (uint32_t)ADC_SampleTime << (3 * ADC_Channel);
967 ADCx->
SMPR2 = tmpreg1;
971 tmpreg1 = ADCx->
JSQR;
975 tmpreg2 =
JSQR_JSQ_Set << (5 * (uint8_t)((Rank + 3) - (tmpreg3 + 1)));
979 tmpreg2 = (uint32_t)ADC_Channel << (5 * (uint8_t)((Rank + 3) - (tmpreg3 + 1)));
983 ADCx->
JSQR = tmpreg1;
995 uint32_t tmpreg1 = 0;
996 uint32_t tmpreg2 = 0;
1002 tmpreg1 = ADCx->
JSQR;
1006 tmpreg2 = Length - 1;
1007 tmpreg1 |= tmpreg2 << 20;
1009 ADCx->
JSQR = tmpreg1;
1027 __IO uint32_t tmp = 0;
1034 tmp = (uint32_t)ADCx;
1035 tmp += ADC_InjectedChannel;
1038 *(
__IO uint32_t *) tmp = (uint32_t)Offset;
1054 __IO uint32_t tmp = 0;
1060 tmp = (uint32_t)ADCx;
1064 return (uint16_t) (*(
__IO uint32_t*) tmp);
1084 uint32_t tmpreg = 0;
1093 tmpreg |= ADC_AnalogWatchdog;
1108 uint16_t LowThreshold)
1115 ADCx->
HTR = HighThreshold;
1117 ADCx->
LTR = LowThreshold;
1147 uint32_t tmpreg = 0;
1156 tmpreg |= ADC_Channel;
1202 if ((ADCx->
SR & ADC_FLAG) != (uint8_t)
RESET)
1234 ADCx->
SR = ~(uint32_t)ADC_FLAG;
1250 uint32_t itmask = 0, enablestatus = 0;
1255 itmask = ADC_IT >> 8;
1257 enablestatus = (ADCx->
CR1 & (uint8_t)ADC_IT) ;
1259 if (((ADCx->
SR & itmask) != (uint32_t)
RESET) && enablestatus)
1290 itmask = (uint8_t)(ADC_IT >> 8);
1292 ADCx->
SR = ~(uint32_t)itmask;