stm32: adc_common_v2: Make EXTSEL and ALIGN definitions per chip
STM32G4 uses v2 ADC but has EXTSEL and ALIGN fields modified, rather than making a v3 ADC for these minor changes, the definitions have been moved to the chip specific headers, so that the common code can work for G4 onwards.
This commit is contained in:
parent
b84bf6e244
commit
7219b32902
|
@ -150,9 +150,6 @@ specific memorymap.h header before including this header file.*/
|
||||||
#define ADC_CFGR1_EXTEN_BOTH_EDGES (0x3 << 10)
|
#define ADC_CFGR1_EXTEN_BOTH_EDGES (0x3 << 10)
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** ALIGN: Data alignment */
|
|
||||||
#define ADC_CFGR1_ALIGN (1 << 5)
|
|
||||||
|
|
||||||
#define ADC_CFGR1_RES_MASK (0x3 << 3)
|
#define ADC_CFGR1_RES_MASK (0x3 << 3)
|
||||||
/** @defgroup adc_cfgr1_res RES: Data resolution
|
/** @defgroup adc_cfgr1_res RES: Data resolution
|
||||||
@{*/
|
@{*/
|
||||||
|
|
|
@ -143,11 +143,6 @@ specific memorymap.h header before including this header file.*/
|
||||||
#define ADC_CFGR1_DISCNUM_MASK (0x7 << ADC_CFGR1_DISCNUM_SHIFT)
|
#define ADC_CFGR1_DISCNUM_MASK (0x7 << ADC_CFGR1_DISCNUM_SHIFT)
|
||||||
#define ADC_CFGR1_DISCNUM_VAL(x) (((x) - 1) << ADC_CFGR1_DISCNUM_SHIFT)
|
#define ADC_CFGR1_DISCNUM_VAL(x) (((x) - 1) << ADC_CFGR1_DISCNUM_SHIFT)
|
||||||
|
|
||||||
/* EXTSEL[3:0]: External trigger selection for regular group */
|
|
||||||
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
|
||||||
#define ADC_CFGR1_EXTSEL_MASK (0xf << ADC_CFGR1_EXTSEL_SHIFT)
|
|
||||||
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
|
||||||
|
|
||||||
/* ADC_SQRx Values: Regular Sequence ordering------------------------------- */
|
/* ADC_SQRx Values: Regular Sequence ordering------------------------------- */
|
||||||
|
|
||||||
#define ADC_SQR1_L_SHIFT 0
|
#define ADC_SQR1_L_SHIFT 0
|
||||||
|
|
|
@ -58,11 +58,6 @@ specific memorymap.h header before including this header file.*/
|
||||||
/** Auto off mode */
|
/** Auto off mode */
|
||||||
#define ADC_CFGR1_AUTOFF (1 << 15)
|
#define ADC_CFGR1_AUTOFF (1 << 15)
|
||||||
|
|
||||||
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
|
||||||
#define ADC_CFGR1_EXTSEL (0x7 << ADC_CFGR1_EXTSEL_SHIFT)
|
|
||||||
/** EXTSEL[2:0]: External trigger selection for regular group */
|
|
||||||
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
|
||||||
|
|
||||||
/** SCANDIR: Scan Sequence Direction: Upwards Scan (0), Downwards(1) */
|
/** SCANDIR: Scan Sequence Direction: Upwards Scan (0), Downwards(1) */
|
||||||
#define ADC_CFGR1_SCANDIR (1 << 2)
|
#define ADC_CFGR1_SCANDIR (1 << 2)
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
|
@ -71,6 +71,16 @@
|
||||||
/* Register values */
|
/* Register values */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/* ADC_CFGR1 Values ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** ALIGN: Data alignment */
|
||||||
|
#define ADC_CFGR1_ALIGN (1 << 5)
|
||||||
|
|
||||||
|
/* EXTSEL[2:0]: External trigger selection for regular group */
|
||||||
|
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
||||||
|
#define ADC_CFGR1_EXTSEL (0x7 << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
|
||||||
/* ADC_CFGR2 Values ---------------------------------------------------------*/
|
/* ADC_CFGR2 Values ---------------------------------------------------------*/
|
||||||
|
|
||||||
#define ADC_CFGR2_CKMODE_SHIFT 30
|
#define ADC_CFGR2_CKMODE_SHIFT 30
|
||||||
|
|
|
@ -209,6 +209,16 @@
|
||||||
#define ADC_CR_ADVREGEN_DISABLE (0x2 << 28)
|
#define ADC_CR_ADVREGEN_DISABLE (0x2 << 28)
|
||||||
#define ADC_CR_ADVREGEN_MASK (0x3 << 28)
|
#define ADC_CR_ADVREGEN_MASK (0x3 << 28)
|
||||||
|
|
||||||
|
/* ADC_CFGR1 Values ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** ALIGN: Data alignment */
|
||||||
|
#define ADC_CFGR1_ALIGN (1 << 5)
|
||||||
|
|
||||||
|
/* EXTSEL[2:0]: External trigger selection for regular group */
|
||||||
|
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
||||||
|
#define ADC_CFGR1_EXTSEL_MASK (0xf << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* ADC_SMPRx ADC Sample Time Selection for Channels */
|
/* ADC_SMPRx ADC Sample Time Selection for Channels */
|
||||||
/** @defgroup adc_sample ADC Sample Time Selection values
|
/** @defgroup adc_sample ADC Sample Time Selection values
|
||||||
|
|
|
@ -121,6 +121,14 @@
|
||||||
/** @addtogroup adc_cfgr1
|
/** @addtogroup adc_cfgr1
|
||||||
@{*/
|
@{*/
|
||||||
|
|
||||||
|
/** ALIGN: Data alignment */
|
||||||
|
#define ADC_CFGR1_ALIGN (1 << 5)
|
||||||
|
|
||||||
|
/* EXTSEL[2:0]: External trigger selection for regular group */
|
||||||
|
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
||||||
|
#define ADC_CFGR1_EXTSEL (0x7 << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
|
||||||
/** CHSELRMOD: Mode Selection of the ADC_CHSELR register */
|
/** CHSELRMOD: Mode Selection of the ADC_CHSELR register */
|
||||||
#define ADC_CFGR1_CHSELRMOD (1 << 21)
|
#define ADC_CFGR1_CHSELRMOD (1 << 21)
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,16 @@
|
||||||
#define ADC_CALFACT(adc) MMIO32((adc) + 0xB4)
|
#define ADC_CALFACT(adc) MMIO32((adc) + 0xB4)
|
||||||
|
|
||||||
/* Register values */
|
/* Register values */
|
||||||
|
/* ADC_CFGR1 Values ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** ALIGN: Data alignment */
|
||||||
|
#define ADC_CFGR1_ALIGN (1 << 5)
|
||||||
|
|
||||||
|
/* EXTSEL[2:0]: External trigger selection for regular group */
|
||||||
|
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
||||||
|
#define ADC_CFGR1_EXTSEL (0x7 << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
|
||||||
/* ADC_CFGR2 Values ---------------------------------------------------------*/
|
/* ADC_CFGR2 Values ---------------------------------------------------------*/
|
||||||
|
|
||||||
#define ADC_CFGR2_CKMODE_SHIFT 30
|
#define ADC_CFGR2_CKMODE_SHIFT 30
|
||||||
|
|
|
@ -62,6 +62,16 @@
|
||||||
/* ADVREGEN: Voltage regulator enable bit */
|
/* ADVREGEN: Voltage regulator enable bit */
|
||||||
#define ADC_CR_ADVREGEN (1 << 28)
|
#define ADC_CR_ADVREGEN (1 << 28)
|
||||||
|
|
||||||
|
/* ADC_CFGR1 Values ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** ALIGN: Data alignment */
|
||||||
|
#define ADC_CFGR1_ALIGN (1 << 5)
|
||||||
|
|
||||||
|
/* EXTSEL[2:0]: External trigger selection for regular group */
|
||||||
|
#define ADC_CFGR1_EXTSEL_SHIFT 6
|
||||||
|
#define ADC_CFGR1_EXTSEL_MASK (0xf << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
#define ADC_CFGR1_EXTSEL_VAL(x) ((x) << ADC_CFGR1_EXTSEL_SHIFT)
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* ADC_SMPRx ADC Sample Time Selection for Channels */
|
/* ADC_SMPRx ADC Sample Time Selection for Channels */
|
||||||
|
|
Loading…
Reference in New Issue