git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4235 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
512b78de72
commit
6e2f377dd5
|
@ -174,6 +174,16 @@ void adc_lld_start(ADCDriver *adcp) {
|
|||
chDbgAssert(!b, "adc_lld_start(), #1", "stream already allocated");
|
||||
dmaStreamSetPeripheral(adcp->dmastp, &ADC1->DR);
|
||||
rccEnableADC1(FALSE);
|
||||
#if STM32_ADCSW == STM32_ADCSW_HSI14
|
||||
/* Clock from HSI14, no need for jitter removal.*/
|
||||
ADC1->CFGR2 = 0x00001000;
|
||||
#else
|
||||
#if STM32_ADCPRE == STM32_ADCPRE_DIV2
|
||||
ADC1->CFGR2 = 0x00001000 | ADC_CFGR2_JITOFFDIV2;
|
||||
#else
|
||||
ADC1->CFGR2 = 0x00001000 | ADC_CFGR2_JITOFFDIV4;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif /* STM32_ADC_USE_ADC1 */
|
||||
|
||||
|
@ -265,28 +275,6 @@ void adc_lld_stop_conversion(ADCDriver *adcp) {
|
|||
adc_lld_stop_adc(adcp->adc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the TSVREFE bit.
|
||||
* @details The TSVREFE bit is required in order to sample the internal
|
||||
* temperature sensor and internal reference voltage.
|
||||
* @note This is an STM32-only functionality.
|
||||
*/
|
||||
void adcSTM32EnableTSVREFE(void) {
|
||||
|
||||
ADC->CCR |= ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the TSVREFE bit.
|
||||
* @details The TSVREFE bit is required in order to sample the internal
|
||||
* temperature sensor and internal reference voltage.
|
||||
* @note This is an STM32-only functionality.
|
||||
*/
|
||||
void adcSTM32DisableTSVREFE(void) {
|
||||
|
||||
ADC->CCR &= ~ADC_CCR_VREFEN;
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_ADC */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -264,6 +264,14 @@ struct ADCDriver {
|
|||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Changes the value of the ADC CCR register.
|
||||
* @details Use this function in order to enable or disable the internal
|
||||
* analog sources. See the documentation in the STM32F0xx Reference
|
||||
* Manual.
|
||||
*/
|
||||
#define adcSTM32SetCCR(ccr) (ADC->CCR = (ccr))
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
@ -280,8 +288,6 @@ extern "C" {
|
|||
void adc_lld_stop(ADCDriver *adcp);
|
||||
void adc_lld_start_conversion(ADCDriver *adcp);
|
||||
void adc_lld_stop_conversion(ADCDriver *adcp);
|
||||
void adcSTM32EnableTSVREFE(void);
|
||||
void adcSTM32DisableTSVREFE(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue