本文整理汇总了C++中IS_ADC_ALL_PERIPH函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_ADC_ALL_PERIPH函数的具体用法?C++ IS_ADC_ALL_PERIPH怎么用?C++ IS_ADC_ALL_PERIPH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_ADC_ALL_PERIPH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ADC_InjectedSequencerLengthConfig
/**
* @brief Configures the sequencer length for injected channels
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @param Length: The sequencer length.
* This parameter must be a number between 1 to 4.
* @retval None
*/
void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, uint8_t Length)
{
uint32_t tmpreg1 = 0;
uint32_t tmpreg2 = 0;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_INJECTED_LENGTH(Length));
/* Get the old register value */
tmpreg1 = ADCx->JSQR;
/* Clear the old injected sequnence lenght JL bits */
tmpreg1 &= JSQR_JL_Reset;
/* Set the injected sequnence lenght JL bits */
tmpreg2 = Length - 1;
tmpreg1 |= tmpreg2 << 20;
/* Store the new register value */
ADCx->JSQR = tmpreg1;
}
示例2: ADC_ExternalTrigInjectedConvCmd
/**
* @brief Enables or disables the ADCx injected channels conversion
* through external trigger
* @param ADCx: where x can be 1, 2 to select the ADC peripheral.
* @param NewState: new state of the selected ADC external trigger
* start of injected conversion.
* This parameter can be: ENABLE or DISABLE.
* @retval : None
*/
void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected ADC external event selection for injected group */
//ADCx->CR2 |= CR2_JEXTTRIG_Set;
ADCx->ADCR |= ADCR_EXTTRIG_Set;
}
else
{
/* Disable the selected ADC external event selection for injected group */
//ADCx->CR2 &= CR2_JEXTTRIG_Reset;
ADCx->ADCR &= ADCR_EXTTRIG_Reset;
}
}
示例3: ADC_ITConfig
/**
* @brief Enables or disables the specified ADC interrupts.
* @param ADCx: where x can be 1 to select the ADC peripheral.
* @param ADC_IT: specifies the ADC interrupt sources to be enabled or disabled.
* This parameter can be one of the following values:
* @arg ADC_IT_ADRDY: ADC ready interrupt
* @arg ADC_IT_EOSMP: End of sampling interrupt
* @arg ADC_IT_EOC: End of conversion interrupt
* @arg ADC_IT_EOSEQ: End of sequence of conversion interrupt
* @arg ADC_IT_OVR: overrun interrupt
* @arg ADC_IT_AWD: Analog watchdog interrupt
* @param NewState: new state of the specified ADC interrupts.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void ADC_ITConfig(ADC_TypeDef* ADCx, uint32_t ADC_IT, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
assert_param(IS_ADC_CONFIG_IT(ADC_IT));
if (NewState != DISABLE)
{
/* Enable the selected ADC interrupts */
ADCx->IER |= ADC_IT;
}
else
{
/* Disable the selected ADC interrupts */
ADCx->IER &= (~(uint32_t)ADC_IT);
}
}
示例4: ADC_JitterCmd
/**
* @brief Enables or disables the jitter when the ADC is clocked by PCLK div2
* or div4
* @note This function is obsolete and maintained for legacy purpose only. ADC_ClockModeConfig()
* function should be used instead.
* @param ADCx: where x can be 1 to select the ADC1 peripheral.
* @param ADC_JitterOff: This parameter can be :
* @arg ADC_JitterOff_PCLKDiv2: Remove jitter when ADC is clocked by PLCK divided by 2
* @arg ADC_JitterOff_PCLKDiv4: Remove jitter when ADC is clocked by PLCK divided by 4
* @param NewState: new state of the ADCx jitter.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void ADC_JitterCmd(ADC_TypeDef* ADCx, uint32_t ADC_JitterOff, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_JITTEROFF(ADC_JitterOff));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Disable Jitter */
ADCx->CFGR2 |= (uint32_t)ADC_JitterOff;
}
else
{
/* Enable Jitter */
ADCx->CFGR2 &= (uint32_t)(~ADC_JitterOff);
}
}
示例5: ADC_SoftwareStartInjectedConvCmd
/**
* @brief Enables or disables the selected ADC start of the injected
* channels conversion.
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @param NewState: new state of the selected ADC software start injected conversion.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected ADC conversion for injected group on external event and start the selected
ADC injected conversion */
ADCx->CR2 |= CR2_JEXTTRIG_JSWSTART_Set;
}
else
{
/* Disable the selected ADC conversion on external event for injected group and stop the selected
ADC injected conversion */
ADCx->CR2 &= CR2_JEXTTRIG_JSWSTART_Reset;
}
}
示例6: ADC_GetSoftwareStartConvStatus
/**
* @brief Gets the selected ADC Software start conversion Status.
* @param ADCx: where x can be 1, 2 to select the ADC peripheral.
* @retval : The new state of ADC software start conversion (SET or RESET).
*/
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx)
{
FlagStatus bitstatus = RESET;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
/* Check the status of ADST bit */
if ((ADCx->ADCR & ADCR_SWSTART_Set) != (uint32_t)RESET)
{
/* ADST bit is set */
bitstatus = SET;
}
else
{
/* ADST bit is reset */
bitstatus = RESET;
}
/* Return the ADST bit status */
return bitstatus;
}
示例7: ADC_DiscModeChannelCountConfig
/*******************************************************************************
* 函数名称: ADC_DiscModeChannelCountConfig
* 功能描述: 配置选中的ADC常规组为非连续模式.
* 输入参数: (1)ADCx:其中x可以是1、2或3,用来选择ADC外围模块.
* (2)Number:非连续模式下常规信道计数值。该值范围为1-8。
* 输出参数: 无
* 返回参数: 无
*******************************************************************************/
void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, u8 Number)
{
u32 tmpreg1 = 0;
u32 tmpreg2 = 0;
/* Check the parameters [检查参数] */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_REGULAR_DISC_NUMBER(Number));
/* Get the old register value [取得过去的寄存器值]*/
tmpreg1 = ADCx->CR1;
/* Clear the old discontinuous mode channel count [清除过去的不间断模式通道计数器]*/
tmpreg1 &= CR1_DISCNUM_Reset;
/* Set the discontinuous mode channel count [设置不间断模式通道计数器]*/
tmpreg2 = Number - 1;
tmpreg1 |= tmpreg2 << 13;
/* Store the new register value [存储新的寄存器值]*/
ADCx->CR1 = tmpreg1;
}
示例8: ADC_SoftwareStartConvCmd
/*******************************************************************************
* 函数名称: ADC_SoftwareStartConvCmd
* 功能描述: 使能/禁止选中的ADC由软件控制开始转换 .
* 输入参数: (1)ADCx:其中x可以是1、2或3,用来选择ADC外围模块.
* (2)NewState:选中的由软件发出开始信号的ADC的新状态这个参数可以是:ENABLE或DISABLE
* 输出参数: 无
* 返回参数: 无
*******************************************************************************/
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
{
/* Check the parameters [检查参数] */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected ADC conversion on external event and start the selected
ADC conversion [允许选择的ADC转换外部事件和启动选择的ADC转换]*/
ADCx->CR2 |= CR2_EXTTRIG_SWSTART_Set;
}
else
{
/* Disable the selected ADC conversion on external event and stop the selected
ADC conversion [禁止选择的ADC转换外部事件和停止选择的ADC转换]*/
ADCx->CR2 &= CR2_EXTTRIG_SWSTART_Reset;
}
}
示例9: ADC_GetCalibrationStatus
/**
* @brief Gets the selected ADC calibration status.
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @retval The new state of ADC calibration (SET or RESET).
*/
FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef* ADCx)
{
FlagStatus bitstatus = RESET;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
/* Check the status of CAL bit */
if ((ADCx->CR2 & CR2_CAL_Set) != (uint32_t)RESET)
{
/* CAL bit is set: calibration on going */
bitstatus = SET;
}
else
{
/* CAL bit is reset: end of calibration */
bitstatus = RESET;
}
/* Return the CAL bit status */
return bitstatus;
}
示例10: ADC_GetSoftwareStartInjectedConvCmdStatus
/**
* @brief Gets the selected ADC Software start injected conversion Status.
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @retval The new state of ADC software start injected conversion (SET or RESET).
*/
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx)
{
FlagStatus bitstatus = RESET;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
/* Check the status of JSWSTART bit */
if ((ADCx->CR2 & CR2_JSWSTART_Set) != (uint32_t)RESET)
{
/* JSWSTART bit is set */
bitstatus = SET;
}
else
{
/* JSWSTART bit is reset */
bitstatus = RESET;
}
/* Return the JSWSTART bit status */
return bitstatus;
}
示例11: ADC_InjectedSequencerLengthConfig
/*******************************************************************************
* 函数名称: ADC_InjectedSequencerLengthConfig
* 功能描述: 配置注入信道音序器(sequencer)的长度
* 输入参数: (1)ADCx:其中x可以是1、2或3,用来选择ADC外围模块.
* (2)Length:音序器(sequencer)的长度该参数的范围是1-4.
* 输出参数: 无
* 返回参数: 无
*******************************************************************************/
void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, u8 Length)
{
u32 tmpreg1 = 0;
u32 tmpreg2 = 0;
/* Check the parameters [检查参数] */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_INJECTED_LENGTH(Length));
/* Get the old register value [取得旧的寄存器值]*/
tmpreg1 = ADCx->JSQR;
/* Clear the old injected sequnence lenght JL bits [清除注入信道音序器的长度JL位]*/
tmpreg1 &= JSQR_JL_Reset;
/* Set the injected sequnence lenght JL bits [置位注入信道音序器的长度JL位]*/
tmpreg2 = Length - 1;
tmpreg1 |= tmpreg2 << 20;
/* Store the new register value [存储新的寄存器值]*/
ADCx->JSQR = tmpreg1;
}
示例12: ADC_SoftwareStartConvCmd
/**
* @brief Enables or disables the selected ADC software start conversion .
* @param ADCx: where x can be 1, 2 to select the ADC peripheral.
* @param NewState: new state of the selected ADC software start conversion.
* This parameter can be: ENABLE or DISABLE.
* @retval : None
*/
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected ADC conversion on external event and start the selected
ADC conversion */
/*Set ADST bit*/
ADCx->ADCR |= ADCR_SWSTART_Set;
}
else
{
/* Disable the selected ADC conversion on external event and stop the selected
ADC conversion */
ADCx->ADCR &= ADCR_SWSTART_Reset;
}
}
示例13: ADC_Init
/**
* @brief Initializes the ADCx peripheral according to the specified parameters
* in the ADC_InitStruct.
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @param ADC_InitStruct: pointer to an ADC_InitTypeDef structure that
* contains the configuration information for the specified
* ADC peripheral.
* @retval : None
*/
void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct)
{
uint32_t tmpreg1 = 0;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_MODE(ADC_InitStruct->ADC_Mode));
assert_param(IS_FUNCTIONAL_STATE(ADC_InitStruct->ADC_ScanConvMode));
assert_param(IS_FUNCTIONAL_STATE(ADC_InitStruct->ADC_ContinuousConvMode));
assert_param(IS_ADC_EXT_TRIG(ADC_InitStruct->ADC_ExternalTrigConv));
assert_param(IS_ADC_DATA_ALIGN(ADC_InitStruct->ADC_DataAlign));
assert_param(IS_ADC_REGULAR_LENGTH(ADC_InitStruct->ADC_NbrOfChannel));
/*---------------------------- ADCx ADCFG Configuration -----------------*/
/* Get the ADCx ADCFG value */
tmpreg1 = ADCx->ADCFG;
/* Clear ADCPRE bits */
tmpreg1 &= ADCFG_CLEAR_Mask;
/* Configure ADCx: AD convertion prescare*/
/* Set ADCPRE bit according to ADC_PRESCARE value */
tmpreg1 |= (uint32_t)(ADC_InitStruct->ADC_PRESCARE);
/* Write to ADCx ADCFG */
ADCx->ADCFG = tmpreg1;
/*---------------------------- ADCx ADCR Configuration -----------------*/
/* Get the ADCx ADCR value */
tmpreg1 = ADCx->ADCR;
/* Clear ALIGN , ADMD, and TRGEN and TRGSEL bits */
tmpreg1 &= ADCR_CLEAR_Mask;
/* Configure ADCx: external trigger event and AD conversion mode and ALIGN*/
/* Set ALIGN bit according to ADC_DataAlign value */
/* Set TRGEN bits according to ADC_TRGEN value */
/* Set TRGSEL bits according to ADC_ExternalTrigConv value */
/* Set ADMD bit according to ADC_Mode value */
/*tmpreg1 |= ((uint32_t)ADC_InitStruct->ADC_DataAlign) | ADC_InitStruct->ADC_ExternalTrigConv |
((uint32_t)ADC_InitStruct->ADC_Mode) | ((uint32_t)ADC_InitStruct->ADC_TRGEN);*/
tmpreg1 |= ((uint32_t)ADC_InitStruct->ADC_DataAlign) |
((uint32_t)ADC_InitStruct->ADC_Mode) | (((uint32_t)ADC_InitStruct->ADC_TRGEN)<<2);
/* Write to ADCx ADCR */
ADCx->ADCR = tmpreg1;
}
示例14: ADC_AnalogWatchdogSingleChannelConfig
/**
* @brief Configures the analog watchdog guarded single channel
* @param ADCx: where x can be 1 to select the ADC1 peripheral.
* @param ADC_AnalogWatchdog_Channel: the ADC channel to configure for the analog watchdog.
* This parameter can be one of the following values:
* @arg ADC_AnalogWatchdog_Channel_0: ADC Channel0 selected
* @arg ADC_AnalogWatchdog_Channel_1: ADC Channel1 selected
* @arg ADC_AnalogWatchdog_Channel_2: ADC Channel2 selected
* @arg ADC_AnalogWatchdog_Channel_3: ADC Channel3 selected
* @arg ADC_AnalogWatchdog_Channel_4: ADC Channel4 selected
* @arg ADC_AnalogWatchdog_Channel_5: ADC Channel5 selected
* @arg ADC_AnalogWatchdog_Channel_6: ADC Channel6 selected
* @arg ADC_AnalogWatchdog_Channel_7: ADC Channel7 selected
* @arg ADC_AnalogWatchdog_Channel_8: ADC Channel8 selected
* @arg ADC_AnalogWatchdog_Channel_9: ADC Channel9 selected
* @arg ADC_AnalogWatchdog_Channel_10: ADC Channel10 selected
* @arg ADC_AnalogWatchdog_Channel_11: ADC Channel11 selected
* @arg ADC_AnalogWatchdog_Channel_12: ADC Channel12 selected
* @arg ADC_AnalogWatchdog_Channel_13: ADC Channel13 selected
* @arg ADC_AnalogWatchdog_Channel_14: ADC Channel14 selected
* @arg ADC_AnalogWatchdog_Channel_15: ADC Channel15 selected
* @arg ADC_AnalogWatchdog_Channel_16: ADC Channel16 selected
* @arg ADC_AnalogWatchdog_Channel_17: ADC Channel17 selected
* @arg ADC_AnalogWatchdog_Channel_18: ADC Channel18 selected
* @note The channel selected on the AWDCH must be also set into the CHSELR
* register
* @retval None
*/
void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, uint32_t ADC_AnalogWatchdog_Channel)
{
uint32_t tmpreg = 0;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_ADC_ANALOG_WATCHDOG_CHANNEL(ADC_AnalogWatchdog_Channel));
/* Get the old register value */
tmpreg = ADCx->CFGR1;
/* Clear the Analog watchdog channel select bits */
tmpreg &= ~ADC_CFGR1_AWDCH;
/* Set the Analog watchdog channel */
tmpreg |= ADC_AnalogWatchdog_Channel;
/* Store the new register value */
ADCx->CFGR1 = tmpreg;
}
示例15: ADC_ITConfig
/**
* @brief Enables or disables the specified ADC interrupts.
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @param ADC_IT: specifies the ADC interrupt sources to be enabled or disabled.
* This parameter can be any combination of the following values:
* @arg ADC_IT_EOC: End of conversion interrupt mask
* @arg ADC_IT_AWD: Analog watchdog interrupt mask
* @arg ADC_IT_JEOC: End of injected conversion interrupt mask
* @param NewState: new state of the specified ADC interrupts.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void ADC_ITConfig(ADC_TypeDef* ADCx, uint16_t ADC_IT, FunctionalState NewState)
{
uint8_t itmask = 0;
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
assert_param(IS_ADC_IT(ADC_IT));
/* Get the ADC IT index */
itmask = (uint8_t)ADC_IT;
if (NewState != DISABLE)
{
/* Enable the selected ADC interrupts */
ADCx->CR1 |= itmask;
}
else
{
/* Disable the selected ADC interrupts */
ADCx->CR1 &= (~(uint32_t)itmask);
}
}