FreeCalypso > hg > fc-selenite
changeset 161:5ad7f6a9d7d4
FCHG: turn on the charging LED on C155 and J100 targets
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 22 Mar 2019 17:13:59 +0000 |
parents | c300f828b244 |
children | 8c5d012b9c4d |
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 07:23:54 2019 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_process.c Fri Mar 22 17:13:59 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;