MG32F10x Standard Peripherals Firmware Library
Data Structures | Macros | Functions
mg32f10x_adc.h File Reference

This file contains all the functions prototypes for the ADC firmware library. More...

#include "mg32f10x.h"

Go to the source code of this file.

Data Structures

struct  ADC_InitTypeDef
 ADC Init structure definition. More...
 

Macros

#define ADC_ExternalTrigConv_T1_CC1   ((uint32_t)0x00000000)
 
#define ADC_ExternalTrigConv_T1_CC2   ((uint32_t)0x00020000)
 
#define ADC_ExternalTrigConv_T1_CC3   ((uint32_t)0x00040000)
 
#define ADC_ExternalTrigConv_T2_CC2   ((uint32_t)0x00060000)
 
#define ADC_ExternalTrigConv_T3_TRGO   ((uint32_t)0x00080000)
 
#define ADC_ExternalTrigConv_T4_CC4   ((uint32_t)0x000A0000)
 
#define ADC_ExternalTrigConv_Ext_IT11   ((uint32_t)0x000C0000)
 
#define ADC_ExternalTrigConv_None   ((uint32_t)0x000E0000)
 
#define IS_ADC_EXT_TRIG(REGTRIG)
 
#define ADC_DataAlign_Right   ((uint32_t)0x00000000)
 
#define ADC_DataAlign_Left   ((uint32_t)0x00000800)
 
#define IS_ADC_DATA_ALIGN(ALIGN)
 
#define ADC_Channel_0   ((uint8_t)0x00)
 
#define ADC_Channel_1   ((uint8_t)0x01)
 
#define ADC_Channel_2   ((uint8_t)0x02)
 
#define ADC_Channel_3   ((uint8_t)0x03)
 
#define ADC_Channel_4   ((uint8_t)0x04)
 
#define ADC_Channel_5   ((uint8_t)0x05)
 
#define ADC_Channel_6   ((uint8_t)0x06)
 
#define ADC_Channel_7   ((uint8_t)0x07)
 
#define ADC_Channel_8   ((uint8_t)0x08)
 
#define ADC_Channel_9   ((uint8_t)0x09)
 
#define ADC_Channel_10   ((uint8_t)0x0A)
 
#define ADC_Channel_11   ((uint8_t)0x0B)
 
#define ADC_Channel_12   ((uint8_t)0x0C)
 
#define ADC_Channel_13   ((uint8_t)0x0D)
 
#define ADC_Channel_14   ((uint8_t)0x0E)
 
#define ADC_Channel_15   ((uint8_t)0x0F)
 
#define ADC_Channel_16   ((uint8_t)0x10)
 
#define ADC_Channel_17   ((uint8_t)0x11)
 
#define ADC_Channel_TempSensor   ((uint8_t)ADC_Channel_16)
 
#define ADC_Channel_Vrefint   ((uint8_t)ADC_Channel_17)
 
#define IS_ADC_CHANNEL(CHANNEL)
 
#define ADC_SampleTime_1Cycles5   ((uint8_t)0x00)
 
#define ADC_SampleTime_7Cycles5   ((uint8_t)0x01)
 
#define ADC_SampleTime_13Cycles5   ((uint8_t)0x02)
 
#define ADC_SampleTime_28Cycles5   ((uint8_t)0x03)
 
#define ADC_SampleTime_41Cycles5   ((uint8_t)0x04)
 
#define ADC_SampleTime_55Cycles5   ((uint8_t)0x05)
 
#define ADC_SampleTime_71Cycles5   ((uint8_t)0x06)
 
#define ADC_SampleTime_239Cycles5   ((uint8_t)0x07)
 
#define IS_ADC_SAMPLE_TIME(TIME)
 
#define ADC_ExternalTrigInjecConv_T1_TRGO   ((uint32_t)0x00000000)
 
#define ADC_ExternalTrigInjecConv_T1_CC4   ((uint32_t)0x00001000)
 
#define ADC_ExternalTrigInjecConv_T2_TRGO   ((uint32_t)0x00002000)
 
#define ADC_ExternalTrigInjecConv_T2_CC1   ((uint32_t)0x00003000)
 
#define ADC_ExternalTrigInjecConv_T3_CC4   ((uint32_t)0x00004000)
 
#define ADC_ExternalTrigInjecConv_T4_TRGO   ((uint32_t)0x00005000)
 
