# HG changeset patch # User Mychaela Falconia # Date 1513224630 0 # Node ID dd3c89e9ca2e26cf98536b74fb6a82cf02916f4a # Parent 047fb78947d5f307c8a819838483ac2f1084a7c9 l1_cust.c: added function that exports the calibrated Vbat conversion for use by the new battery charging code diff -r 047fb78947d5 -r dd3c89e9ca2e src/cs/layer1/cust0/l1_cust.c --- a/src/cs/layer1/cust0/l1_cust.c Thu Dec 14 03:55:02 2017 +0000 +++ b/src/cs/layer1/cust0/l1_cust.c Thu Dec 14 04:10:30 2017 +0000 @@ -1006,6 +1006,16 @@ memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw)); } +/* + * FreeCalypso: the following function has been added + * to support the new battery charging code. + */ + +UWORD16 madc_vbat_2_physical (UWORD16 adc_val) +{ + return (((UWORD32)(adc_cal.a[ADC_VBAT] * adc_val)) >> 10) + + adc_cal.b[ADC_VBAT]; +} /*------------------------------------------------------*/ /* get_cal_from_nvmem */