annotate src/cs/drivers/drv_app/fchg/fchg_default_batt.c @ 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 919b44c991fc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
324
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module provides the default table of battery State-of-Charge
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * thresholds in the absence of a customized table in FFS.
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * The present default table has been taken from Pirelli's firmware.
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 */
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "fchg/fchg_env.h"
326
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 324
diff changeset
9 #include "fchg/fchg_func_i.h"
324
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "rv/rv_general.h"
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <string.h>
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 static const T_PWR_THRESHOLDS default_batt_table[] = {
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {4170, 100},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {4120, 95},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {4070, 90},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {4030, 85},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {3964, 80},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {3930, 75},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {3900, 70},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 {3882, 65},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 {3847, 60},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {3805, 55},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 {3786, 50},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 {3771, 45},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {3759, 40},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 {3750, 35},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 {3745, 30},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {3737, 25},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 {3719, 20},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {3688, 15},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {3663, 10},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {3539, 5},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 {3370, 0}
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 };
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 void pwr_set_default_batt_table(void)
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 {
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 memcpy(pwr_ctrl->batt_thresholds, default_batt_table,
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 sizeof default_batt_table);
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 pwr_ctrl->nb_thresholds = sizeof(default_batt_table) /
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 sizeof(T_PWR_THRESHOLDS);
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }