# HG changeset patch # User Mychaela Falconia # Date 1514526668 0 # Node ID 9e0608dc9170c2d41479a156e5aaf5f863d051c9 # Parent ce6d71349af0faebf47a332059c907ee1e8f836f l1_cust.c: madc_vbat_inverse() function added for the new FCHG diff -r ce6d71349af0 -r 9e0608dc9170 src/cs/layer1/cust0/l1_cust.c --- a/src/cs/layer1/cust0/l1_cust.c Fri Dec 29 05:42:54 2017 +0000 +++ b/src/cs/layer1/cust0/l1_cust.c Fri Dec 29 05:51:08 2017 +0000 @@ -1029,7 +1029,7 @@ } /* - * FreeCalypso: the following function has been added + * FreeCalypso: the following two functions have been added * to support the new battery charging code. */ @@ -1039,6 +1039,11 @@ adc_cal.b[ADC_VBAT]; } +UWORD16 madc_vbat_inverse (UWORD16 mv) +{ + return ((UWORD32)(mv - adc_cal.b[ADC_VBAT]) << 10) / adc_cal.a[ADC_VBAT]; +} + /*------------------------------------------------------*/ /* get_cal_from_nvmem */ /*------------------------------------------------------*/