stm32f3: adc: consistently use unshifted

and tweak teh docs a little
This commit is contained in:
Karl Palsson
2020-03-04 22:02:45 +00:00
parent 49285ed8e1
commit f1b4a4dfff
2 changed files with 4 additions and 5 deletions

View File

@@ -522,7 +522,7 @@
#define ADC_CCR_DUAL_ALTERNATE_TRIG 0x9 #define ADC_CCR_DUAL_ALTERNATE_TRIG 0x9
/**@}*/ /**@}*/
#define ADC_CCR_DUAL_MASK (0x1f << 0) #define ADC_CCR_DUAL_MASK (0x1f)
#define ADC_CCR_DUAL_SHIFT 0 #define ADC_CCR_DUAL_SHIFT 0

View File

@@ -597,7 +597,7 @@ void adc_set_clk_prescale(uint32_t adc, uint32_t prescale)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief ADC Set Dual Mode /** @brief ADC set multi mode
* *
* The multiple mode can uses these arrangement: * The multiple mode can uses these arrangement:
* - ADC1 as master and ADC2 as slave * - ADC1 as master and ADC2 as slave
@@ -608,12 +608,11 @@ void adc_set_clk_prescale(uint32_t adc, uint32_t prescale)
* The various modes possible are described in the reference manual. * The various modes possible are described in the reference manual.
* *
* @param adc peripheral of choice @ref adc_reg_base * @param adc peripheral of choice @ref adc_reg_base
* @param[in] mode Unsigned int32. Multiple mode selection from @ref * @param[in] mode Multiple mode selection from @ref adc_multi_mode
* adc_multi_mode
*/ */
void adc_set_multi_mode(uint32_t adc, uint32_t mode) void adc_set_multi_mode(uint32_t adc, uint32_t mode)
{ {
ADC_CCR(adc) &= ~ADC_CCR_DUAL_MASK; ADC_CCR(adc) &= ~(ADC_CCR_DUAL_MASK << ADC_CCR_DUAL_SHIFT);
ADC_CCR(adc) |= (mode << ADC_CCR_DUAL_SHIFT); ADC_CCR(adc) |= (mode << ADC_CCR_DUAL_SHIFT);
} }