changeset 361:9e0608dc9170

l1_cust.c: madc_vbat_inverse() function added for the new FCHG
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 29 Dec 2017 05:51:08 +0000
parents ce6d71349af0
children 4c3d05866531
files src/cs/layer1/cust0/l1_cust.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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                                  */
   /*------------------------------------------------------*/