stm32f0/f3: adc: extract beginnings of common v2 periph
The f0, f30x and l0 have a very similar "v2" adc peripheral. Start extracting out some of the common code, and fix the glaring bug in adc_power_down that was affecting them both. This is not intended to be a fully comprehensive extraction, just the first easy steps.
This commit is contained in:
@@ -43,6 +43,7 @@ OBJS += gpio_common_all.o gpio_common_f0234.o \
|
||||
iwdg_common_all.o spi_common_all.o dma_common_l1f013.o\
|
||||
timer_common_all.o timer_common_f234.o flash_common_f234.o \
|
||||
flash.o exti_common_all.o rcc_common_all.o spi_common_f03.o
|
||||
OBJS += adc_common_v2.o
|
||||
|
||||
OBJS += usb.o usb_control.o usb_standard.o
|
||||
OBJS += st_usbfs_core.o st_usbfs_v1.o
|
||||
|
||||
@@ -88,20 +88,6 @@
|
||||
|
||||
/**@{*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Off
|
||||
*
|
||||
* Turn off the ADC to reduce power consumption to a few microamps.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base @ref
|
||||
* adc_reg_base
|
||||
*/
|
||||
|
||||
void adc_power_off(uint32_t adc)
|
||||
{
|
||||
ADC_CR(adc) &= ~ADC_CR_ADEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Enable Analog Watchdog for Regular Conversions
|
||||
*
|
||||
@@ -905,23 +891,6 @@ void adc_set_injected_offset(uint32_t adc, uint8_t reg, uint32_t offset)
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Power On
|
||||
*
|
||||
* If the ADC is in power-down mode then it is powered up. The application
|
||||
* needs to wait a time of about 3 microseconds for stabilization before using
|
||||
* the ADC. If the ADC is already on this function call will have no effect.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base @ref
|
||||
* adc_reg_base
|
||||
*/
|
||||
|
||||
void adc_power_on(uint32_t adc)
|
||||
{
|
||||
ADC_CR(adc) |= ADC_CR_ADEN;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Set Clock Prescale
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user