Skip to content

Commit

Permalink
Deleted an uneccessary if-statement in ADC module
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnBuiTI authored and LeonardMH committed Apr 2, 2024
1 parent e76f0b5 commit 949969e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
10 changes: 4 additions & 6 deletions include/pmic_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/** @} */

/**
Expand Down
11 changes: 3 additions & 8 deletions src/pmic_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 949969e

Please sign in to comment.