changeset 596:e4d46979846f

FCHG: turn on the charging LED on C155 and J100 targets
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 18 Mar 2019 17:56:04 +0000
parents 7cecc3dadbe7
children f18b29e27be5
files src/cs/drivers/drv_app/fchg/fchg_process.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/fchg/fchg_process.c	Sun Mar 17 06:30:39 2019 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_process.c	Mon Mar 18 17:56:04 2019 +0000
@@ -9,12 +9,19 @@
 #include "rvf/rvf_api.h"
 #include "rvm/rvm_use_id_list.h"
 #include "abb/abb.h"
+#include "fc-target.cfg"
 #include <string.h>
 #include <stdio.h>
 
 extern UINT16 madc_vbat_2_physical(UINT16 adc_val);
 extern UINT16 madc_vbat_inverse(UINT16 mv);
 
+#if defined(CONFIG_TARGET_C155) || defined(CONFIG_TARGET_J100)
+#define	LEDC	0x20
+#else
+#define	LEDC	0
+#endif
+
 void pwr_init_discharge(void)
 {
 	pwr_ctrl->curr_disch_thresh = 0;
@@ -76,7 +83,7 @@
 	ABB_Write_Register_on_page(PAGE0, CHGREG,
 			pwr_ctrl->config.ci_current + pwr_ctrl->i2v_offset);
 	/* Enable the charger */
-	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0003);
+	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0003 | LEDC);
 	/* The total charging time starts now */
 	pwr_ctrl->start_time = rvf_get_tick_count();
 }
@@ -97,7 +104,7 @@
 	/* Program the DAC with the constant voltage value */
 	ABB_Write_Register_on_page(PAGE0, CHGREG, code);
 	/* Enable the charger */
-	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0001);
+	ABB_Write_Register_on_page(PAGE0, BCICTL2, 0x0001 | LEDC);
 	/* CV control loop state init */
 	pwr_ctrl->cv_dac_init = code;
 	pwr_ctrl->cv_dac_curr = code;