#define ADC_ExternalTrigInjecConv_Ext_IT15   ((uint32_t)0x00006000)
 
#define ADC_ExternalTrigInjecConv_None   ((uint32_t)0x00007000)
 
#define IS_ADC_EXT_INJEC_TRIG(INJTRIG)
 
#define ADC_InjectedChannel_1   ((uint8_t)0x14)
 
#define ADC_InjectedChannel_2   ((uint8_t)0x18)
 
#define ADC_InjectedChannel_3   ((uint8_t)0x1C)
 
#define ADC_InjectedChannel_4   ((uint8_t)0x20)
 
#define IS_ADC_INJECTED_CHANNEL(CHANNEL)
 
#define ADC_AnalogWatchdog_SingleRegEnable   ((uint32_t)0x00800200)
 
#define ADC_AnalogWatchdog_SingleInjecEnable   ((uint32_t)0x00400200)
 
#define ADC_AnalogWatchdog_SingleRegOrInjecEnable   ((uint32_t)0x00C00200)
 
#define ADC_AnalogWatchdog_AllRegEnable   ((uint32_t)0x00800000)
 
#define ADC_AnalogWatchdog_AllInjecEnable   ((uint32_t)0x00400000)
 
#define ADC_AnalogWatchdog_AllRegAllInjecEnable   ((uint32_t)0x00C00000)
 
#define ADC_AnalogWatchdog_None   ((uint32_t)0x00000000)
 
#define IS_ADC_ANALOG_WATCHDOG(WATCHDOG)
 
#define ADC_IT_EOC   ((uint16_t)0x0220)
 
#define ADC_IT_AWD   ((uint16_t)0x0140)
 
#define ADC_IT_JEOC   ((uint16_t)0x0480)
 
#define ADC_IT_OVF   ((uint16_t)0x4001)
 
#define ADC_IT_EMP   ((uint16_t)0x2002)
 
#define IS_ADC_IT(IT)   ((((IT) & (uint16_t)0x981C) == 0x00) && ((IT) != 0x00))
 
#define IS_ADC_GET_IT(IT)
 
#define ADC_FLAG_AWD   ((uint8_t)0x01)
 
#define ADC_FLAG_EOC   ((uint8_t)0x02)
 
#define ADC_FLAG_JEOC   ((uint8_t)0x04)
 
#define ADC_FLAG_JSTRT   ((uint8_t)0x08)
 
#define ADC_FLAG_STRT   ((uint8_t)0x10)
 
#define ADC_FLAG_EMP   ((uint8_t)0x20)
 
#define ADC_FLAG_OVF   ((uint8_t)0x40)
 
#define IS_ADC_CLEAR_FLAG(FLAG)   ((((FLAG) & (uint8_t)0xE0) == 0x00) && ((FLAG) != 0x00))
 
#define IS_ADC_GET_FLAG(FLAG)
 
#define IS_ADC_THRESHOLD(THRESHOLD)   ((THRESHOLD) <= 0xFFF)
 
#define IS_ADC_OFFSET(OFFSET)   ((OFFSET) <= 0xFFF)
 
#define IS_ADC_INJECTED_LENGTH(LENGTH)   (((LENGTH) >= 0x1) && ((LENGTH) <= 0x4))
 
#define IS_ADC_INJECTED_RANK(RANK)   (((RANK) >= 0x1) && ((RANK) <= 0x4))
 
#define IS_ADC_REGULAR_LENGTH(LENGTH)   (((LENGTH) >= 0x1) && ((LENGTH) <= 0x10))
 
#define IS_ADC_REGULAR_RANK(RANK)   (((RANK) >= 0x1) && ((RANK) <= 0x10))
 
#define IS_ADC_REGULAR_DISC_NUMBER(NUMBER)   (((NUMBER) >= 0x1) && ((NUMBER) <= 0x8))
 

Functions

void ADC_DeInit (void)
 Deinitializes the ADC peripheral registers to their default reset values. More...
 
void ADC_Init (ADC_InitTypeDef *ADC_InitStruct)
 Initializes the ADC peripheral according to the specified parameters in the ADC_InitStruct. More...
 
void ADC_StructInit (ADC_InitTypeDef *ADC_InitStruct)
 Fills each ADC_InitStruct member with its default value. More...
 
void ADC_Cmd (FunctionalState NewState)
 Enables or disables the ADC peripheral. More...
 
