stm32: adc-v2: Pull up more common basic functionality
Pull up eoc/eos/read_regular functions. More simple, basic core functionality.
This commit is contained in:
@@ -35,6 +35,35 @@ LGPL License Terms @ref lgpl_license
|
||||
|
||||
#include <libopencm3/stm32/adc.h>
|
||||
|
||||
|
||||
/** @brief ADC Read the End-of-Conversion Flag
|
||||
*
|
||||
* This flag is set by hardware at the end of each regular conversion of a
|
||||
* channel when a new data is available in the ADCx_DR register.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base
|
||||
* @ref adc_reg_base
|
||||
* @returns bool. End of conversion flag.
|
||||
*/
|
||||
bool adc_eoc(uint32_t adc)
|
||||
{
|
||||
return ADC_ISR(adc) & ADC_ISR_EOC;
|
||||
}
|
||||
|
||||
/** @brief ADC Read the End-of-Sequence Flag for Regular Conversions
|
||||
*
|
||||
* This flag is set after all channels of an regular group have been
|
||||
* converted.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base
|
||||
* @ref adc_reg_base
|
||||
* @returns bool. End of conversion flag.
|
||||
*/
|
||||
bool adc_eos(uint32_t adc)
|
||||
{
|
||||
return ADC_ISR(adc) & ADC_ISR_EOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn on the ADC (async)
|
||||
* @sa adc_wait_power_on
|
||||
@@ -188,6 +217,20 @@ void adc_disable_dma(uint32_t adc)
|
||||
}
|
||||
|
||||
|
||||
/** @brief ADC Read from the Regular Conversion Result Register
|
||||
*
|
||||
* The result read back is 12 bits, right or left aligned within the first
|
||||
* 16 bits.
|
||||
*
|
||||
* @param[in] adc Unsigned int32. ADC block register address base
|
||||
* @ref adc_reg_base
|
||||
* @returns Unsigned int32 conversion result.
|
||||
*/
|
||||
uint32_t adc_read_regular(uint32_t adc)
|
||||
{
|
||||
return ADC_DR(adc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the temperature sensor (only)
|
||||
* The channel this is available on is unfortunately not
|
||||
|
||||
Reference in New Issue
Block a user