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;
#define IS_ADC_INJECTED_RANK(RANK)
#define IS_ADC_MODE(MODE)
#define CR2_EXTTRIG_SWSTART_Reset
#define IS_ADC_INJECTED_CHANNEL(CHANNEL)
uint32_t ADC_ExternalTrigConv
#define IS_ADC_ANALOG_WATCHDOG(WATCHDOG)
void ADC_ClearITPendingBit(ADC_TypeDef *ADCx, uint16_t ADC_IT)
Clears the ADCx's interrupt pending bits.
#define CR2_JEXTTRIG_JSWSTART_Set
void ADC_RegularChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
Configures for the selected ADC regular channel its corresponding rank in the sequencer and its sampl...
void ADC_Cmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the specified ADC peripheral.
void ADC_ClearFlag(ADC_TypeDef *ADCx, uint8_t ADC_FLAG)
Clears the ADCx's pending flags.
void ADC_DiscModeChannelCountConfig(ADC_TypeDef *ADCx, uint8_t Number)
Configures the discontinuous mode for the selected ADC regular group channel.
void ADC_StructInit(ADC_InitTypeDef *ADC_InitStruct)
Fills each ADC_InitStruct member with its default value.
ADC Init structure definition.
ITStatus ADC_GetITStatus(ADC_TypeDef *ADCx, uint16_t ADC_IT)
Checks whether the specified ADC interrupt has occurred or not.
void ADC_InjectedSequencerLengthConfig(ADC_TypeDef *ADCx, uint8_t Length)
Configures the sequencer length for injected channels.
Analog to Digital Converter.
#define CR2_JEXTSEL_Reset
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef *ADCx, uint16_t HighThreshold, uint16_t LowThreshold)
Configures the high and low thresholds of the analog watchdog.
#define ADC_Mode_Independent
void ADC_ITConfig(ADC_TypeDef *ADCx, uint16_t ADC_IT, FunctionalState NewState)
Enables or disables the specified ADC interrupts.
void ADC_Init(ADC_TypeDef *ADCx, ADC_InitTypeDef *ADC_InitStruct)
Initializes the ADCx peripheral according to the specified parameters in the ADC_InitStruct.
FunctionalState ADC_ContinuousConvMode
#define RCC_APB2Periph_ADC3
uint16_t ADC_GetInjectedConversionValue(ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel)
Returns the ADC injected channel conversion result.
#define IS_ADC_CHANNEL(CHANNEL)
#define IS_ADC_GET_FLAG(FLAG)
#define IS_ADC_REGULAR_DISC_NUMBER(NUMBER)
#define CR2_TSVREFE_Reset
#define IS_ADC_REGULAR_RANK(RANK)
void assert_param(int val)
void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel)
Configures the analog watchdog guarded single channel.
#define IS_ADC_THRESHOLD(THRESHOLD)
#define IS_FUNCTIONAL_STATE(STATE)
#define RCC_APB2Periph_ADC2
#define CR2_JEXTTRIG_JSWSTART_Reset
#define CR2_EXTTRIG_Reset
#define RCC_APB2Periph_ADC1
uint32_t ADC_GetDualModeConversionValue(void)
Returns the last ADC1 and ADC2 conversion result data in dual mode.
void ADC_InjectedDiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the discontinuous mode for injected group channel for the specified ADC...
#define CR2_EXTTRIG_SWSTART_Set
#define CR1_DISCNUM_Reset
FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef *ADCx)
Gets the selected ADC reset calibration registers status.
uint16_t ADC_GetConversionValue(ADC_TypeDef *ADCx)
Returns the last ADCx conversion result data for regular channel.
This file contains all the functions prototypes for the ADC firmware library.
void ADC_DeInit(ADC_TypeDef *ADCx)
Deinitializes the ADCx peripheral registers to their default reset values.
#define IS_ADC_DMA_PERIPH(PERIPH)
#define ADC_ExternalTrigConv_T1_CC1
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef *ADCx)
Gets the selected ADC Software start injected conversion Status.
#define IS_ADC_CLEAR_FLAG(FLAG)
void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the specified ADC DMA request.
#define IS_ADC_SAMPLE_TIME(TIME)
FlagStatus ADC_GetFlagStatus(ADC_TypeDef *ADCx, uint8_t ADC_FLAG)
Checks whether the specified ADC flag is set or not.
void ADC_SoftwareStartConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the selected ADC software start conversion .
This file contains all the functions prototypes for the RCC firmware library.
#define IS_ADC_EXT_INJEC_TRIG(INJTRIG)
void ADC_InjectedChannelConfig(ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
Configures for the selected ADC injected channel its corresponding rank in the sequencer and its samp...
void ADC_SetInjectedOffset(ADC_TypeDef *ADCx, uint8_t ADC_InjectedChannel, uint16_t Offset)
Set the injected channels conversion value offset.
#define CR1_AWDMode_Reset
void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
Forces or releases High Speed APB (APB2) peripheral reset.
void ADC_StartCalibration(ADC_TypeDef *ADCx)
Starts the selected ADC calibration process.
#define IS_ADC_OFFSET(OFFSET)
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef *ADCx)
Gets the selected ADC Software start conversion Status.
void ADC_TempSensorVrefintCmd(FunctionalState NewState)
Enables or disables the temperature sensor and Vrefint channel.
#define IS_ADC_GET_IT(IT)
#define IS_ADC_INJECTED_LENGTH(LENGTH)
FunctionalState ADC_ScanConvMode
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef *ADCx)
Gets the selected ADC calibration status.
void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the discontinuous mode on regular group channel for the specified ADC...
void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef *ADCx, uint32_t ADC_ExternalTrigInjecConv)
Configures the ADCx external trigger for injected channels conversion.
#define CR2_JEXTTRIG_Reset
#define IS_ADC_DATA_ALIGN(ALIGN)
#define IS_ADC_ALL_PERIPH(PERIPH)
void ADC_ResetCalibration(ADC_TypeDef *ADCx)
Resets the selected ADC calibration registers.
#define CR1_JDISCEN_Reset
#define ADC_DataAlign_Right
void ADC_ExternalTrigConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the ADCx conversion through external trigger.
#define IS_ADC_REGULAR_LENGTH(LENGTH)
#define IS_ADC_EXT_TRIG(REGTRIG)
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the selected ADC start of the injected channels conversion.
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the ADCx injected channels conversion through external trigger.
void ADC_AutoInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
Enables or disables the selected ADC automatic injected group conversion after regular one...
void ADC_AnalogWatchdogCmd(ADC_TypeDef *ADCx, uint32_t ADC_AnalogWatchdog)
Enables or disables the analog watchdog on single/all regular or injected channels.