📄 stm8l15x_adc.h
字号:
((GROUP) == ADC_Group_FastChannels))
/**
* @}
*/
/** @defgroup ADC_Sampling_Time
* @{
*/
typedef enum
{
ADC_SamplingTime_4Cycles = ((uint8_t)0x00), /*!< Sampling Time Cycles is 4 */
ADC_SamplingTime_9Cycles = ((uint8_t)0x01), /*!< Sampling Time Cycles is 9 */
ADC_SamplingTime_16Cycles = ((uint8_t)0x02), /*!< Sampling Time Cycles is 16 */
ADC_SamplingTime_24Cycles = ((uint8_t)0x03), /*!< Sampling Time Cycles is 24 */
ADC_SamplingTime_48Cycles = ((uint8_t)0x04), /*!< Sampling Time Cycles is 48 */
ADC_SamplingTime_96Cycles = ((uint8_t)0x05), /*!< Sampling Time Cycles is 96 */
ADC_SamplingTime_192Cycles = ((uint8_t)0x06), /*!< Sampling Time Cycles is 192 */
ADC_SamplingTime_384Cycles = ((uint8_t)0x07) /*!< Sampling Time Cycles is 384 */
}ADC_SamplingTime_TypeDef;
#define IS_ADC_SAMPLING_TIME_CYCLES(TIME) (((TIME) == ADC_SamplingTime_4Cycles) || \
((TIME) == ADC_SamplingTime_9Cycles) || \
((TIME) == ADC_SamplingTime_16Cycles) || \
((TIME) == ADC_SamplingTime_24Cycles) || \
((TIME) == ADC_SamplingTime_48Cycles) || \
((TIME) == ADC_SamplingTime_96Cycles) || \
((TIME) == ADC_SamplingTime_192Cycles) || \
((TIME) == ADC_SamplingTime_384Cycles))
/**
* @}
*/
/** @defgroup ADC_Analog_WatchDog_Channel_selection
* @{
*/
typedef enum
{
ADC_AnalogWatchdogSelection_Channel0 = ((uint8_t)0x00), /*!< AWD affected to Channel 0 */
ADC_AnalogWatchdogSelection_Channel1 = ((uint8_t)0x01), /*!< AWD affected to Channel 1 */
ADC_AnalogWatchdogSelection_Channel2 = ((uint8_t)0x02), /*!< AWD affected to Channel 2 */
ADC_AnalogWatchdogSelection_Channel3 = ((uint8_t)0x03), /*!< AWD affected to Channel 3 */
ADC_AnalogWatchdogSelection_Channel4 = ((uint8_t)0x04), /*!< AWD affected to Channel 4 */
ADC_AnalogWatchdogSelection_Channel5 = ((uint8_t)0x05), /*!< AWD affected to Channel 5 */
ADC_AnalogWatchdogSelection_Channel6 = ((uint8_t)0x06), /*!< AWD affected to Channel 6 */
ADC_AnalogWatchdogSelection_Channel7 = ((uint8_t)0x07), /*!< AWD affected to Channel 7 */
ADC_AnalogWatchdogSelection_Channel8 = ((uint8_t)0x08), /*!< AWD affected to Channel 8 */
ADC_AnalogWatchdogSelection_Channel9 = ((uint8_t)0x09), /*!< AWD affected to Channel 9 */
ADC_AnalogWatchdogSelection_Channel10 = ((uint8_t)0x0A), /*!< AWD affected to Channel 10 */
ADC_AnalogWatchdogSelection_Channel11 = ((uint8_t)0x0B), /*!< AWD affected to Channel 11 */
ADC_AnalogWatchdogSelection_Channel12 = ((uint8_t)0x0C), /*!< AWD affected to Channel 12 */
ADC_AnalogWatchdogSelection_Channel13 = ((uint8_t)0x0D), /*!< AWD affected to Channel 13 */
ADC_AnalogWatchdogSelection_Channel14 = ((uint8_t)0x0E), /*!< AWD affected to Channel 14 */
ADC_AnalogWatchdogSelection_Channel15 = ((uint8_t)0x0F), /*!< AWD affected to Channel 15 */
ADC_AnalogWatchdogSelection_Channel16 = ((uint8_t)0x10), /*!< AWD affected to Channel 16 */
ADC_AnalogWatchdogSelection_Channel17 = ((uint8_t)0x11), /*!< AWD affected to Channel 17 */
ADC_AnalogWatchdogSelection_Channel18 = ((uint8_t)0x12), /*!< AWD affected to Channel 18 */
ADC_AnalogWatchdogSelection_Channel19 = ((uint8_t)0x13), /*!< AWD affected to Channel 19 */
ADC_AnalogWatchdogSelection_Channel20 = ((uint8_t)0x14), /*!< AWD affected to Channel 20 */
ADC_AnalogWatchdogSelection_Channel21 = ((uint8_t)0x15), /*!< AWD affected to Channel 21 */
ADC_AnalogWatchdogSelection_Channel22 = ((uint8_t)0x16), /*!< AWD affected to Channel 22 */
ADC_AnalogWatchdogSelection_Channel23 = ((uint8_t)0x17), /*!< AWD affected to Channel 23 */
ADC_AnalogWatchdogSelection_Channel24 = ((uint8_t)0x18), /*!< AWD affected to Channel 24 */
ADC_AnalogWatchdogSelection_Channel25 = ((uint8_t)0x19), /*!< AWD affected to Channel 25 */
ADC_AnalogWatchdogSelection_Channel26 = ((uint8_t)0x1A), /*!< AWD affected to Channel 26 */
ADC_AnalogWatchdogSelection_Channel27 = ((uint8_t)0x1B), /*!< AWD affected to Channel 27 */
ADC_AnalogWatchdogSelection_Vrefint = ((uint8_t)0x1C), /*!< AWD affected to Internal Vref Channel */
ADC_AnalogWatchdogSelection_TempSensor = ((uint8_t)0x1D) /*!< AWD affected to Temperature Sensor Channel */
}ADC_AnalogWatchdogSelection_TypeDef;
#define IS_ADC_ANALOGWATCHDOG_SELECTION(CHANNEL) (((CHANNEL) <= 0x1D))
/**
* @}
*/
/** @defgroup ADC_Interrupts
* @{
*/
typedef enum
{
ADC_IT_EOC = ((uint8_t)0x08), /*!< End of Conversion Interrupt */
ADC_IT_AWD = ((uint8_t)0x10), /*!< Analog WatchDog Interrupt */
ADC_IT_OVER = ((uint8_t)0x80) /*!< Over Run Interrupt */
}ADC_IT_TypeDef;
#define IS_ADC_IT(IT) ((((IT) & (uint8_t)0x67) == 0x00) && ((IT) != 0x00))
#define IS_ADC_GET_IT(IT) (((IT) == ADC_IT_EOC) || ((IT) == ADC_IT_AWD) || \
((IT) == ADC_IT_OVER))
/**
* @}
*/
/** @defgroup ADC_Flags
* @{
*/
typedef enum
{
ADC_FLAG_EOC = ((uint8_t)0x01), /*!< End of Conversion flag */
ADC_FLAG_AWD = ((uint8_t)0x02), /*!< Analog WatchDog flag */
ADC_FLAG_OVER = ((uint8_t)0x04) /*!< Over Run flag */
}ADC_FLAG_TypeDef;
#define IS_ADC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint8_t)0xF8) == 0x00) && ((FLAG) != 0x00))
#define IS_ADC_GET_FLAG(FLAG) (((FLAG) == ADC_FLAG_EOC) || ((FLAG) == ADC_FLAG_AWD) || \
((FLAG) == ADC_FLAG_OVER))
/**
* @}
*/
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/* Exported Macros -----------------------------------------------------------*/
/** @defgroup ADC_Exported_Macros
* @{
*/
#define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= 0xFFF)
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/* Function used to set the ADC configuration to the default reset state *****/
void ADC_DeInit(ADC_TypeDef* ADCx);
/* Initialization and Configuration functions *********************************/
void ADC_Init(ADC_TypeDef* ADCx,
ADC_ConversionMode_TypeDef ADC_ConversionMode,
ADC_Resolution_TypeDef ADC_Resolution,
ADC_Prescaler_TypeDef ADC_Prescaler);
void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState);
void ADC_SoftwareStartConv(ADC_TypeDef* ADCx);
void ADC_ExternalTrigConfig(ADC_TypeDef* ADCx,
ADC_ExtEventSelection_TypeDef ADC_ExtEventSelection,
ADC_ExtTRGSensitivity_TypeDef ADC_ExtTRGSensitivity);
/* Analog Watchdog configuration functions ************************************/
void ADC_AnalogWatchdogChannelSelect(ADC_TypeDef* ADCx,
ADC_AnalogWatchdogSelection_TypeDef ADC_AnalogWatchdogSelection);
void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, uint16_t HighThreshold,
uint16_t LowThreshold);
void ADC_AnalogWatchdogConfig(ADC_TypeDef* ADCx,
ADC_AnalogWatchdogSelection_TypeDef ADC_AnalogWatchdogSelection,
uint16_t HighThreshold,
uint16_t LowThreshold);
/* Temperature Sensor & Vrefint (Voltage Reference internal) management functions */
void ADC_TempSensorCmd(FunctionalState NewState);
void ADC_VrefintCmd(FunctionalState NewState);
/* Channels Configuration functions *******************************************/
void ADC_ChannelCmd(ADC_TypeDef* ADCx, ADC_Channel_TypeDef ADC_Channels,
FunctionalState NewState);
void ADC_SamplingTimeConfig(ADC_TypeDef* ADCx, ADC_Group_TypeDef ADC_GroupChannels,
ADC_SamplingTime_TypeDef ADC_SamplingTime);
void ADC_SchmittTriggerConfig(ADC_TypeDef* ADCx, ADC_Channel_TypeDef ADC_Channels,
FunctionalState NewState);
uint16_t ADC_GetConversionValue(ADC_TypeDef* ADCx);
/* Channels DMA Configuration function ****************************************/
void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState);
/* Interrupts and flags management functions **********************************/
void ADC_ITConfig(ADC_TypeDef* ADCx,
ADC_IT_TypeDef ADC_IT,
FunctionalState NewState);
FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, ADC_FLAG_TypeDef ADC_FLAG);
void ADC_ClearFlag(ADC_TypeDef* ADCx, ADC_FLAG_TypeDef ADC_FLAG);
ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, ADC_IT_TypeDef ADC_IT);
void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, ADC_IT_TypeDef ADC_IT);
#endif /*__STM8L15x_ADC_H */
/**
* @}
*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -