stm32: adc-v2: pull up temp/vref switches
Common for f0,f3,l0,l4
This commit is contained in:
parent
7231b9a691
commit
1d090c840f
|
@ -48,6 +48,10 @@ void adc_power_off(uint32_t adc);
|
|||
bool adc_is_power_off(uint32_t adc);
|
||||
void adc_set_continuous_conversion_mode(uint32_t adc);
|
||||
void adc_set_single_conversion_mode(uint32_t adc);
|
||||
void adc_enable_temperature_sensor(void);
|
||||
void adc_disable_temperature_sensor(void);
|
||||
void adc_enable_vrefint(void);
|
||||
void adc_disable_vrefint(void);
|
||||
|
||||
END_DECLS
|
||||
|
||||
|
|
|
@ -313,10 +313,6 @@ void adc_set_left_aligned(uint32_t adc);
|
|||
void adc_set_right_aligned(uint32_t adc);
|
||||
void adc_enable_dma(uint32_t adc);
|
||||
void adc_disable_dma(uint32_t adc);
|
||||
void adc_enable_temperature_sensor(void);
|
||||
void adc_disable_temperature_sensor(void);
|
||||
void adc_enable_vref_sensor(void);
|
||||
void adc_disable_vref_sensor(void);
|
||||
void adc_enable_vbat_sensor(void);
|
||||
void adc_disable_vbat_sensor(void);
|
||||
void adc_calibrate_start(uint32_t adc);
|
||||
|
|
|
@ -926,8 +926,6 @@ void adc_clear_overrun_flag(uint32_t adc);
|
|||
bool adc_awd(uint32_t adc);
|
||||
/*void adc_set_dma_continue(uint32_t adc);*/
|
||||
/*void adc_set_dma_terminate(uint32_t adc);*/
|
||||
void adc_enable_temperature_sensor(void);
|
||||
void adc_disable_temperature_sensor(void);
|
||||
void adc_enable_regulator(uint32_t adc);
|
||||
void adc_disable_regulator(uint32_t adc);
|
||||
|
||||
|
|
|
@ -137,3 +137,44 @@ void adc_set_single_conversion_mode(uint32_t adc)
|
|||
{
|
||||
ADC_CFGR1(adc) &= ~ADC_CFGR1_CONT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the temperature sensor (only)
|
||||
* The channel this is available on is unfortunately not
|
||||
* consistent, even though the bit used to enable it is.
|
||||
* @sa adc_disable_temperature_sensor
|
||||
*/
|
||||
void adc_enable_temperature_sensor(void)
|
||||
{
|
||||
ADC_CCR(ADC1) |= ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the temperature sensor (only)
|
||||
* @sa adc_enable_temperature_sensor
|
||||
*/
|
||||
void adc_disable_temperature_sensor(void)
|
||||
{
|
||||
ADC_CCR(ADC1) &= ~ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the internal voltage reference (only)
|
||||
* The channel this is available on is unfortunately not
|
||||
* consistent, even though the bit used to enable it is.
|
||||
* FIXME - on f3, you can actually have it on ADC34 as well!
|
||||
* @sa adc_disable_vrefint
|
||||
*/
|
||||
void adc_enable_vrefint(void)
|
||||
{
|
||||
ADC_CCR(ADC1) |= ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the internal voltage reference (only)
|
||||
* @sa adc_enable_vrefint
|
||||
*/
|
||||
void adc_disable_vrefint(void)
|
||||
{
|
||||
ADC_CCR(ADC1) &= ~ADC_CCR_VREFEN;
|
||||
}
|
||||
|
|
|
@ -571,51 +571,6 @@ void adc_disable_dma(uint32_t adc)
|
|||
ADC_CFGR1(adc) &= ~ADC_CFGR1_DMAEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Enable The Temperature Sensor
|
||||
*
|
||||
* This enables the sensor on channel 16
|
||||
*/
|
||||
|
||||
void adc_enable_temperature_sensor(void)
|
||||
{
|
||||
ADC_CCR |= ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Disable The Temperature Sensor
|
||||
*
|
||||
* Disabling this will reduce power consumption from the temperature sensor
|
||||
* measurement.
|
||||
*/
|
||||
|
||||
void adc_disable_temperature_sensor(void)
|
||||
{
|
||||
ADC_CCR &= ~ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Enable The VRef Sensor
|
||||
*
|
||||
* This enables the reference voltage measurements on channel 17.
|
||||
*/
|
||||
|
||||
void adc_enable_vref_sensor(void)
|
||||
{
|
||||
ADC_CCR |= ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Disable The VRef Sensor
|
||||
*
|
||||
* Disabling this will reduce power consumption from the reference voltage
|
||||
* measurement.
|
||||
*/
|
||||
|
||||
void adc_disable_vref_sensor(void)
|
||||
{
|
||||
ADC_CCR &= ~ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Enable The VBat Sensor
|
||||
|
|
|
@ -1103,38 +1103,6 @@ bool adc_awd(uint32_t adc)
|
|||
(ADC_ISR(adc) & ADC_ISR_AWD3);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Enable The Temperature Sensor
|
||||
*
|
||||
* This enables both the sensor and the reference voltage measurements on
|
||||
* channels
|
||||
* 16 and 17. These are only available on ADC1 channel 16 and 17 respectively.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base @ref
|
||||
* adc_reg_base
|
||||
*/
|
||||
|
||||
void adc_enable_temperature_sensor()
|
||||
{
|
||||
ADC12_CCR |= ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief ADC Disable The Temperature Sensor
|
||||
*
|
||||
* Disabling this will reduce power consumption from the sensor and the
|
||||
* reference voltage measurements.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base @ref
|
||||
* adc_reg_base
|
||||
*/
|
||||
|
||||
void adc_disable_temperature_sensor()
|
||||
{
|
||||
ADC12_CCR &= ~ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Enable the ADC Voltage regulator
|
||||
|
|
Loading…
Reference in New Issue