ADCv1 enhancement.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10031 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
b4e1ecc760
commit
72b36371b2
|
@ -335,6 +335,98 @@ void adc_lld_serve_interrupt(ADCDriver *adcp) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the VREFEN bit.
|
||||
* @details The VREFEN bit is required in order to sample the VREF channel.
|
||||
* @note This is an STM32-only functionality.
|
||||
* @note This function is meant to be called after @p adcStart().
|
||||
*
|
||||
* @param[in] adcp pointer to the @p ADCDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void adcSTM32EnableVREF(void) {
|
||||
|
||||
ADC->CCR |= ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the VREFEN bit.
|
||||
* @details The VREFEN bit is required in order to sample the VREF channel.
|
||||
* @note This is an STM32-only functionality.
|
||||
* @note This function is meant to be called after @p adcStart().
|
||||
*
|
||||
* @param[in] adcp pointer to the @p ADCDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void adcSTM32DisableVREF(void) {
|
||||
|
||||
ADC->CCR &= ~ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the TSEN bit.
|
||||
* @details The TSEN bit is required in order to sample the internal
|
||||
* temperature sensor and internal reference voltage.
|
||||
* @note This is an STM32-only functionality.
|
||||
*
|
||||
* @param[in] adcp pointer to the @p ADCDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void adcSTM32EnableTS(void) {
|
||||
|
||||
ADC->CCR |= ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the TSEN bit.
|
||||
* @details The TSEN bit is required in order to sample the internal
|
||||
* temperature sensor and internal reference voltage.
|
||||
* @note This is an STM32-only functionality.
|
||||
*
|
||||
* @param[in] adcp pointer to the @p ADCDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void adcSTM32DisableTS(void) {
|
||||
|
||||
ADC->CCR &= ~ADC_CCR_TSEN;
|
||||
}
|
||||
|
||||
#ifdef STM32F0XX
|
||||
/**
|
||||
* @brief Enables the VBATEN bit.
|
||||
* @details The VBATEN bit is required in order to sample the VBAT channel.
|
||||
* @note This is an STM32-only functionality.
|
||||
* @note This function is meant to be called after @p adcStart().
|
||||
*
|
||||
* @param[in] adcp pointer to the @p ADCDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void adcSTM32EnableVBAT(void) {
|
||||
|
||||
ADC->CCR |= ADC_CCR_VBATEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the VBATEN bit.
|
||||
* @details The VBATEN bit is required in order to sample the VBAT channel.
|
||||
* @note This is an STM32-only functionality.
|
||||
* @note This function is meant to be called after @p adcStart().
|
||||
*
|
||||
* @param[in] adcp pointer to the @p ADCDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void adcSTM32DisableVBAT(void) {
|
||||
|
||||
ADC->CCR &= ~ADC_CCR_VBATEN;
|
||||
}
|
||||
#endif /* STM32F0XX */
|
||||
|
||||
#endif /* HAL_USE_ADC */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -430,6 +430,14 @@ extern "C" {
|
|||
void adc_lld_start_conversion(ADCDriver *adcp);
|
||||
void adc_lld_stop_conversion(ADCDriver *adcp);
|
||||
void adc_lld_serve_interrupt(ADCDriver *adcp);
|
||||
void adcSTM32EnableVREF(void);
|
||||
void adcSTM32DisableVREF(void);
|
||||
void adcSTM32EnableTS(void);
|
||||
void adcSTM32DisableTS(void);
|
||||
#ifdef STM32F0XX
|
||||
void adcSTM32EnableVBAT(void);
|
||||
void adcSTM32DisableVBAT(void);
|
||||
#endif /* STM32F0XX */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue