From 949969e67e8aacfaf1bb1f48a94a02b5c4b2ffac Mon Sep 17 00:00:00 2001 From: John Bui Date: Tue, 2 Apr 2024 16:39:32 -0500 Subject: [PATCH] Deleted an uneccessary if-statement in ADC module --- include/pmic_adc.h | 10 ++++------ src/pmic_adc.c | 11 +++-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/pmic_adc.h b/include/pmic_adc.h index 8df4cea..ab0ffed 100644 --- a/include/pmic_adc.h +++ b/include/pmic_adc.h @@ -138,15 +138,13 @@ extern "C" * * \brief ADC continuous conversion enable/disable options * - * \param PMIC_ADC_CONTINUOUS_CONVERSION_DISABLED When selected, disables - * ADC continuous conversion. - * \param PMIC_ADC_CONTINUOUS_CONVERSION_ENABLED When selected, enables - * ADC continuous conversion. + * \param PMIC_ADC_CONT_CONV_DISABLED When selected, disables ADC continuous conversion. + * \param PMIC_ADC_CONT_CONV_ENABLED When selected, enables ADC continuous conversion. * * @{ */ -#define PMIC_ADC_CONTINUOUS_CONVERSION_DISABLED (0U) -#define PMIC_ADC_CONTINUOUS_CONVERSION_ENABLED (1U) +#define PMIC_ADC_CONT_CONV_DISABLED (0U) +#define PMIC_ADC_CONT_CONV_ENABLED (1U) /** @} */ /** diff --git a/src/pmic_adc.c b/src/pmic_adc.c index 2e2eef0..3419faf 100644 --- a/src/pmic_adc.c +++ b/src/pmic_adc.c @@ -212,18 +212,13 @@ int32_t Pmic_ADCGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_adcCfg static int32_t Pmic_ADCContConvCheck(const uint8_t adcCtrlRegData) { int32_t status = PMIC_ST_SUCCESS; - uint8_t contConv = PMIC_ADC_CONTINUOUS_CONVERSION_DISABLED; + uint8_t contConv = Pmic_getBitField( + adcCtrlRegData, PMIC_ADC_CONT_CONV_SHIFT, PMIC_ADC_CONT_CONV_MASK); - contConv = Pmic_getBitField(adcCtrlRegData, PMIC_ADC_CONT_CONV_SHIFT, PMIC_ADC_CONT_CONV_MASK); - - if (contConv == PMIC_ADC_CONTINUOUS_CONVERSION_ENABLED) + if (contConv == PMIC_ADC_CONT_CONV_ENABLED) { status = PMIC_ST_ERR_ADC_CONT_CONV_EN; } - else - { - status = PMIC_ST_SUCCESS; - } return status; }