void ADC_DMACmd (FunctionalState NewState)
 Enables or disables the ADC DMA request. More...
 
void ADC_InjectedDMACmd (FunctionalState NewState)
 Enables or disables the ADC injected group DMA request. More...
 
void ADC_ITConfig (uint16_t ADC_IT, FunctionalState NewState)
 Enables or disables the specified ADC interrupts. More...
 
void ADC_ResetCalibration (void)
 Resets the selected ADC calibration registers. More...
 
FlagStatus ADC_GetResetCalibrationStatus (void)
 Gets the selected ADC reset calibration registers status. More...
 
void ADC_StartCalibration (void)
 Starts the selected ADC calibration process. More...
 
FlagStatus ADC_GetCalibrationStatus (void)
 Gets the selected ADC calibration status. More...
 
void ADC_SoftwareStartConvCmd (FunctionalState NewState)
 Enables or disables the selected ADC software start conversion . More...
 
FlagStatus ADC_GetSoftwareStartConvStatus (void)
 Gets the selected ADC Software start conversion Status. More...
 
void ADC_DiscModeChannelCountConfig (uint8_t Number)
 Configures the discontinuous mode for the selected ADC regular group channel. More...
 
void ADC_DiscModeCmd (FunctionalState NewState)
 Enables or disables the discontinuous mode on regular group channel for the ADC. More...
 
void ADC_RegularChannelConfig (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 sample time. More...
 
void ADC_ExternalTrigConvCmd (FunctionalState NewState)
 Enables or disables the ADC conversion through external trigger. More...
 
uint16_t ADC_GetConversionValue (void)
 Returns the last ADC conversion result data for regular channel. More...
 
void ADC_AutoInjectedConvCmd (FunctionalState NewState)
 Enables or disables the selected ADC automatic injected group conversion after regular one. More...
 
void ADC_InjectedDiscModeCmd (FunctionalState NewState)
 Enables or disables the discontinuous mode for injected group channel for the ADC. More...
 
void ADC_ExternalTrigInjectedConvConfig (uint32_t ADC_ExternalTrigInjecConv)
 Configures the ADC external trigger for injected channels conversion. More...
 
void ADC_ExternalTrigInjectedConvCmd (FunctionalState NewState)
 Enables or disables the ADC injected channels conversion through external trigger. More...
 
void ADC_SoftwareStartInjectedConvCmd (FunctionalState NewState)
 Enables or disables the selected ADC start of the injected channels conversion. More...
 
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus (void)
 Gets the selected ADC Software start injected conversion Status. More...
 
void ADC_InjectedChannelConfig (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 sample time. More...
 
void ADC_InjectedSequencerLengthConfig (uint8_t Length)
 Configures the sequencer length for injected channels. More...
 
void ADC_SetInjectedOffset (uint8_t ADC_InjectedChannel, uint16_t Offset)
 Set the injected channels conversion value offset. More...
 
uint16_t ADC_GetInjectedConversionValue (uint8_t ADC_InjectedChannel)
 Returns the ADC injected channel conversion result. More...
 
void ADC_AnalogWatchdogCmd (uint32_t ADC_AnalogWatchdog)
 Enables or disables the analog watchdog on single/all regular or injected channels. More...
 
void ADC_AnalogWatchdogThresholdsConfig (uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog. More...
 
void ADC_AnalogWatchdogSingleChannelConfig (uint8_t ADC_Channel)
 Configures the analog watchdog guarded single channel. More...
 
void ADC_TempSensorVrefintCmd (FunctionalState NewState)
 Enables or disables the temperature sensor and Vrefint channel. More...
 
FlagStatus ADC_GetFlagStatus (uint8_t ADC_FLAG)
 Checks whether the specified ADC flag is set or not. More...
 
void ADC_ClearFlag (uint8_t ADC_FLAG)
 Clears the ADC's pending flags. More...
 
ITStatus ADC_GetITStatus (uint16_t ADC_IT)
 Checks whether the specified ADC interrupt has occurred or not. More...
 
void ADC_ClearITPendingBit (uint16_t ADC_IT)
 Clears the ADC's interrupt pending bits. More...
 
uint16_t ADC_GetADValue (uint16_t data)
 Adjust the ADC conversion result. More...
 

Detailed Description

This file contains all the functions prototypes for the ADC firmware library.

Author
megawin Application Team
Version
V0.1.10
Date
05-January-2023