AMS: Convert ascodec_endofch() to use bit mod function's return value.

It cleans up the code and it was the initial inspiring reason to
change them.

Change-Id: I299499117b8a12d93d13d6563683bab89ab80555
This commit is contained in:
Michael Sevakis 2017-10-30 22:12:58 -04:00
parent f728559bf9
commit 8ef33f479e

View file

@ -545,14 +545,7 @@ void ascodec_wait_adc_finished(void)
/* read sticky end-of-charge bit and clear it */
bool ascodec_endofch(void)
{
int oldlevel = disable_irq_save();
bool ret = ascodec_enrd0_shadow & CHG_ENDOFCH;
ascodec_enrd0_shadow &= ~CHG_ENDOFCH; /* clear interrupt */
restore_irq(oldlevel);
return ret;
return bitclr32(&ascodec_enrd0_shadow, CHG_ENDOFCH) & CHG_ENDOFCH;
}
/* read the presence state of the charger */