adc: simplify LL on C3

This commit is contained in:
Michael (XIAO Xufeng) 2021-01-08 18:44:39 +08:00 committed by Armando
parent c257daa950
commit 3d7da2c8ff
5 changed files with 9 additions and 28 deletions

View File

@ -163,20 +163,12 @@ void adc_hal_onetime_start(adc_digi_config_t *adc_digi_config)
void adc_hal_adc1_onetime_sample_enable(bool enable)
{
if (enable) {
adc_ll_adc1_onetime_sample_ena();
} else {
adc_ll_adc1_onetime_sample_dis();
}
adc_ll_adc1_onetime_sample_enable(enable);
}
void adc_hal_adc2_onetime_sample_enable(bool enable)
{
if (enable) {
adc_ll_adc2_onetime_sample_ena();
} else {
adc_ll_adc2_onetime_sample_dis();
}
adc_ll_adc2_onetime_sample_enable(enable);
}
void adc_hal_onetime_channel(adc_ll_num_t unit, adc_channel_t channel)

View File

@ -299,9 +299,8 @@ static inline void adc_ll_rtc_enable_channel(adc_ll_num_t adc_n, int channel)
* @note Only one channel can be selected in once measurement.
*
* @param adc_n ADC unit.
* @param channel ADC channel number for each ADCn.
*/
static inline void adc_ll_rtc_disable_channel(adc_ll_num_t adc_n, int channel)
static inline void adc_ll_rtc_disable_channel(adc_ll_num_t adc_n)
{
if (adc_n == ADC_NUM_1) {
SENS.sar_meas_start1.sar1_en_pad = 0; //only one channel is selected.

View File

@ -912,14 +912,9 @@ static inline bool adc_ll_intr_get_status(adc_ll_intr_t mask)
}
//--------------------------------adc1------------------------------//
static inline void adc_ll_adc1_onetime_sample_ena(void)
static inline void adc_ll_adc1_onetime_sample_enable(bool enable)
{
APB_SARADC.onetime_sample.adc1_onetime_sample = 1;
}
static inline void adc_ll_adc1_onetime_sample_dis(void)
{
APB_SARADC.onetime_sample.adc1_onetime_sample = 0;
APB_SARADC.onetime_sample.adc1_onetime_sample = enable;
}
static inline uint32_t adc_ll_adc1_read(void)
@ -929,14 +924,9 @@ static inline uint32_t adc_ll_adc1_read(void)
}
//--------------------------------adc2------------------------------//
static inline void adc_ll_adc2_onetime_sample_ena(void)
static inline void adc_ll_adc2_onetime_sample_enable(bool enable)
{
APB_SARADC.onetime_sample.adc2_onetime_sample = 1;
}
static inline void adc_ll_adc2_onetime_sample_dis(void)
{
APB_SARADC.onetime_sample.adc2_onetime_sample = 0;
APB_SARADC.onetime_sample.adc2_onetime_sample = enable;
}
static inline uint32_t adc_ll_adc2_read(void)

View File

@ -690,7 +690,7 @@ static inline void adc_ll_rtc_enable_channel(adc_ll_num_t adc_n, int channel)
* @param adc_n ADC unit.
* @param channel ADC channel number for each ADCn.
*/
static inline void adc_ll_rtc_disable_channel(adc_ll_num_t adc_n, int channel)
static inline void adc_ll_rtc_disable_channel(adc_ll_num_t adc_n)
{
if (adc_n == ADC_NUM_1) {
SENS.sar_meas1_ctrl2.sar1_en_pad = 0; //only one channel is selected.

View File

@ -606,7 +606,7 @@ static inline void adc_ll_rtc_enable_channel(adc_ll_num_t adc_n, int channel)
* @param adc_n ADC unit.
* @param channel ADC channel number for each ADCn.
*/
static inline void adc_ll_rtc_disable_channel(adc_ll_num_t adc_n, int channel)
static inline void adc_ll_rtc_disable_channel(adc_ll_num_t adc_n)
{
if (adc_n == ADC_NUM_1) {
SENS.sar_meas1_ctrl2.sar1_en_pad = 0; //only one channel is selected.