comparison src/cs/layer1/cust0/l1_cust.c @ 330:dd3c89e9ca2e

l1_cust.c: added function that exports the calibrated Vbat conversion for use by the new battery charging code
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 14 Dec 2017 04:10:30 +0000
parents 047fb78947d5
children e0b27310e6ba
comparison
equal deleted inserted replaced
329:047fb78947d5 330:dd3c89e9ca2e
1004 1004
1005 //store converted ADC values 1005 //store converted ADC values
1006 memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw)); 1006 memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw));
1007 } 1007 }
1008 1008
1009 /*
1010 * FreeCalypso: the following function has been added
1011 * to support the new battery charging code.
1012 */
1013
1014 UWORD16 madc_vbat_2_physical (UWORD16 adc_val)
1015 {
1016 return (((UWORD32)(adc_cal.a[ADC_VBAT] * adc_val)) >> 10) +
1017 adc_cal.b[ADC_VBAT];
1018 }
1009 1019
1010 /*------------------------------------------------------*/ 1020 /*------------------------------------------------------*/
1011 /* get_cal_from_nvmem */ 1021 /* get_cal_from_nvmem */
1012 /*------------------------------------------------------*/ 1022 /*------------------------------------------------------*/
1013 /* Parameters : */ 1023 /* Parameters : */