changeset 324:6ab14029931c

FCHG: default battery table implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 05 Dec 2017 01:29:04 +0000
parents f08212cf0b04
children ab47ade99fa9
files components/fchg src/cs/drivers/drv_app/fchg/fchg_default_batt.c
diffstat 2 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/components/fchg	Mon Dec 04 06:00:15 2017 +0000
+++ b/components/fchg	Tue Dec 05 01:29:04 2017 +0000
@@ -35,4 +35,5 @@
 
 SRCDIR=$SRC/cs/drivers/drv_app/fchg
 
+cfile_plain $SRCDIR/fchg_default_batt.c
 cfile_plain $SRCDIR/fchg_env.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_default_batt.c	Tue Dec 05 01:29:04 2017 +0000
@@ -0,0 +1,42 @@
+/*
+ * This module provides the default table of battery State-of-Charge
+ * thresholds in the absence of a customized table in FFS.
+ *
+ * The present default table has been taken from Pirelli's firmware.
+ */
+
+#include "fchg/fchg_env.h"
+#include "rv/rv_general.h"
+#include <string.h>
+
+static const T_PWR_THRESHOLDS default_batt_table[] = {
+	{4170, 100},
+	{4120, 95},
+	{4070, 90},
+	{4030, 85},
+	{3964, 80},
+	{3930, 75},
+	{3900, 70},
+	{3882, 65},
+	{3847, 60},
+	{3805, 55},
+	{3786, 50},
+	{3771, 45},
+	{3759, 40},
+	{3750, 35},
+	{3745, 30},
+	{3737, 25},
+	{3719, 20},
+	{3688, 15},
+	{3663, 10},
+	{3539, 5},
+	{3370, 0}
+};
+
+void pwr_set_default_batt_table(void)
+{
+	memcpy(pwr_ctrl->batt_thresholds, default_batt_table,
+		sizeof default_batt_table);
+	pwr_ctrl->nb_thresholds = sizeof(default_batt_table) /
+				  sizeof(T_PWR_THRESHOLDS);
+}