changeset 336:be011556e71f

FCHG: API implementation started
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 14 Dec 2017 21:01:59 +0000
parents 6c0659acf93e
children 0df0668f8bea
files components/fchg src/cs/drivers/drv_app/fchg/fchg_api.c
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/components/fchg	Thu Dec 14 20:41:18 2017 +0000
+++ b/components/fchg	Thu Dec 14 21:01:59 2017 +0000
@@ -35,6 +35,7 @@
 
 SRCDIR=$SRC/cs/drivers/drv_app/fchg
 
+cfile_plain $SRCDIR/fchg_api.c
 cfile_plain $SRCDIR/fchg_default_batt.c
 cfile_plain $SRCDIR/fchg_env.c
 cfile_plain $SRCDIR/fchg_ffs_init.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_api.c	Thu Dec 14 21:01:59 2017 +0000
@@ -0,0 +1,19 @@
+/*
+ * The implementation of our external API functions lives here.
+ */
+
+#include "fchg/fchg_api.h"
+#include "fchg/fchg_env.h"
+#include "fchg/fchg_messages.h"
+#include "rv/rv_general.h"
+#include "rvf/rvf_api.h"
+#include "rvm/rvm_use_id_list.h"
+
+T_RV_RET fchg_get_current_state(struct fchg_user_state *rstruct)
+{
+	rstruct->chg_state = pwr_ctrl->state;
+	rstruct->batt_mv = pwr_ctrl->batt_mv;
+	rstruct->batt_percent =
+	    pwr_ctrl->batt_thresholds[pwr_ctrl->curr_disch_thresh].remain_capa;
+	return RV_OK;
+}